From 43613e8a4497955d0df0d35b7ce30d4cd079c02d Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:07:22 -0400 Subject: [PATCH] Merge pull request #19137 from overleaf/em-mj-parbox Add special parsing for \parbox GitOrigin-RevId: a69a519fa75af95712e19426265224507400f105 --- .../js/features/source-editor/lezer-latex/latex.grammar | 9 ++++++++- .../js/features/source-editor/lezer-latex/tokens.mjs | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar index 84e7c4fa3a..95d9501da4 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar @@ -93,7 +93,8 @@ TopRuleCtrlSeq, MidRuleCtrlSeq, BottomRuleCtrlSeq, - MultiColumnCtrlSeq + MultiColumnCtrlSeq, + ParBoxCtrlSeq } @external specialize {EnvName} specializeEnvName from "./tokens.mjs" { @@ -347,6 +348,12 @@ KnownCommand { } | MathTextCommand { MathTextCtrlSeq optionalWhitespace? "*"? TextArgument + } | + ParBoxCommand { + ParBoxCtrlSeq + (optionalWhitespace? OptionalArgument)* + ShortTextArgument + optionalWhitespace? TextArgument } } diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs b/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs index 5b1cfff016..ba0f168521 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs +++ b/services/web/frontend/js/features/source-editor/lezer-latex/tokens.mjs @@ -79,6 +79,7 @@ import { BottomRuleCtrlSeq, TableEnvName, MultiColumnCtrlSeq, + ParBoxCtrlSeq, // Marker for end of argument lists endOfArguments, hasMoreArguments, @@ -575,6 +576,7 @@ const otherKnowncommands = { '\\midrule': MidRuleCtrlSeq, '\\bottomrule': BottomRuleCtrlSeq, '\\multicolumn': MultiColumnCtrlSeq, + '\\parbox': ParBoxCtrlSeq, } // specializer for control sequences // return new tokens for specific control sequences