diff --git a/contrib/nitcc/tests/parser-separator.input b/contrib/nitcc/tests/parser-separator.input new file mode 100644 index 0000000000..717e6bed4a --- /dev/null +++ b/contrib/nitcc/tests/parser-separator.input @@ -0,0 +1,7 @@ +s a b a +s a b a b a +s a +s a c d e a c +s a c d e a c d e a c +s a c +s a c d e diff --git a/contrib/nitcc/tests/parser-separator.sablecc b/contrib/nitcc/tests/parser-separator.sablecc new file mode 100644 index 0000000000..d9529eac2f --- /dev/null +++ b/contrib/nitcc/tests/parser-separator.sablecc @@ -0,0 +1,10 @@ +Grammar gram; +Lexer +blank = #10 | #13 | #32; +Parser +Ignored blank; +s = + s 's' ('a' Separator 'b')+ | + s 's' ('a' 'c' Separator 'd' 'e')+ | + s 's' ('b' Separator 'c')* | + Empty; diff --git a/contrib/nitcc/tests/parser-tail.input b/contrib/nitcc/tests/parser-tail.input new file mode 100644 index 0000000000..ba0479d852 --- /dev/null +++ b/contrib/nitcc/tests/parser-tail.input @@ -0,0 +1,10 @@ +s a b a +s a b +s a b a b a +s a b a b +s a +s a c d e a c +s a c d e a c d e a c +s a c +s a c d e +s a c d e a c d e diff --git a/contrib/nitcc/tests/parser-tail.sablecc b/contrib/nitcc/tests/parser-tail.sablecc new file mode 100644 index 0000000000..72e73c469f --- /dev/null +++ b/contrib/nitcc/tests/parser-tail.sablecc @@ -0,0 +1,10 @@ +Grammar gram; +Lexer +blank = #10 | #13 | #32; +Parser +Ignored blank; +s = + s 's' ('a' Tail 'b')+ | + s 's' ('a' 'c' Tail 'd' 'e')+ | + s 's' ('b' Tail 'c')* | + Empty; diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.input.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.input.res index 78e60f926f..f9dc48e425 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.input.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.input.res @@ -1,41 +1,95 @@ -T_Id@1,1:prods -TAnonymous@1,7:= -T_Altid@1,9:{many:} -T_Id@1,17:prods -T_Id@1,23:prod -TAnonymous@1,29:| -T_Altid@1,31:{one:} -T_Id@1,38:prod -TAnonymous@1,43:; -T_Id@2,1:prod -TAnonymous@2,6:= -T_Id@2,8:id -T_Str@2,11:'=' -T_Id@2,15:alts -T_Str@2,20:';' -TAnonymous@2,24:; -T_Id@3,1:alts -TAnonymous@3,6:= -T_Altid@3,8:{many:} -T_Id@3,16:alts -T_Str@3,21:'|' -T_Id@3,25:alt -TAnonymous@3,29:| -T_Altid@3,31:{one:} -T_Id@3,38:alt -TAnonymous@3,42:; -T_Id@4,1:alt -TAnonymous@4,5:= -T_Id@4,7:altid -T_Id@4,13:atoms -TAnonymous@4,19:| -T_Id@4,21:atoms -TAnonymous@4,27:; -T_Id@5,1:atoms -TAnonymous@5,7:= -T_Altid@5,9:{many:} -T_Id@5,17:atoms -T_Id@5,23:atom -TAnonymous@5,28:| -T_Altid@5,30:{none:} -5,38. Syntax error: Unexpected character 'E'. +NLexerError@(5:38-5:38)='E' +Nodes[Node] + Nodes[Nprod] + prod + id@(1:1-1:6)='prods' + '='@(1:7-1:8) + Nodes[N_group1] + _group1_single + alt + altid@(1:9-1:16)='{many:}' + Nodes[Natom] + atom_id + id@(1:17-1:22)='prods' + atom_id + id@(1:23-1:27)='prod' + '|'@(1:29-1:30) + _group0_single + alt + altid@(1:31-1:37)='{one:}' + Nodes[Natom] + atom_id + id@(1:38-1:42)='prod' + ';'@(1:43-1:44) + prod + id@(2:1-2:5)='prod' + '='@(2:6-2:7) + Nodes[N_group1] + _group0_single + alt + Nodes[Natom] + atom_id + id@(2:8-2:10)='id' + atom_str + str@(2:11-2:14)='\'=\'' + atom_id + id@(2:15-2:19)='alts' + atom_str + str@(2:20-2:23)='\';\'' + ';'@(2:24-2:25) + prod + id@(3:1-3:5)='alts' + '='@(3:6-3:7) + Nodes[N_group1] + _group1_single + alt + altid@(3:8-3:15)='{many:}' + Nodes[Natom] + atom_id + id@(3:16-3:20)='alts' + atom_str + str@(3:21-3:24)='\'|\'' + atom_id + id@(3:25-3:28)='alt' + '|'@(3:29-3:30) + _group0_single + alt + altid@(3:31-3:37)='{one:}' + Nodes[Natom] + atom_id + id@(3:38-3:41)='alt' + ';'@(3:42-3:43) + prod + id@(4:1-4:4)='alt' + '='@(4:5-4:6) + Nodes[N_group1] + _group1_single + alt + Nodes[Natom] + atom_id + id@(4:7-4:12)='altid' + atom_id + id@(4:13-4:18)='atoms' + '|'@(4:19-4:20) + _group0_single + alt + Nodes[Natom] + atom_id + id@(4:21-4:26)='atoms' + ';'@(4:27-4:28) + id@(5:1-5:6)='atoms' + '='@(5:7-5:8) + Nodes[N_group1] + _group1_single + alt + altid@(5:9-5:16)='{many:}' + Nodes[Natom] + atom_id + id@(5:17-5:22)='atoms' + atom_id + id@(5:23-5:27)='atom' + '|'@(5:28-5:29) + _group0_single + alt + altid@(5:30-5:37)='{none:}' + NLexerError@(5:38-5:38)='E' diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.res index 8b96f3e259..e69de29bb2 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-grammaire2.res @@ -1 +0,0 @@ -11:15-11:16 Syntax Error: Unexpected '('; is acceptable instead: priority+, priority diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.input.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.input.res index 664d77291c..8c1b7d4d0d 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.input.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.input.res @@ -1,18 +1,32 @@ -T_Id@1,1:x -TAnonymous@1,3:= -T_Id@1,5:y -TAnonymous@1,6:; -TAnonymous@2,1:while -TAnonymous@2,7:( -T_Id@2,8:z -TAnonymous@2,9:) -TAnonymous@2,11:{ -TAnonymous@2,13:print -T_Id@2,19:t -TAnonymous@2,20:; -T_Id@2,22:k -TAnonymous@2,23:= -T_Id@2,24:u -TAnonymous@2,25:; -TAnonymous@2,27:} -TEnd@3,1: +Start + prog + Nodes[Nstmt] + stmt_assign + id@(1:1-1:2)='x' + '='@(1:3-1:4) + expr + id@(1:5-1:6)='y' + ';'@(1:6-1:7) + stmt_while + 'while'@(2:1-2:6) + '('@(2:7-2:8) + expr + id@(2:8-2:9)='z' + ')'@(2:9-2:10) + '{'@(2:11-2:12) + Nodes[Nstmt] + stmt_print + 'print'@(2:13-2:18) + '('@(2:18-2:19) + expr + id@(2:19-2:20)='t' + ')'@(2:20-2:21) + ';'@(2:21-2:22) + stmt_assign + id@(2:23-2:24)='k' + '='@(2:24-2:25) + expr + id@(2:25-2:26)='u' + ';'@(2:26-2:27) + '}'@(2:28-2:29) + Eof@(3:1-3:1)='' diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.res index db1e0bb76d..e69de29bb2 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-instructions.alt3.res @@ -1 +0,0 @@ -20:8-20:9 Syntax Error: Unexpected '('; is acceptable instead: priority+, priority diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.input.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.input.res index 4beb812048..e7b2771fc9 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.input.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.input.res @@ -1,10 +1,34 @@ -TAnonymous@1,1:( -TAnonymous@1,2:( -T_Num@1,3:0 -TAnonymous@1,4:x -TAnonymous@1,5:, -T_Num@1,6:0 -TAnonymous@1,7:y -TAnonymous@1,8:) -TAnonymous@1,9:, -1,10. Syntax error: Unexpected character ' '. +Start + polygone + '('@(1:1-1:2) + Nodes[N_group1] + _group1_single + point_cart + '('@(1:2-1:3) + num@(1:3-1:4)='0' + 'x'@(1:4-1:5) + ','@(1:5-1:6) + num@(1:6-1:7)='0' + 'y'@(1:7-1:8) + ')'@(1:8-1:9) + ','@(1:9-1:10) + _group1_single + point_pol + '('@(1:11-1:12) + num@(1:12-1:14)='10' + ','@(1:14-1:15) + num@(1:16-1:17)='0' + 'deg'@(1:17-1:20) + ')'@(1:20-1:21) + ','@(1:21-1:22) + _group0_single + point_cart + '('@(1:23-1:24) + num@(1:24-1:25)='0' + 'x'@(1:25-1:26) + ','@(1:26-1:27) + num@(1:28-1:30)='10' + 'y'@(1:30-1:31) + ')'@(1:31-1:32) + ')'@(1:32-1:33) + Eof@(2:1-2:1)='' diff --git a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.res b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.res index 69ed902340..e69de29bb2 100644 --- a/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.res +++ b/contrib/nitcc/tests/sav/inf5000-06-grammaire2-polygone.res @@ -1 +0,0 @@ -8:18-8:19 Syntax Error: Unexpected '('; is acceptable instead: priority+, priority diff --git a/contrib/nitcc/tests/sav/parser-separator.input.res b/contrib/nitcc/tests/sav/parser-separator.input.res new file mode 100644 index 0000000000..5fece2935a --- /dev/null +++ b/contrib/nitcc/tests/sav/parser-separator.input.res @@ -0,0 +1,68 @@ +NParserError@(8:1-8:1)='' +Nodes[Node] + s_1 + s_1 + s_1 + s_0 + s_0 + s_0 + s_3 + 's'@(1:1-1:2) + Nodes[N_group1] + _group1_single + 'a'@(1:3-1:4) + 'b'@(1:5-1:6) + _group0_single + 'a'@(1:7-1:8) + 's'@(2:1-2:2) + Nodes[N_group1] + _group1_single + 'a'@(2:3-2:4) + 'b'@(2:5-2:6) + _group1_single + 'a'@(2:7-2:8) + 'b'@(2:9-2:10) + _group0_single + 'a'@(2:11-2:12) + 's'@(3:1-3:2) + Nodes[N_group1] + _group0_single + 'a'@(3:3-3:4) + 's'@(4:1-4:2) + Nodes[N_group3] + _group3_single + 'a'@(4:3-4:4) + 'c'@(4:5-4:6) + 'd'@(4:7-4:8) + 'e'@(4:9-4:10) + _group2_single + 'a'@(4:11-4:12) + 'c'@(4:13-4:14) + 's'@(5:1-5:2) + Nodes[N_group3] + _group3_single + 'a'@(5:3-5:4) + 'c'@(5:5-5:6) + 'd'@(5:7-5:8) + 'e'@(5:9-5:10) + _group3_single + 'a'@(5:11-5:12) + 'c'@(5:13-5:14) + 'd'@(5:15-5:16) + 'e'@(5:17-5:18) + _group2_single + 'a'@(5:19-5:20) + 'c'@(5:21-5:22) + 's'@(6:1-6:2) + Nodes[N_group3] + _group2_single + 'a'@(6:3-6:4) + 'c'@(6:5-6:6) + 's'@(7:1-7:2) + Nodes[N_group3] + _group3_single + 'a'@(7:3-7:4) + 'c'@(7:5-7:6) + 'd'@(7:7-7:8) + 'e'@(7:9-7:10) + Eof@(8:1-8:1)='' diff --git a/contrib/nitcc/tests/sav/parser-tail.input.res b/contrib/nitcc/tests/sav/parser-tail.input.res new file mode 100644 index 0000000000..98bef2d109 --- /dev/null +++ b/contrib/nitcc/tests/sav/parser-tail.input.res @@ -0,0 +1,96 @@ +Start + s_1 + s_1 + s_1 + s_1 + s_1 + s_0 + s_0 + s_0 + s_0 + s_0 + s_3 + 's'@(1:1-1:2) + Nodes[N_group1] + _group1_single + 'a'@(1:3-1:4) + 'b'@(1:5-1:6) + _group0_single + 'a'@(1:7-1:8) + 's'@(2:1-2:2) + Nodes[N_group1] + _group1_single + 'a'@(2:3-2:4) + 'b'@(2:5-2:6) + 's'@(3:1-3:2) + Nodes[N_group1] + _group1_single + 'a'@(3:3-3:4) + 'b'@(3:5-3:6) + _group1_single + 'a'@(3:7-3:8) + 'b'@(3:9-3:10) + _group0_single + 'a'@(3:11-3:12) + 's'@(4:1-4:2) + Nodes[N_group1] + _group1_single + 'a'@(4:3-4:4) + 'b'@(4:5-4:6) + _group1_single + 'a'@(4:7-4:8) + 'b'@(4:9-4:10) + 's'@(5:1-5:2) + Nodes[N_group1] + _group0_single + 'a'@(5:3-5:4) + 's'@(6:1-6:2) + Nodes[N_group3] + _group3_single + 'a'@(6:3-6:4) + 'c'@(6:5-6:6) + 'd'@(6:7-6:8) + 'e'@(6:9-6:10) + _group2_single + 'a'@(6:11-6:12) + 'c'@(6:13-6:14) + 's'@(7:1-7:2) + Nodes[N_group3] + _group3_single + 'a'@(7:3-7:4) + 'c'@(7:5-7:6) + 'd'@(7:7-7:8) + 'e'@(7:9-7:10) + _group3_single + 'a'@(7:11-7:12) + 'c'@(7:13-7:14) + 'd'@(7:15-7:16) + 'e'@(7:17-7:18) + _group2_single + 'a'@(7:19-7:20) + 'c'@(7:21-7:22) + 's'@(8:1-8:2) + Nodes[N_group3] + _group2_single + 'a'@(8:3-8:4) + 'c'@(8:5-8:6) + 's'@(9:1-9:2) + Nodes[N_group3] + _group3_single + 'a'@(9:3-9:4) + 'c'@(9:5-9:6) + 'd'@(9:7-9:8) + 'e'@(9:9-9:10) + 's'@(10:1-10:2) + Nodes[N_group3] + _group3_single + 'a'@(10:3-10:4) + 'c'@(10:5-10:6) + 'd'@(10:7-10:8) + 'e'@(10:9-10:10) + _group3_single + 'a'@(10:11-10:12) + 'c'@(10:13-10:14) + 'd'@(10:15-10:16) + 'e'@(10:17-10:18) + Eof@(11:1-11:1)=''