| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- @top Bibliography {
- (Declaration | StringDeclaration)*
- }
- @tokens {
- whiteSpace { @whitespace+ }
- Identifier { $[a-zA-Z:_0-9-]+ }
- StringName { $[a-zA-Z:_] $[a-zA-Z:_0-9-]* }
- FieldName {$[a-zA-Z-_0-9]+}
- LiteralString {
- '"' (!["] | "\\" _)* '"'?
- }
- EntryTypeName { $[a-zA-Z]+ }
- Number { @digit+ }
- StringKeyword {"@"$[Ss]$[Tt]$[Rr]$[Ii]$[Nn]$[Gg]}
- "@" "{" "}" "\"" "," "#" "@string"
- Comment { "%" ![\n]* }
- }
- // FIXME: Technically skipping comments is wrong here. They can only appear
- // alone on a line, but I'm not sure how to express that easily in Lezer
- @skip {whiteSpace | Comment}
- StringDeclaration {
- StringKeyword "{"
- Field<StringName>*
- "}"
- }
- Declaration {
- EntryName { "@" EntryTypeName } "{"
- Identifier
-
- fieldEntry {
- ("," Field<FieldName> )
- }*
- ("," )?
- "}"
- }
- Field<Name> {
- Name "=" Expression
- }
- Expression {
- BracedString |
- Number |
- StringConcatenation
- }
- @local tokens {
- openBracedContents {"{"}
- closeBracedContents {"}"}
- @else nonClosingBracedContents
- }
- @skip {}{
- bracedStringContents {
- (
- nonClosingBracedContents |
- nestedBracedString {
- openBracedContents
- bracedStringContents
- closeBracedContents
- }
- )*
- }
- BracedString {
- "{"
- bracedStringContents closeBracedContents
- }
- }
- // TODO: Implement this
- @precedence { concatenation @left }
- StringConcatenation {
- StringConcatenation !concatenation "#" StringConcatenation |
- LiteralString |
- StringName
- }
- @external propSource highlighting from "./highlight.mjs"
|