mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 23:03:56 +00:00
Merge pull request #13805 from overleaf/mj-bibtex-content-outside
[lezer] Allow content outside declarations in bibtex GitOrigin-RevId: 8051db5567eeb52c3b12f63afafe07a7a97df650
This commit is contained in:
parent
7e6b756848
commit
37582f7b72
2 changed files with 23 additions and 7 deletions
|
@ -1,9 +1,10 @@
|
|||
@top Bibliography {
|
||||
(Declaration | StringDeclaration)*
|
||||
(Other | Declaration | CommentDeclaration | PreambleDeclaration | StringDeclaration)*
|
||||
}
|
||||
|
||||
@tokens {
|
||||
whiteSpace { @whitespace+ }
|
||||
Other { ![@ \t\n] ![@]* }
|
||||
whiteSpace { $[\t\n ]+ }
|
||||
Identifier { $[a-zA-Z:_0-9-/]+ }
|
||||
StringName { $[a-zA-Z:_] $[a-zA-Z:_0-9-]* }
|
||||
FieldName {$[a-zA-Z-_0-9]+}
|
||||
|
@ -13,15 +14,15 @@
|
|||
EntryTypeName { $[a-zA-Z]+ }
|
||||
Number { @digit+ }
|
||||
StringKeyword {"@"$[Ss]$[Tt]$[Rr]$[Ii]$[Nn]$[Gg]}
|
||||
PreambleKeyword {"@"$[Pp]$[Rr]$[Ee]$[Aa]$[Mm]$[Bb]$[Ll]$[Ee]}
|
||||
CommentKeyword {"@"$[Cc]$[Oo]$[Mm]$[Mm]$[Ee]$[Nn]$[Tt]}
|
||||
CommentContents { ![@} \t\n] ![}@]* }
|
||||
"{"[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}
|
||||
@skip { whiteSpace }
|
||||
|
||||
StringDeclaration {
|
||||
StringKeyword "{"
|
||||
|
@ -29,6 +30,18 @@ StringDeclaration {
|
|||
"}"
|
||||
}
|
||||
|
||||
PreambleDeclaration {
|
||||
PreambleKeyword "{"
|
||||
Expression
|
||||
"}"
|
||||
}
|
||||
|
||||
CommentDeclaration {
|
||||
CommentKeyword "{"
|
||||
CommentContents*
|
||||
"}"
|
||||
}
|
||||
|
||||
Declaration {
|
||||
EntryName { "@" EntryTypeName } "{"
|
||||
Identifier
|
||||
|
|
|
@ -10,6 +10,9 @@ export const highlighting = styleTags({
|
|||
Expression: t.attributeValue,
|
||||
'#': t.operator,
|
||||
StringKeyword: t.keyword,
|
||||
PreambleKeyword: t.keyword,
|
||||
CommentKeyword: t.keyword,
|
||||
CommentContents: t.comment,
|
||||
StringName: t.variableName,
|
||||
Comment: t.comment,
|
||||
Other: t.comment,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue