From e41bda3e61700d946efc8765796a28f47f90fbb4 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 4 Jul 2023 09:10:57 +0100 Subject: [PATCH] Merge pull request #13664 from overleaf/mj-bibtex-match-brackets Add bibtex match brackets highlighting GitOrigin-RevId: d0ed07d9874f097dd8b59eff582eb23a59f46332 --- .../source-editor/lezer-bibtex/bibtex.grammar | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/lezer-bibtex/bibtex.grammar b/services/web/frontend/js/features/source-editor/lezer-bibtex/bibtex.grammar index e44f02b863..7af78962da 100644 --- a/services/web/frontend/js/features/source-editor/lezer-bibtex/bibtex.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-bibtex/bibtex.grammar @@ -1,5 +1,3 @@ - - @top Bibliography { (Declaration | StringDeclaration)* } @@ -15,7 +13,9 @@ EntryTypeName { $[a-zA-Z]+ } Number { @digit+ } StringKeyword {"@"$[Ss]$[Tt]$[Rr]$[Ii]$[Nn]$[Gg]} - "@" "{" "}" "\"" "," "#" "@string" + "{"[closedBy="}"] + "}"[openedBy="{"] + "@" "\"" "," "#" "@string" Comment { "%" ![\n]* } } @@ -51,8 +51,8 @@ Expression { } @local tokens { - openBracedContents {"{"} - closeBracedContents {"}"} + OpenBracedContents[closedBy="}", @name="{"] {"{"} + CloseBracedContents[openedBy="{", @name="}"] {"}"} @else nonClosingBracedContents } @@ -61,19 +61,17 @@ Expression { ( nonClosingBracedContents | nestedBracedString { - openBracedContents + OpenBracedContents bracedStringContents - closeBracedContents + CloseBracedContents } )* } BracedString { - "{" - bracedStringContents closeBracedContents + "{" bracedStringContents CloseBracedContents } } -// TODO: Implement this @precedence { concatenation @left } StringConcatenation {