From c4c208da60f94b4a17af3a9852602251e3811455 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Sun, 21 Jul 2024 13:42:32 -0400 Subject: [PATCH] nitcc: results store shift and reduce conflicts Signed-off-by: Jean Privat --- contrib/nitcc/src/lrautomaton.nit | 2 +- contrib/nitcc/tests/sav/amb.res | 6 + contrib/nitcc/tests/sav/amb2.res | 3 + contrib/nitcc/tests/sav/amb3.res | 3 + contrib/nitcc/tests/sav/conflict-bracket.res | 3 + .../sav/conflict-dangling.1alt1.alt1.res | 3 + .../sav/conflict-dangling.1alt1.alt2.res | 3 + .../tests/sav/conflict-dangling.1alt1.res | 3 + .../tests/sav/conflict-dangling.alt1.res | 4 + .../tests/sav/conflict-dangling.alt2.res | 4 + contrib/nitcc/tests/sav/conflict-dangling.res | 3 + contrib/nitcc/tests/sav/eq2.res | 3 + contrib/nitcc/tests/sav/eq3.res | 9 ++ contrib/nitcc/tests/sav/if.res | 7 + .../sav/inf5000-05-grammaire-arithmetique.res | 27 ++++ ...inf5000-06-grammaire2-grammaire2.input.res | 136 ++++++++++++------ ...-06-grammaire2-instructions.alt3.input.res | 50 ++++--- .../inf5000-06-grammaire2-polygone.input.res | 44 ++++-- contrib/nitcc/tests/sav/lg.res | 3 + contrib/nitcc/tests/sav/lg2.res | 15 ++ contrib/nitcc/tests/sav/lr1.res | 3 + contrib/nitcc/tests/sav/nit_expr.res | 13 ++ contrib/nitcc/tests/sav/not_lalr.res | 6 + contrib/nitcc/tests/sav/pri.res | 9 ++ contrib/nitcc/tests/sav/priority.res | 27 ++++ contrib/nitcc/tests/sav/qualified.res | 7 + contrib/nitcc/tests/t | 2 +- 27 files changed, 327 insertions(+), 71 deletions(-) diff --git a/contrib/nitcc/src/lrautomaton.nit b/contrib/nitcc/src/lrautomaton.nit index 0cc2ef1980..60c6a7d1fe 100644 --- a/contrib/nitcc/src/lrautomaton.nit +++ b/contrib/nitcc/src/lrautomaton.nit @@ -774,7 +774,7 @@ class LRState end if confs.is_empty then print "---" - print "Automatic Dangling on state {self} for token {t}:" + print "Automatic Dangling SHIFT/REDUCE on state {self} for token {t}:" print "\treduce: {ri}" for r in ress do print r removed_reduces.add t diff --git a/contrib/nitcc/tests/sav/amb.res b/contrib/nitcc/tests/sav/amb.res index 05b05f7966..56ca3ec16e 100644 --- a/contrib/nitcc/tests/sav/amb.res +++ b/contrib/nitcc/tests/sav/amb.res @@ -1 +1,7 @@ +REDUCE/REDUCE Conflict on state 1 e for token Eof: +REDUCE on item: e→ e·, Eof +REDUCE on item: e→ e·, Eof +SHIFT/REDUCE Conflict on state 1 e for token Eof: +SHIFT on item: _start→ e·Eof +REDUCE on item: e→ e·, Eof Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/amb2.res b/contrib/nitcc/tests/sav/amb2.res index 05b05f7966..1dbd4df199 100644 --- a/contrib/nitcc/tests/sav/amb2.res +++ b/contrib/nitcc/tests/sav/amb2.res @@ -1 +1,4 @@ +REDUCE/REDUCE Conflict on state 7 '-' e for token '+': +REDUCE on item: a→ e·, Eof/'+' +REDUCE on item: b→ e·, '+' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/amb3.res b/contrib/nitcc/tests/sav/amb3.res index 05b05f7966..42bc0041fe 100644 --- a/contrib/nitcc/tests/sav/amb3.res +++ b/contrib/nitcc/tests/sav/amb3.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 3 'a' for token 'b': +SHIFT on item: x→·'b', Eof +REDUCE on item: x→ 'a'·, 'b' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/conflict-bracket.res b/contrib/nitcc/tests/sav/conflict-bracket.res index 05b05f7966..b064ad5df8 100644 --- a/contrib/nitcc/tests/sav/conflict-bracket.res +++ b/contrib/nitcc/tests/sav/conflict-bracket.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 8 '[' e '[' for token '[': +SHIFT on item: e→·'[' e '[', ']'/'[' +REDUCE on item: e→ '[' e '['·, Eof/'['/']' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt1.res b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt1.res index 05b05f7966..539f6109aa 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt1.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt1.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 7 '1' e for token '2': +SHIFT on item: x→·'2', Eof/'2' +REDUCE on item: e→ '1' e·, Eof/'2' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt2.res b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt2.res index 05b05f7966..471906d1e5 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt2.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.alt2.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 7 '1' e for token '2': +SHIFT on item: x→·'2', Eof/'2' +REDUCE on item: y→·, Eof/'2' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.res b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.res index 05b05f7966..a9dbe42c29 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.1alt1.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.1alt1.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 7 '1' e for token '2': +SHIFT on item: e→ '1' e·'2', Eof/'2' +REDUCE on item: e→ '1' e·, Eof/'2' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/conflict-dangling.alt1.res b/contrib/nitcc/tests/sav/conflict-dangling.alt1.res index e69de29bb2..2e6551aecc 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.alt1.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.alt1.res @@ -0,0 +1,4 @@ +Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': + reduce: e→ '1' e·, Eof/'2' + shift: x→·'2' + core shift: e→ '1' e·x, Eof/'2' diff --git a/contrib/nitcc/tests/sav/conflict-dangling.alt2.res b/contrib/nitcc/tests/sav/conflict-dangling.alt2.res index e69de29bb2..00ab6fed31 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.alt2.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.alt2.res @@ -0,0 +1,4 @@ +Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': + reduce: y→·, Eof/'2' + shift: x→·'2' + core shift: y→·x, Eof/'2' diff --git a/contrib/nitcc/tests/sav/conflict-dangling.res b/contrib/nitcc/tests/sav/conflict-dangling.res index e69de29bb2..9628b0248b 100644 --- a/contrib/nitcc/tests/sav/conflict-dangling.res +++ b/contrib/nitcc/tests/sav/conflict-dangling.res @@ -0,0 +1,3 @@ +Automatic Dangling SHIFT/REDUCE on state 6 '1' e for token '2': + reduce: e→ '1' e·, Eof/'2' + shift: e→ '1' e·'2' diff --git a/contrib/nitcc/tests/sav/eq2.res b/contrib/nitcc/tests/sav/eq2.res index 05b05f7966..0a848c9ced 100644 --- a/contrib/nitcc/tests/sav/eq2.res +++ b/contrib/nitcc/tests/sav/eq2.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 2 var for token '=': +SHIFT on item: e→ var·'=' e, Eof/'=' +REDUCE on item: e→ var·, Eof/'=' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/eq3.res b/contrib/nitcc/tests/sav/eq3.res index 05b05f7966..fb928143b3 100644 --- a/contrib/nitcc/tests/sav/eq3.res +++ b/contrib/nitcc/tests/sav/eq3.res @@ -1 +1,10 @@ +SHIFT/REDUCE Conflict on state 2 var for token '=': +SHIFT on item: e→ var·'=' e, Eof/'=' +REDUCE on item: e→ var·, '='/Eof +Automatic Dangling SHIFT/REDUCE on state 8 e '=' e for token '=': + reduce: c→ e '=' e·, Eof/'=' + shift: c→ e·'=' e +SHIFT/REDUCE Conflict on state 9 var '=' e for token '=': +SHIFT on item: c→ e·'=' e, Eof/'=' +REDUCE on item: e→ var '=' e·, Eof/'=' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/if.res b/contrib/nitcc/tests/sav/if.res index e69de29bb2..410744a738 100644 --- a/contrib/nitcc/tests/sav/if.res +++ b/contrib/nitcc/tests/sav/if.res @@ -0,0 +1,7 @@ +Automatic Dangling SHIFT/REDUCE on state 15 'e' 'if' e 'then' e for token 'else': + reduce: e→ 'if' e 'then' e·, Eof/'then'/'else' + shift: else→·'else' e + core shift: e→ 'if' e 'then' e·else, Eof/'then'/'else' +Automatic Dangling SHIFT/REDUCE on state 16 'f' 'if' f 'then' f for token 'else': + reduce: f→ 'if' f 'then' f·, Eof/'then'/'else' + shift: f→ 'if' f 'then' f·'else' f diff --git a/contrib/nitcc/tests/sav/inf5000-05-grammaire-arithmetique.res b/contrib/nitcc/tests/sav/inf5000-05-grammaire-arithmetique.res index e69de29bb2..ab6ab10894 100644 --- a/contrib/nitcc/tests/sav/inf5000-05-grammaire-arithmetique.res +++ b/contrib/nitcc/tests/sav/inf5000-05-grammaire-arithmetique.res @@ -0,0 +1,27 @@ +Automatic Dangling SHIFT/REDUCE on state 12 exp '+' exp for token '+': + reduce: exp→ exp '+' exp·, Eof/'+'/'-'/'*'/int/'('/')' + shift: exp→ exp·'+' exp +Automatic Dangling SHIFT/REDUCE on state 12 exp '+' exp for token '-': + reduce: exp→ exp '+' exp·, Eof/'+'/'-'/'*'/int/'('/')' + shift: exp→ exp·'-' exp +Automatic Dangling SHIFT/REDUCE on state 12 exp '+' exp for token '*': + reduce: exp→ exp '+' exp·, Eof/'+'/'-'/'*'/int/'('/')' + shift: exp→ exp·'*' exp +Automatic Dangling SHIFT/REDUCE on state 13 exp '-' exp for token '+': + reduce: exp→ exp '-' exp·, '+'/'*'/'-'/Eof/int/'('/')' + shift: exp→ exp·'+' exp +Automatic Dangling SHIFT/REDUCE on state 13 exp '-' exp for token '*': + reduce: exp→ exp '-' exp·, '+'/'*'/'-'/Eof/int/'('/')' + shift: exp→ exp·'*' exp +Automatic Dangling SHIFT/REDUCE on state 13 exp '-' exp for token '-': + reduce: exp→ exp '-' exp·, '+'/'*'/'-'/Eof/int/'('/')' + shift: exp→ exp·'-' exp +Automatic Dangling SHIFT/REDUCE on state 14 exp '*' exp for token '+': + reduce: exp→ exp '*' exp·, '+'/'-'/'*'/Eof/int/'('/')' + shift: exp→ exp·'+' exp +Automatic Dangling SHIFT/REDUCE on state 14 exp '*' exp for token '-': + reduce: exp→ exp '*' exp·, '+'/'-'/'*'/Eof/int/'('/')' + shift: exp→ exp·'-' exp +Automatic Dangling SHIFT/REDUCE on state 14 exp '*' exp for token '*': + reduce: exp→ exp '*' exp·, '+'/'-'/'*'/Eof/int/'('/')' + shift: exp→ exp·'*' exp 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-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-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/lg.res b/contrib/nitcc/tests/sav/lg.res index 05b05f7966..6515a9f189 100644 --- a/contrib/nitcc/tests/sav/lg.res +++ b/contrib/nitcc/tests/sav/lg.res @@ -1 +1,4 @@ +SHIFT/REDUCE Conflict on state 12 '<' e '>' for token '<': +SHIFT on item: a→·'<' e '>', '<'/'>' +REDUCE on item: a→ '<' e '>'·, '<'/'>'/Eof Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/lg2.res b/contrib/nitcc/tests/sav/lg2.res index 05b05f7966..43905114f4 100644 --- a/contrib/nitcc/tests/sav/lg2.res +++ b/contrib/nitcc/tests/sav/lg2.res @@ -1 +1,16 @@ +Automatic Dangling SHIFT/REDUCE on state 9 e '<' e for token '<': + reduce: e→ e '<' e·, Eof/'<'/'>' + shift: e→ e·'<' e +SHIFT/REDUCE Conflict on state 9 e '<' e for token '>': +SHIFT on item: e→ e·'>' e, '<'/'>'/Eof +REDUCE on item: e→ e '<' e·, Eof/'<'/'>' +Automatic Dangling SHIFT/REDUCE on state 10 e '>' e for token '<': + reduce: e→ e '>' e·, '<'/'>'/Eof + shift: e→ e·'<' e +SHIFT/REDUCE Conflict on state 10 e '>' e for token '>': +SHIFT on item: e→ e·'>' e, '<'/'>'/Eof +REDUCE on item: e→ e '>' e·, '<'/'>'/Eof +SHIFT/REDUCE Conflict on state 11 '<' e '>' for token '<': +SHIFT on item: e→·'<' e '>', '>'/'<' +REDUCE on item: e→ '<' e '>'·, '<'/'>'/Eof Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/lr1.res b/contrib/nitcc/tests/sav/lr1.res index 05b05f7966..37519c4791 100644 --- a/contrib/nitcc/tests/sav/lr1.res +++ b/contrib/nitcc/tests/sav/lr1.res @@ -1 +1,4 @@ +REDUCE/REDUCE Conflict on state 3 'x' for token 'a': +REDUCE on item: q→ 'x'·, 'a' +REDUCE on item: r→ 'x'·, 'a' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/nit_expr.res b/contrib/nitcc/tests/sav/nit_expr.res index 05b05f7966..d062a19988 100644 --- a/contrib/nitcc/tests/sav/nit_expr.res +++ b/contrib/nitcc/tests/sav/nit_expr.res @@ -1 +1,14 @@ +SHIFT/REDUCE Conflict on state 3 'id' for token '[': +SHIFT on item: e→·'[' e ']', '['/Eof/']'/'..' +SHIFT on item: e→·'[' e '..' e '[', '['/Eof/']'/'..' +SHIFT on item: e→·'[' e '..' e ']', '['/Eof/']'/'..' +REDUCE on item: e→ 'id'·, '['/Eof/']'/'..' +SHIFT/REDUCE Conflict on state 7 'id' e for token '[': +SHIFT on item: e→ e·'[' e ']', '['/Eof/']'/'..' +REDUCE on item: e→ 'id' e·, '['/Eof/']'/'..' +SHIFT/REDUCE Conflict on state 13 '[' e '..' e '[' for token '[': +SHIFT on item: e→·'[' e ']', '['/']' +SHIFT on item: e→·'[' e '..' e '[', '['/']' +SHIFT on item: e→·'[' e '..' e ']', '['/']' +REDUCE on item: e→ '[' e '..' e '['·, '['/Eof/']'/'..' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/not_lalr.res b/contrib/nitcc/tests/sav/not_lalr.res index 05b05f7966..57fe0eab52 100644 --- a/contrib/nitcc/tests/sav/not_lalr.res +++ b/contrib/nitcc/tests/sav/not_lalr.res @@ -1 +1,7 @@ +REDUCE/REDUCE Conflict on state 7 'a' 'a' for token 'a': +REDUCE on item: x→ 'a'·, 'a'/'b' +REDUCE on item: y→ 'a'·, 'b'/'a' +REDUCE/REDUCE Conflict on state 7 'a' 'a' for token 'b': +REDUCE on item: x→ 'a'·, 'a'/'b' +REDUCE on item: y→ 'a'·, 'b'/'a' Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/pri.res b/contrib/nitcc/tests/sav/pri.res index 05b05f7966..fa1c36cc90 100644 --- a/contrib/nitcc/tests/sav/pri.res +++ b/contrib/nitcc/tests/sav/pri.res @@ -1 +1,10 @@ +REDUCE/REDUCE Conflict on state 4 'r' for token Eof: +REDUCE on item: a→ 'r'·, Eof +REDUCE on item: r→·, Eof +Automatic Dangling SHIFT/REDUCE on state 14 'q' q q for token 'q': + reduce: q→ q q·, Eof/'q' + shift: q→·'q' +Automatic Dangling SHIFT/REDUCE on state 15 'p' p '+' p for token '+': + reduce: p→ p '+' p·, Eof/'+' + shift: p→ p·'+' p Error: there is conflicts diff --git a/contrib/nitcc/tests/sav/priority.res b/contrib/nitcc/tests/sav/priority.res index e69de29bb2..ec23ed9aba 100644 --- a/contrib/nitcc/tests/sav/priority.res +++ b/contrib/nitcc/tests/sav/priority.res @@ -0,0 +1,27 @@ +Automatic Dangling SHIFT/REDUCE on state 7 e '+' e for token '+': + reduce: e→ e '+' e·, Eof/'+'/'-'/'*' + shift: e→ e·'+' e +Automatic Dangling SHIFT/REDUCE on state 7 e '+' e for token '-': + reduce: e→ e '+' e·, Eof/'+'/'-'/'*' + shift: e→ e·'-' e +Automatic Dangling SHIFT/REDUCE on state 7 e '+' e for token '*': + reduce: e→ e '+' e·, Eof/'+'/'-'/'*' + shift: e→ e·'*' e +Automatic Dangling SHIFT/REDUCE on state 8 e '-' e for token '+': + reduce: e→ e '-' e·, '+'/'*'/'-'/Eof + shift: e→ e·'+' e +Automatic Dangling SHIFT/REDUCE on state 8 e '-' e for token '*': + reduce: e→ e '-' e·, '+'/'*'/'-'/Eof + shift: e→ e·'*' e +Automatic Dangling SHIFT/REDUCE on state 8 e '-' e for token '-': + reduce: e→ e '-' e·, '+'/'*'/'-'/Eof + shift: e→ e·'-' e +Automatic Dangling SHIFT/REDUCE on state 9 e '*' e for token '+': + reduce: e→ e '*' e·, '+'/'-'/'*'/Eof + shift: e→ e·'+' e +Automatic Dangling SHIFT/REDUCE on state 9 e '*' e for token '-': + reduce: e→ e '*' e·, '+'/'-'/'*'/Eof + shift: e→ e·'-' e +Automatic Dangling SHIFT/REDUCE on state 9 e '*' e for token '*': + reduce: e→ e '*' e·, '+'/'-'/'*'/Eof + shift: e→ e·'*' e diff --git a/contrib/nitcc/tests/sav/qualified.res b/contrib/nitcc/tests/sav/qualified.res index 05b05f7966..b8392dd664 100644 --- a/contrib/nitcc/tests/sav/qualified.res +++ b/contrib/nitcc/tests/sav/qualified.res @@ -1 +1,8 @@ +Automatic Dangling SHIFT/REDUCE on state 2 r for token 'id': + reduce: q→·, 'id' + shift: id→·'id' + core shift: q→·qe+, 'id' +SHIFT/REDUCE Conflict on state 6 r qe+ for token 'id': +SHIFT on item: id→·'id', '::' +REDUCE on item: q→ qe+·, 'id' Error: there is conflicts diff --git a/contrib/nitcc/tests/t b/contrib/nitcc/tests/t index 37922f6a32..e019cca51f 100755 --- a/contrib/nitcc/tests/t +++ b/contrib/nitcc/tests/t @@ -110,7 +110,7 @@ do fi fi - grep -i "error" "out/$bn.nitcc.log" > "out/$res" + grep -i 'error\|shift\|reduce' "out/$bn.nitcc.log" > "out/$res" name="$a" differ $res || err=1