From cb8f246d72975ecb68e5a14af0c66cbd7a5439c4 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Tue, 24 Dec 2024 10:52:39 +0100 Subject: [PATCH] Fix parse error when using parentheses in a group in a key value command argument --- CHANGELOG.md | 1 + src/nl/hannahsten/texifyidea/grammar/Latex.bnf | 2 +- test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6449cd85b..ae4085ee6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Add checkboxes to graphic insertion wizard for relative width or height ### Fixed +* Fix parse error when using parentheses in a group in a key value command argument ## [0.9.10-alpha.4] - 2024-12-21 diff --git a/src/nl/hannahsten/texifyidea/grammar/Latex.bnf b/src/nl/hannahsten/texifyidea/grammar/Latex.bnf index 0c9c269d9..aff2adce4 100644 --- a/src/nl/hannahsten/texifyidea/grammar/Latex.bnf +++ b/src/nl/hannahsten/texifyidea/grammar/Latex.bnf @@ -165,7 +165,7 @@ parameter_group ::= OPEN_BRACE parameter_group_text CLOSE_BRACE { pin=1 } // Be sure to capture the whitespace before and after the actual content as groups are meant to capture // *everything* inside them. // This element is needed instead of parameter_text in order to avoid parse errors for various other tokens that do not appear in parameter_text because they are not usually part of the reference -parameter_group_text ::= (parameter_text | group | COMMA | EQUALS | OPEN_BRACKET | CLOSE_BRACKET)* { hooks = [wsBinders="GREEDY_LEFT_BINDER, GREEDY_RIGHT_BINDER"] } +parameter_group_text ::= (parameter_text | group | COMMA | EQUALS | OPEN_BRACKET | CLOSE_BRACKET | OPEN_PAREN | CLOSE_PAREN | OPEN_ANGLE_BRACKET | CLOSE_ANGLE_BRACKET)* { hooks = [wsBinders="GREEDY_LEFT_BINDER, GREEDY_RIGHT_BINDER"] } comment ::= COMMENT_TOKEN diff --git a/test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt b/test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt index 1db3e5196..a3f2378b4 100644 --- a/test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt +++ b/test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt @@ -24,6 +24,8 @@ class LatexParserTest : BasePlatformTestCase() { ${'$'}\test{\cmd{a}[b]}${'$'} \newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}} + + \anycommand{test = {Some text with (Round Brackets)}} """.trimIndent() ) myFixture.checkHighlighting()