-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Issue
@annotation
is parsed as Token.Text.Whitespace( )
+ Token.Operator(@)
+ Token.Text(annotation)
Expected behavior
Token.Text.Whitespace( )
+ Token.Name.Decorator(@annotation)
Potential solution
Remove the check for newline / whitespace (^[ \t]*
)
openqasm-pygments/src/openqasm_pygments/qasm3.py
Lines 77 to 78 in d6d0e07
(r"^[ \t]*#?pragma", token.Comment.Preproc, "pragma"), | |
(r"^[ \t]*@\w+(\.\w+)*", token.Name.Decorator, "annotation"), |
Note: Lexing of indented pragma
s works but includes the whitespace in the Token.Comment.Preproc
token
Pros
- Match official grammar
- Don't include whitespace in parsed token
Cons
- Annotations might be highlighted within a line (Breaking change)
Metadata
Metadata
Assignees
Labels
No labels