From ccf111650d012993a1ad0cf9153fbd25ec4095ca Mon Sep 17 00:00:00 2001 From: alaindargelas Date: Tue, 10 Sep 2024 19:02:06 -0700 Subject: [PATCH] Preprocessor fix for escaped identifiers --- grammar/SV3_1aPpLexer.g4 | 5 ++++- grammar/build.xml | 4 ++-- third_party/tests/Yosys/Yosys.log | 10 ++-------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/grammar/SV3_1aPpLexer.g4 b/grammar/SV3_1aPpLexer.g4 index c0894efba6..f827d92eac 100644 --- a/grammar/SV3_1aPpLexer.g4 +++ b/grammar/SV3_1aPpLexer.g4 @@ -16,7 +16,10 @@ lexer grammar SV3_1aPpLexer; -ESCAPED_IDENTIFIER: '\\' ~[WS\r\t\n]*? WS; +ESCAPED_IDENTIFIER: '\\' ~[WS\r\t\n]*? WS | + '\\' ( OPEN_BRACKET? [A-Za-z0-9_$+-.]+ CLOSE_BRACKET?)* WS; + + // A.9.2 Comments diff --git a/grammar/build.xml b/grammar/build.xml index a2df6dbfd5..77f4661a36 100644 --- a/grammar/build.xml +++ b/grammar/build.xml @@ -24,9 +24,9 @@ limitations under the License. + value="../third_party/antlr4_bin/antlr-4.12.0-complete.jar"/> + value="../third_party/antlr4_bin/antlr-4.12.0-complete.jar"/> diff --git a/third_party/tests/Yosys/Yosys.log b/third_party/tests/Yosys/Yosys.log index 40fd8df413..75da9257b6 100644 --- a/third_party/tests/Yosys/Yosys.log +++ b/third_party/tests/Yosys/Yosys.log @@ -993,14 +993,8 @@ Processing: -cd various +incdir+. -parse -nocache -nobuiltin -nonote -noinfo -ti [WARNING] : 0 [ NOTE] : 0 Processing: -cd various +incdir+. -parse -nocache -nobuiltin -nonote -noinfo -timescale=1ns/1ns shregmap.v -l shregmap.v.log -[SNT:PA0207] ${SURELOG_DIR}/third_party/tests/Yosys/various/shregmap.v:15:7: Syntax error: no viable alternative at input 'module \', -module \$__SHREG_DFF_P_ (input C, D, output Q); - ^-- ${SURELOG_DIR}/build/regression/Yosys/slpp_all/lib/work/various/shregmap.v:15:7:. -[SNT:PA0207] ${SURELOG_DIR}/third_party/tests/Yosys/various/shregmap.v:19: Syntax error: mismatched input 'always' expecting , -always @(posedge C) -^-- ${SURELOG_DIR}/build/regression/Yosys/slpp_all/lib/work/various/shregmap.v:19:0:. [ FATAL] : 0 -[ SYNTAX] : 2 +[ SYNTAX] : 0 [ ERROR] : 0 [WARNING] : 0 [ NOTE] : 0 @@ -1800,7 +1794,7 @@ Processing: -cd simple +incdir+. -parse -nocache -nobuiltin -nonote -noinfo -tim [ NOTE] : 0 Processed 253 tests. [ FATAL] : 0 -[ SYNTAX] : 16 +[ SYNTAX] : 14 [ ERROR] : 3 [WARNING] : 230 [ NOTE] : 0