Working on jinja2 syntax highlight, so far so good.
i was writing for and if grammar, and now it is showing error on curly braces
(at sign)top Script { statement+ }
(at sign)top Template { directive * }
directive {
Insert |
Insert2 |
RawBlock |
OnelineComment
}Insert { “{{” (space* (identifier | Number | Bool | String | Equa | Subexp | “|” ))* space* “}}” }
Insert2 { “{%” (space* (identifier | Number | Bool | String | Equa | Subexp | “|” ))* space* “%}” }
(at sign)local tokens {
RawClose { “{% endraw %}” }
(at sign)else RawContent
}RawOpen[closedBy=“RawClose”] { “{% raw %}” }
(at sign)skip {} {
RawBlock { RawOpen RawContent* RawClose }
}(at sign)skip { spaces | newline }
OneLineCommentOpen[closedBy=“OneLineCommentClose”] {“{#”}
(at sign)local tokens {
OneLineCommentClose { “#}” }
(at sign)else oneLineCommentContent
}(at sign)skip {} {
OnelineComment { OneLineCommentOpen oneLineCommentContent* OneLineCommentClose }
}statement[(at sign)isGroup] {
ForStatement { kw<“for”> ForInSpec statement kw<“endfor”> }
}ForInSpec {
VariableName
“in”
expression
}(at sign)context trackNewline from “./tokens.js”
Bool { (at sign)specialize<identifier, “true” | “false”> }
Equa { identifier “=” (identifier | Number | Bool | String) }
Subexp { “(” (space* (identifier | Number | Bool | String | Equa | Subexp | “|”))* space* “)” }
(at sign)tokens {
spaces[(at sign)export] { $[\u0009 \u000b\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+ }newline[(at sign)export] { $[\r\n\u2028\u2029] }
identifierChar { (at sign)asciiLetter | $[_$\u{a1}-\u{10ffff}] }
word { identifierChar (identifierChar | (at sign)digit)* }
identifier { word }
kw { (at sign)specialize[(at sign)name={term}]<identifier, term> }
hex { (at sign)digit | $[a-fA-F] }
String { (“'” (![\‘] | “\” _)* "’“?) | (”"" (![\"] | “\” _)* “"”?) }
VariableName { identifier ~arrow }
Number {
((at sign)digit (“" | (at sign)digit)* (“.” ("” | (at sign)digit))? | “.” (at sign)digit (“_” | (at sign)digit))
((“e” | “E”) (“+” | “-”)? (“" | (at sign)digit)+)? |
(at sign)digit ("” | (at sign)digit)* “n” |
“0x” (hex | "")+ “n”? |
“0b” $[01]+ “n”? |
“0o” $[0-7_]+ “n”?
}space { (at sign)whitespace+ }
(at sign)precedence { spaces, newline, identifier}
(at sign)precedence { spaces, newline, identifier}
(at sign)precedence { spaces, newline, space }
“{{”
“}}”
“.”
}(at sign)external propSource Highlight from “./highlight.js”
error is: Unrecognized expression type in token (syntax.grammar 71:13), which points at curly brace (“{”).