mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
e0a3dfec36
GitOrigin-RevId: 88f5cf069563940b1e42763babdc1e58d65c1d31
83 lines
No EOL
1.6 KiB
Text
83 lines
No EOL
1.6 KiB
Text
@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]}
|
|
"{"[closedBy="}"]
|
|
"}"[openedBy="{"]
|
|
"@" "\"" "," "#" "@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[closedBy="}", @name="{"] {"{"}
|
|
CloseBracedContents[openedBy="{", @name="}"] {"}"}
|
|
@else nonClosingBracedContents
|
|
}
|
|
|
|
@skip {}{
|
|
BracedStringContents {
|
|
(
|
|
nonClosingBracedContents |
|
|
nestedBracedString {
|
|
OpenBracedContents
|
|
BracedStringContents
|
|
CloseBracedContents
|
|
}
|
|
)*
|
|
}
|
|
BracedString {
|
|
"{" BracedStringContents CloseBracedContents
|
|
}
|
|
}
|
|
|
|
@precedence { concatenation @left }
|
|
|
|
StringConcatenation {
|
|
StringConcatenation !concatenation "#" StringConcatenation |
|
|
LiteralString |
|
|
StringName
|
|
}
|
|
|
|
@external propSource highlighting from "./highlight.mjs" |