Skip to content

Fix indented annotations and pragmas #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

jakelishman
Copy link
Contributor

Pygments offers the bygroups helper to split simple context-sensitive tokens (like annotations) up into components based on regex groups, which lets us avoid including leading whitespace in annotation and pragma tokens while remaining newline-sensitive.

The whitespace tokenisation needs to break after runs of newlines to allow the newline-sensitive tokens to detect that they are at the start of a line.

Fix #7

Pygments offers the `bygroups` helper to split simple context-sensitive
tokens (like annotations) up into components based on regex groups,
which lets us avoid including leading whitespace in annotation and
pragma tokens while remaining newline-sensitive.

The whitespace tokenisation needs to break after runs of newlines to
allow the newline-sensitive tokens to detect that they _are_ at the
start of a line.
@jakelishman jakelishman merged commit 6c5a813 into openqasm:main Jun 6, 2025
4 checks passed
@jakelishman jakelishman deleted the indented-annotations branch June 6, 2025 12:27
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.

[Bug]: Lexing indented annotation
1 participant