Skip to content

Python: CodeTokenizer splits quoted named-arg values on spaces (NamedArgBlockSyntaxError) #14460

Description

Description

CodeTokenizer splits named-argument quoted values at spaces, so a template like:

{{func key='hello world'}}

fails with NamedArgBlockSyntaxError: A NamedArgBlock starts with a name... — the token for the argument is cut to key='hello and parsing breaks. Any quoted named-arg value containing a space breaks the whole template.

Reproduction

from semantic_kernel.template_engine.code_tokenizer import CodeTokenizer
CodeTokenizer().tokenize("{{func key='hello world'}}")
# NamedArgBlockSyntaxError

Same with double quotes.

Expected behavior

quoted values are single tokens, spaces included, matching how the value grammar is documented (ValBlock is text surrounded by quotes).

Environment

semantic-kernel python main, Python 3.12

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonPull requests for the Python Semantic Kerneltriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions