Skip to content

Commit

Permalink
nitcc: add new tests of grammars (some with conflicts)
Browse files Browse the repository at this point in the history
Signed-off-by: Jean Privat <[email protected]>
  • Loading branch information
privat committed Jul 18, 2024
1 parent b0243a0 commit 9f13bfd
Show file tree
Hide file tree
Showing 38 changed files with 237 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/nitcc/tests/amb.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id
4 changes: 4 additions & 0 deletions contrib/nitcc/tests/amb.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Grammar amb;
Parser
Ignored #10, #32;
e = 'id' | e | e;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/amb2.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-0+
6 changes: 6 additions & 0 deletions contrib/nitcc/tests/amb2.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Grammar amb;
Parser
Ignored #10, #32;
e = '-' a | b '+' | '0';
a = e ;
b = e ;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/amb3.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a b
5 changes: 5 additions & 0 deletions contrib/nitcc/tests/amb3.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Grammar amb;
Parser
Ignored #10, #32;
e = x 'b' | 'a' x ;
x = 'a' | 'b';
1 change: 1 addition & 0 deletions contrib/nitcc/tests/eq.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id=id=id
9 changes: 9 additions & 0 deletions contrib/nitcc/tests/eq.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Grammar eq;
Parser
Ignored #10, #32;
e =
var '=' e |
var ;
c =
e '=' e ;
var = 'id' ;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/eq2.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id=id=id
10 changes: 10 additions & 0 deletions contrib/nitcc/tests/eq2.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Grammar eq;
Parser
Ignored #10, #32;
e =
var '=' e |
'assert' c |
var ;
c =
e '=' e ;
var = 'id' ;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/eq3.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id=id=id
10 changes: 10 additions & 0 deletions contrib/nitcc/tests/eq3.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Grammar eq;
Parser
Ignored #10, #32;
e =
var '=' e |
c |
var ;
c =
e '=' e ;
var = 'id' ;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/geom.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
triangle 0x0 0@0 centre circle 0x0 0@0
8 changes: 8 additions & 0 deletions contrib/nitcc/tests/geom.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Grammar geom;
Parser
Ignored #10, #32;
forme =
'triangle' point point point |
'circle' point point ;
point = num 'x' num | num '@' num | 'centre' forme;
num = '0';
1 change: 1 addition & 0 deletions contrib/nitcc/tests/lg.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<0><0>>
1 change: 1 addition & 0 deletions contrib/nitcc/tests/lg.input2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<0><0>0
6 changes: 6 additions & 0 deletions contrib/nitcc/tests/lg.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Grammar lg;
Parser
Ignored #10, #32;
e = e '<' a | e '>' a | a ;
a = n | '<' e '>' ;
n = '0' ;
1 change: 1 addition & 0 deletions contrib/nitcc/tests/lg2.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<0><0>>
1 change: 1 addition & 0 deletions contrib/nitcc/tests/lg2.input2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<0><0>0
5 changes: 5 additions & 0 deletions contrib/nitcc/tests/lg2.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Grammar lg;
Parser
Ignored #10, #32;
e = e '<' e | e '>' e | n | '<' e '>' ;
n = '0' ;
4 changes: 4 additions & 0 deletions contrib/nitcc/tests/sav/amb.input.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Start
e_0
'id'@(1:1-1:3)
Eof@(2:1-2:1)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/amb.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
10 changes: 10 additions & 0 deletions contrib/nitcc/tests/sav/amb2.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/amb2.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/amb3.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
13 changes: 13 additions & 0 deletions contrib/nitcc/tests/sav/eq.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/eq.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
13 changes: 13 additions & 0 deletions contrib/nitcc/tests/sav/eq2.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/eq2.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
13 changes: 13 additions & 0 deletions contrib/nitcc/tests/sav/eq3.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/eq3.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
32 changes: 32 additions & 0 deletions contrib/nitcc/tests/sav/geom.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
19 changes: 19 additions & 0 deletions contrib/nitcc/tests/sav/lg.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
19 changes: 19 additions & 0 deletions contrib/nitcc/tests/sav/lg.input2.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/lg.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts
15 changes: 15 additions & 0 deletions contrib/nitcc/tests/sav/lg2.input.res
Original file line number Diff line number Diff line change
@@ -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)=''
17 changes: 17 additions & 0 deletions contrib/nitcc/tests/sav/lg2.input2.res
Original file line number Diff line number Diff line change
@@ -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)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/sav/lg2.res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: there is conflicts

0 comments on commit 9f13bfd

Please sign in to comment.