Skip to content

Python: keep quoted named-arg values as single tokens in CodeTokenizer - #14461

Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/code-tokenizer-named-arg-spaces
Open

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/code-tokenizer-named-arg-spaces

Conversation

@ManoharPaturi

Copy link
Copy Markdown

Fixes #14460.

the tokenizer now carries a quote-aware state while scanning tokens so a quoted value stays one token even when it contains spaces, matching the ValBlock grammar. template tests for both quote styles fail on main and pass here.

A template like {{ plugin.function arg1='value with spaces' }} failed with
TemplateSyntaxError because the tokenizer never entered value mode for the
quote after name=: the space inside the quoted value ended the token early,
producing the invalid block key='value instead of a NamedArgBlock.

Enter VALUE mode when a quote directly follows the = of a named argument and
flush the token as a NamedArgBlock, matching how positional quoted values
with spaces already worked.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants