From eabaae0fe20cf57462708b671e99907180c5f28a Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 18 Jul 2024 15:40:43 -0400 Subject: [PATCH] nitcc: add new tests of grammars (some with conflicts) Signed-off-by: Jean Privat --- contrib/nitcc/tests/amb.input | 1 + contrib/nitcc/tests/amb.sablecc | 4 ++++ contrib/nitcc/tests/amb2.input | 1 + contrib/nitcc/tests/amb2.sablecc | 7 ++++++ contrib/nitcc/tests/amb3.input | 1 + contrib/nitcc/tests/amb3.sablecc | 5 ++++ contrib/nitcc/tests/eq.input | 1 + contrib/nitcc/tests/eq.sablecc | 9 ++++++++ contrib/nitcc/tests/eq2.input | 1 + contrib/nitcc/tests/eq2.sablecc | 10 ++++++++ contrib/nitcc/tests/eq3.input | 1 + contrib/nitcc/tests/eq3.sablecc | 10 ++++++++ contrib/nitcc/tests/geom.input | 1 + contrib/nitcc/tests/geom.sablecc | 9 ++++++++ contrib/nitcc/tests/lg.input | 1 + contrib/nitcc/tests/lg.input2 | 1 + contrib/nitcc/tests/lg.sablecc | 6 +++++ contrib/nitcc/tests/lg2.input | 1 + contrib/nitcc/tests/lg2.input2 | 1 + contrib/nitcc/tests/lg2.sablecc | 5 ++++ contrib/nitcc/tests/sav/amb.input.res | 4 ++++ contrib/nitcc/tests/sav/amb.res | 1 + contrib/nitcc/tests/sav/amb2.input.res | 10 ++++++++ contrib/nitcc/tests/sav/amb2.res | 1 + contrib/nitcc/tests/sav/amb3.res | 1 + contrib/nitcc/tests/sav/eq.input.res | 13 +++++++++++ contrib/nitcc/tests/sav/eq.res | 1 + contrib/nitcc/tests/sav/eq2.input.res | 13 +++++++++++ contrib/nitcc/tests/sav/eq2.res | 1 + contrib/nitcc/tests/sav/eq3.input.res | 13 +++++++++++ contrib/nitcc/tests/sav/eq3.res | 1 + contrib/nitcc/tests/sav/geom.input.res | 32 ++++++++++++++++++++++++++ contrib/nitcc/tests/sav/lg.input.res | 19 +++++++++++++++ contrib/nitcc/tests/sav/lg.input2.res | 19 +++++++++++++++ contrib/nitcc/tests/sav/lg.res | 1 + contrib/nitcc/tests/sav/lg2.input.res | 15 ++++++++++++ contrib/nitcc/tests/sav/lg2.input2.res | 17 ++++++++++++++ contrib/nitcc/tests/sav/lg2.res | 1 + 38 files changed, 239 insertions(+) create mode 100644 contrib/nitcc/tests/amb.input create mode 100644 contrib/nitcc/tests/amb.sablecc create mode 100644 contrib/nitcc/tests/amb2.input create mode 100644 contrib/nitcc/tests/amb2.sablecc create mode 100644 contrib/nitcc/tests/amb3.input create mode 100644 contrib/nitcc/tests/amb3.sablecc create mode 100644 contrib/nitcc/tests/eq.input create mode 100644 contrib/nitcc/tests/eq.sablecc create mode 100644 contrib/nitcc/tests/eq2.input create mode 100644 contrib/nitcc/tests/eq2.sablecc create mode 100644 contrib/nitcc/tests/eq3.input create mode 100644 contrib/nitcc/tests/eq3.sablecc create mode 100644 contrib/nitcc/tests/geom.input create mode 100644 contrib/nitcc/tests/geom.sablecc create mode 100644 contrib/nitcc/tests/lg.input create mode 100644 contrib/nitcc/tests/lg.input2 create mode 100644 contrib/nitcc/tests/lg.sablecc create mode 100644 contrib/nitcc/tests/lg2.input create mode 100644 contrib/nitcc/tests/lg2.input2 create mode 100644 contrib/nitcc/tests/lg2.sablecc create mode 100644 contrib/nitcc/tests/sav/amb.input.res create mode 100644 contrib/nitcc/tests/sav/amb.res create mode 100644 contrib/nitcc/tests/sav/amb2.input.res create mode 100644 contrib/nitcc/tests/sav/amb2.res create mode 100644 contrib/nitcc/tests/sav/amb3.res create mode 100644 contrib/nitcc/tests/sav/eq.input.res create mode 100644 contrib/nitcc/tests/sav/eq.res create mode 100644 contrib/nitcc/tests/sav/eq2.input.res create mode 100644 contrib/nitcc/tests/sav/eq2.res create mode 100644 contrib/nitcc/tests/sav/eq3.input.res create mode 100644 contrib/nitcc/tests/sav/eq3.res create mode 100644 contrib/nitcc/tests/sav/geom.input.res create mode 100644 contrib/nitcc/tests/sav/lg.input.res create mode 100644 contrib/nitcc/tests/sav/lg.input2.res create mode 100644 contrib/nitcc/tests/sav/lg.res create mode 100644 contrib/nitcc/tests/sav/lg2.input.res create mode 100644 contrib/nitcc/tests/sav/lg2.input2.res create mode 100644 contrib/nitcc/tests/sav/lg2.res diff --git a/contrib/nitcc/tests/amb.input b/contrib/nitcc/tests/amb.input new file mode 100644 index 0000000000..074d1eeb40 --- /dev/null +++ b/contrib/nitcc/tests/amb.input @@ -0,0 +1 @@ +id diff --git a/contrib/nitcc/tests/amb.sablecc b/contrib/nitcc/tests/amb.sablecc new file mode 100644 index 0000000000..bbe895fe49 --- /dev/null +++ b/contrib/nitcc/tests/amb.sablecc @@ -0,0 +1,4 @@ +Grammar amb; +Parser +Ignored #10, #32; +e = 'id' | e | e; diff --git a/contrib/nitcc/tests/amb2.input b/contrib/nitcc/tests/amb2.input new file mode 100644 index 0000000000..7d5c7b2b5e --- /dev/null +++ b/contrib/nitcc/tests/amb2.input @@ -0,0 +1 @@ +-0+ diff --git a/contrib/nitcc/tests/amb2.sablecc b/contrib/nitcc/tests/amb2.sablecc new file mode 100644 index 0000000000..5e9e49afec --- /dev/null +++ b/contrib/nitcc/tests/amb2.sablecc @@ -0,0 +1,7 @@ +Grammar amb; +Parser +Ignored #10, #32; +e = '-' a | b '+' | '0'; +a = e ; +b = e ; + diff --git a/contrib/nitcc/tests/amb3.input b/contrib/nitcc/tests/amb3.input new file mode 100644 index 0000000000..b2901ea97c --- /dev/null +++ b/contrib/nitcc/tests/amb3.input @@ -0,0 +1 @@ +a b diff --git a/contrib/nitcc/tests/amb3.sablecc b/contrib/nitcc/tests/amb3.sablecc new file mode 100644 index 0000000000..bdc84b7444 --- /dev/null +++ b/contrib/nitcc/tests/amb3.sablecc @@ -0,0 +1,5 @@ +Grammar amb; +Parser +Ignored #10, #32; +e = x 'b' | 'a' x ; +x = 'a' | 'b'; diff --git a/contrib/nitcc/tests/eq.input b/contrib/nitcc/tests/eq.input new file mode 100644 index 0000000000..e3280dd06b --- /dev/null +++ b/contrib/nitcc/tests/eq.input @@ -0,0 +1 @@ +id=id=id diff --git a/contrib/nitcc/tests/eq.sablecc b/contrib/nitcc/tests/eq.sablecc new file mode 100644 index 0000000000..7f1e196143 --- /dev/null +++ b/contrib/nitcc/tests/eq.sablecc @@ -0,0 +1,9 @@ +Grammar eq; +Parser +Ignored #10, #32; +e = + var '=' e | + var ; +c = + e '=' e ; +var = 'id' ; diff --git a/contrib/nitcc/tests/eq2.input b/contrib/nitcc/tests/eq2.input new file mode 100644 index 0000000000..e3280dd06b --- /dev/null +++ b/contrib/nitcc/tests/eq2.input @@ -0,0 +1 @@ +id=id=id diff --git a/contrib/nitcc/tests/eq2.sablecc b/contrib/nitcc/tests/eq2.sablecc new file mode 100644 index 0000000000..7c5db34ec1 --- /dev/null +++ b/contrib/nitcc/tests/eq2.sablecc @@ -0,0 +1,10 @@ +Grammar eq; +Parser +Ignored #10, #32; +e = + var '=' e | + 'assert' c | + var ; +c = + e '=' e ; +var = 'id' ; diff --git a/contrib/nitcc/tests/eq3.input b/contrib/nitcc/tests/eq3.input new file mode 100644 index 0000000000..e3280dd06b --- /dev/null +++ b/contrib/nitcc/tests/eq3.input @@ -0,0 +1 @@ +id=id=id diff --git a/contrib/nitcc/tests/eq3.sablecc b/contrib/nitcc/tests/eq3.sablecc new file mode 100644 index 0000000000..33bb02da82 --- /dev/null +++ b/contrib/nitcc/tests/eq3.sablecc @@ -0,0 +1,10 @@ +Grammar eq; +Parser +Ignored #10, #32; +e = + var '=' e | + c | + var ; +c = + e '=' e ; +var = 'id' ; diff --git a/contrib/nitcc/tests/geom.input b/contrib/nitcc/tests/geom.input new file mode 100644 index 0000000000..4b169b1f5a --- /dev/null +++ b/contrib/nitcc/tests/geom.input @@ -0,0 +1 @@ +triangle 0x0 0@0 centre circle 0x0 0@0 diff --git a/contrib/nitcc/tests/geom.sablecc b/contrib/nitcc/tests/geom.sablecc new file mode 100644 index 0000000000..5968e1fbff --- /dev/null +++ b/contrib/nitcc/tests/geom.sablecc @@ -0,0 +1,9 @@ +Grammar geom; +Parser +Ignored #10, #32; +forme = + 'triangle' point point point | + 'circle' point point ; +point = num 'x' num | num '@' num | 'centre' forme; +num = '0'; + diff --git a/contrib/nitcc/tests/lg.input b/contrib/nitcc/tests/lg.input new file mode 100644 index 0000000000..20afe73e05 --- /dev/null +++ b/contrib/nitcc/tests/lg.input @@ -0,0 +1 @@ +<0><0>> diff --git a/contrib/nitcc/tests/lg.input2 b/contrib/nitcc/tests/lg.input2 new file mode 100644 index 0000000000..9b09d7781c --- /dev/null +++ b/contrib/nitcc/tests/lg.input2 @@ -0,0 +1 @@ +<0><0>0 diff --git a/contrib/nitcc/tests/lg.sablecc b/contrib/nitcc/tests/lg.sablecc new file mode 100644 index 0000000000..c2a1e74804 --- /dev/null +++ b/contrib/nitcc/tests/lg.sablecc @@ -0,0 +1,6 @@ +Grammar lg; +Parser +Ignored #10, #32; +e = e '<' a | e '>' a | a ; +a = n | '<' e '>' ; +n = '0' ; diff --git a/contrib/nitcc/tests/lg2.input b/contrib/nitcc/tests/lg2.input new file mode 100644 index 0000000000..20afe73e05 --- /dev/null +++ b/contrib/nitcc/tests/lg2.input @@ -0,0 +1 @@ +<0><0>> diff --git a/contrib/nitcc/tests/lg2.input2 b/contrib/nitcc/tests/lg2.input2 new file mode 100644 index 0000000000..9b09d7781c --- /dev/null +++ b/contrib/nitcc/tests/lg2.input2 @@ -0,0 +1 @@ +<0><0>0 diff --git a/contrib/nitcc/tests/lg2.sablecc b/contrib/nitcc/tests/lg2.sablecc new file mode 100644 index 0000000000..4277f3c56f --- /dev/null +++ b/contrib/nitcc/tests/lg2.sablecc @@ -0,0 +1,5 @@ +Grammar lg; +Parser +Ignored #10, #32; +e = e '<' e | e '>' e | n | '<' e '>' ; +n = '0' ; diff --git a/contrib/nitcc/tests/sav/amb.input.res b/contrib/nitcc/tests/sav/amb.input.res new file mode 100644 index 0000000000..e8b4706101 --- /dev/null +++ b/contrib/nitcc/tests/sav/amb.input.res @@ -0,0 +1,4 @@ +Start + e_0 + 'id'@(1:1-1:3) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/amb.res b/contrib/nitcc/tests/sav/amb.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/amb.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/amb2.input.res b/contrib/nitcc/tests/sav/amb2.input.res new file mode 100644 index 0000000000..39f373159e --- /dev/null +++ b/contrib/nitcc/tests/sav/amb2.input.res @@ -0,0 +1,10 @@ +Start + e_1 + b + e_0 + '-'@(1:1-1:2) + a + e_2 + '0'@(1:2-1:3) + '+'@(1:3-1:4) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/amb2.res b/contrib/nitcc/tests/sav/amb2.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/amb2.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/amb3.res b/contrib/nitcc/tests/sav/amb3.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/amb3.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/eq.input.res b/contrib/nitcc/tests/sav/eq.input.res new file mode 100644 index 0000000000..7e18e33f4b --- /dev/null +++ b/contrib/nitcc/tests/sav/eq.input.res @@ -0,0 +1,13 @@ +Start + e_0 + var + 'id'@(1:1-1:3) + '='@(1:3-1:4) + e_0 + var + 'id'@(1:4-1:6) + '='@(1:6-1:7) + e_1 + var + 'id'@(1:7-1:9) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/eq.res b/contrib/nitcc/tests/sav/eq.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/eq.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/eq2.input.res b/contrib/nitcc/tests/sav/eq2.input.res new file mode 100644 index 0000000000..b7528645f3 --- /dev/null +++ b/contrib/nitcc/tests/sav/eq2.input.res @@ -0,0 +1,13 @@ +Start + e_0 + var + 'id'@(1:1-1:3) + '='@(1:3-1:4) + e_0 + var + 'id'@(1:4-1:6) + '='@(1:6-1:7) + e_2 + var + 'id'@(1:7-1:9) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/eq2.res b/contrib/nitcc/tests/sav/eq2.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/eq2.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/eq3.input.res b/contrib/nitcc/tests/sav/eq3.input.res new file mode 100644 index 0000000000..b7528645f3 --- /dev/null +++ b/contrib/nitcc/tests/sav/eq3.input.res @@ -0,0 +1,13 @@ +Start + e_0 + var + 'id'@(1:1-1:3) + '='@(1:3-1:4) + e_0 + var + 'id'@(1:4-1:6) + '='@(1:6-1:7) + e_2 + var + 'id'@(1:7-1:9) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/eq3.res b/contrib/nitcc/tests/sav/eq3.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/eq3.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/geom.input.res b/contrib/nitcc/tests/sav/geom.input.res new file mode 100644 index 0000000000..516cc64e5d --- /dev/null +++ b/contrib/nitcc/tests/sav/geom.input.res @@ -0,0 +1,32 @@ +Start + forme_0 + 'triangle'@(1:1-1:9) + point_0 + num + '0'@(1:10-1:11) + 'x'@(1:11-1:12) + num + '0'@(1:12-1:13) + point_1 + num + '0'@(1:14-1:15) + '@'@(1:15-1:16) + num + '0'@(1:16-1:17) + point_2 + 'centre'@(1:18-1:24) + forme_1 + 'circle'@(1:25-1:31) + point_0 + num + '0'@(1:32-1:33) + 'x'@(1:33-1:34) + num + '0'@(1:34-1:35) + point_1 + num + '0'@(1:36-1:37) + '@'@(1:37-1:38) + num + '0'@(1:38-1:39) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/lg.input.res b/contrib/nitcc/tests/sav/lg.input.res new file mode 100644 index 0000000000..36b1985027 --- /dev/null +++ b/contrib/nitcc/tests/sav/lg.input.res @@ -0,0 +1,19 @@ +Start + e_2 + a_1 + '<'@(1:1-1:2) + e_1 + e_2 + a_0 + n + '0'@(1:2-1:3) + '>'@(1:3-1:4) + a_1 + '<'@(1:4-1:5) + e_2 + a_0 + n + '0'@(1:5-1:6) + '>'@(1:6-1:7) + '>'@(1:7-1:8) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/lg.input2.res b/contrib/nitcc/tests/sav/lg.input2.res new file mode 100644 index 0000000000..f825a5aa70 --- /dev/null +++ b/contrib/nitcc/tests/sav/lg.input2.res @@ -0,0 +1,19 @@ +NParserError@(2:1-2:1)='' +Nodes[Node] + '<'@(1:1-1:2) + e_2 + a_0 + n + '0'@(1:2-1:3) + '>'@(1:3-1:4) + '<'@(1:4-1:5) + e_1 + e_2 + a_0 + n + '0'@(1:5-1:6) + '>'@(1:6-1:7) + a_0 + n + '0'@(1:7-1:8) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/lg.res b/contrib/nitcc/tests/sav/lg.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/lg.res @@ -0,0 +1 @@ +Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/lg2.input.res b/contrib/nitcc/tests/sav/lg2.input.res new file mode 100644 index 0000000000..30257925c5 --- /dev/null +++ b/contrib/nitcc/tests/sav/lg2.input.res @@ -0,0 +1,15 @@ +NParserError@(2:1-2:1)='' +Nodes[Node] + '<'@(1:1-1:2) + e_2 + n + '0'@(1:2-1:3) + '>'@(1:3-1:4) + e_3 + '<'@(1:4-1:5) + e_2 + n + '0'@(1:5-1:6) + '>'@(1:6-1:7) + '>'@(1:7-1:8) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/lg2.input2.res b/contrib/nitcc/tests/sav/lg2.input2.res new file mode 100644 index 0000000000..f6b978e66b --- /dev/null +++ b/contrib/nitcc/tests/sav/lg2.input2.res @@ -0,0 +1,17 @@ +NParserError@(2:1-2:1)='' +Nodes[Node] + '<'@(1:1-1:2) + e_2 + n + '0'@(1:2-1:3) + '>'@(1:3-1:4) + '<'@(1:4-1:5) + e_1 + e_2 + n + '0'@(1:5-1:6) + '>'@(1:6-1:7) + e_2 + n + '0'@(1:7-1:8) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/lg2.res b/contrib/nitcc/tests/sav/lg2.res new file mode 100644 index 0000000000..05b05f7966 --- /dev/null +++ b/contrib/nitcc/tests/sav/lg2.res @@ -0,0 +1 @@ +Error: there is conflicts