Skip to content

lexer: restart after consumed comments and verbatim delimiters - #381

Open
codexagents wants to merge 1 commit into
flosch:masterfrom
tokenmaxed:sandbox@ns1029703/upstream-lexer-restart
Open

lexer: restart after consumed comments and verbatim delimiters#381
codexagents wants to merge 1 commit into
flosch:masterfrom
tokenmaxed:sandbox@ns1029703/upstream-lexer-restart

Conversation

@codexagents

Copy link
Copy Markdown

Summary

  • restart delimiter recognition after consuming a short comment
  • restart delimiter recognition after consuming a verbatim delimiter
  • cover adjacent comments, comment/verbatim boundaries, and adjacent verbatim regions
  • add a generated differential table for the Django short-comment contract

Why

The lexer currently advances one ordinary byte after consuming a comment or verbatim delimiter before it checks for another delimiter. As a result, adjacent {# ... #} comments can leak the leading {, and an immediately adjacent {% verbatim %} region is parsed as a normal template tag.

The restart is guarded by a boolean that is true only when input was consumed, so it cannot spin without cursor progress.

Verification

  • go test ./...
  • go test -race ./...
  • go vet ./...

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant