From 0242bf04acf60bef5ecde9f8f8babccf2e277c06 Mon Sep 17 00:00:00 2001 From: Theophile Ranquet Date: Fri, 28 Dec 2012 13:33:04 +0100 Subject: [PATCH] carets: show them in more tests * tests/input.at, tests/named-refs.at: Here. --- tests/input.at | 125 ++++++++++++++++++++++++++++++++++++++------ tests/named-refs.at | 24 ++++++++- 2 files changed, 131 insertions(+), 18 deletions(-) diff --git a/tests/input.at b/tests/input.at index f9ed33d2..21179637 100644 --- a/tests/input.at +++ b/tests/input.at @@ -89,9 +89,13 @@ exp: { $$ = $1 ; }; exp: { @$ = @1 ; }; ]]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:2.13-14: error: integer out of range: '$1' + exp: { $$ = $1 ; }; + ^^ input.y:3.13-14: error: integer out of range: '@1' + exp: { @$ = @1 ; }; + ^^ ]]) AT_CLEANUP @@ -114,12 +118,22 @@ exp: foo { $$; } foo { $2; } foo ; ]]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type + exp: foo { $$; } foo { $2; } foo + ^^ input.y:5.24-25: error: $2 of 'exp' has no declared type + exp: foo { $$; } foo { $2; } foo + ^^ input.y:5.6-32: warning: type clash on default action: != <> [-Wother] + exp: foo { $$; } foo { $2; } foo + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ input.y:6.6-8: warning: type clash on default action: != <> [-Wother] + | foo + ^^^ input.y:7.5: warning: empty rule for typed nonterminal, and no action [-Wother] + | /* Empty. */ + ^ ]]) AT_CLEANUP @@ -323,31 +337,79 @@ start: ; %printer { print ($$); } <>; ]]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:1.13-29: error: %destructor redeclaration for <*> + %destructor { destroy ($$); } <*> <*> + ^^^^^^^^^^^^^^^^^ input.y:1.13-29: previous declaration + %destructor { destroy ($$); } <*> <*> + ^^^^^^^^^^^^^^^^^ input.y:2.10-24: error: %printer redeclaration for <*> + %printer { print ($$); } <*> <*> + ^^^^^^^^^^^^^^^ input.y:2.10-24: previous declaration + %printer { print ($$); } <*> <*> + ^^^^^^^^^^^^^^^ input.y:4.13-29: error: %destructor redeclaration for <*> + %destructor { destroy ($$); } <*> + ^^^^^^^^^^^^^^^^^ input.y:1.13-29: previous declaration + %destructor { destroy ($$); } <*> <*> + ^^^^^^^^^^^^^^^^^ input.y:5.10-24: error: %printer redeclaration for <*> + %printer { print ($$); } <*> + ^^^^^^^^^^^^^^^ input.y:2.10-24: previous declaration + %printer { print ($$); } <*> <*> + ^^^^^^^^^^^^^^^ input.y:7.13-29: error: %destructor redeclaration for <> + %destructor { destroy ($$); } <> <> + ^^^^^^^^^^^^^^^^^ input.y:7.13-29: previous declaration + %destructor { destroy ($$); } <> <> + ^^^^^^^^^^^^^^^^^ input.y:8.10-24: error: %printer redeclaration for <> + %printer { print ($$); } <> <> + ^^^^^^^^^^^^^^^ input.y:8.10-24: previous declaration + %printer { print ($$); } <> <> + ^^^^^^^^^^^^^^^ input.y:10.13-29: error: %destructor redeclaration for <> + %destructor { destroy ($$); } <> + ^^^^^^^^^^^^^^^^^ input.y:7.13-29: previous declaration + %destructor { destroy ($$); } <> <> + ^^^^^^^^^^^^^^^^^ input.y:11.10-24: error: %printer redeclaration for <> + %printer { print ($$); } <> + ^^^^^^^^^^^^^^^ input.y:8.10-24: previous declaration + %printer { print ($$); } <> <> + ^^^^^^^^^^^^^^^ input.y:17.13-29: error: %destructor redeclaration for <*> + %destructor { destroy ($$); } <*>; + ^^^^^^^^^^^^^^^^^ input.y:4.13-29: previous declaration + %destructor { destroy ($$); } <*> + ^^^^^^^^^^^^^^^^^ input.y:18.10-24: error: %printer redeclaration for <*> + %printer { print ($$); } <*>; + ^^^^^^^^^^^^^^^ input.y:5.10-24: previous declaration + %printer { print ($$); } <*> + ^^^^^^^^^^^^^^^ input.y:20.13-29: error: %destructor redeclaration for <> + %destructor { destroy ($$); } <>; + ^^^^^^^^^^^^^^^^^ input.y:10.13-29: previous declaration + %destructor { destroy ($$); } <> + ^^^^^^^^^^^^^^^^^ input.y:21.10-24: error: %printer redeclaration for <> + %printer { print ($$); } <>; + ^^^^^^^^^^^^^^^ input.y:11.10-24: previous declaration + %printer { print ($$); } <> + ^^^^^^^^^^^^^^^ ]]) AT_CLEANUP @@ -409,11 +471,19 @@ AT_DATA([[input.y]], exp: bar; ]]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules + %destructor {} bar + ^^^ input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother] + %printer {} foo baz + ^^^ input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother] + %printer {} foo baz + ^^^ input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother] + %type qux + ^^^ ]]) AT_CLEANUP @@ -530,10 +600,16 @@ end: { } ; tagged: { } ; ]]) -AT_BISON_CHECK([input.y], [0], [], +AT_BISON_CHECK([-fcaret input.y], [0], [], [[input.y:6.8-45: warning: unset value: $$ [-Wother] + start: end end tagged tagged { $1; $3; } ; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ input.y:6.12-14: warning: unused value: $2 [-Wother] + start: end end tagged tagged { $1; $3; } ; + ^^^ input.y:7.6-8: warning: unset value: $$ [-Wother] + end: { } ; + ^^^ ]]) AT_DATA([[input.y]], @@ -571,10 +647,16 @@ start: end end { $1; } ; end: { } ; ]]) -AT_BISON_CHECK([input.y], [0], [], +AT_BISON_CHECK([-fcaret input.y], [0], [], [[input.y:6.8-22: warning: unset value: $$ [-Wother] + start: end end { $1; } ; + ^^^^^^^^^^^^^^^ input.y:6.12-14: warning: unused value: $2 [-Wother] + start: end end { $1; } ; + ^^^ input.y:7.6-8: warning: unset value: $$ [-Wother] + end: { } ; + ^^^ ]]) AT_CLEANUP @@ -603,15 +685,31 @@ AT_DATA([input.y], exp: foo; ]]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:8.7-11: error: %type redeclaration for foo + %type "foo" + ^^^^^ input.y:3.7-11: previous declaration + %type foo + ^^^^^ input.y:10.13-17: error: %destructor redeclaration for foo + %destructor {baz} "foo" + ^^^^^ input.y:5.13-17: previous declaration + %destructor {bar} foo + ^^^^^ input.y:9.10-14: error: %printer redeclaration for foo + %printer {baz} "foo" + ^^^^^ input.y:4.10-14: previous declaration + %printer {bar} foo + ^^^^^ input.y:11.1-5: error: %left redeclaration for foo + %left "foo" + ^^^^^ input.y:6.1-5: previous declaration + %left foo + ^^^^^ ]]) AT_CLEANUP @@ -637,8 +735,10 @@ AT_BISON_CHECK([input.y], [1], [], AT_DATA([input.y], [{} ]) -AT_BISON_CHECK([input.y], [1], [], +AT_BISON_CHECK([-fcaret input.y], [1], [], [[input.y:1.1-2: error: syntax error, unexpected {...} + {} + ^^ ]]) @@ -983,15 +1083,6 @@ start: ; %destructor { free ($$) ]]) -AT_BISON_CHECK([-o input.c input.y], 1, [], -[[input.y:1.10-2.0: error: missing '"' at end of line -input.y:4.10-5.0: error: missing "'" at end of line -input.y:14.11-15.0: error: missing "'" at end of line -input.y:16.11-17.0: error: missing '"' at end of line -input.y:19.13-20.0: error: missing '}' at end of file -input.y:20.1: error: syntax error, unexpected end of file -]]) - AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [], [[input.y:1.10-2.0: error: missing '"' at end of line %token A "a diff --git a/tests/named-refs.at b/tests/named-refs.at index 75e73030..5d239aca 100644 --- a/tests/named-refs.at +++ b/tests/named-refs.at @@ -250,18 +250,40 @@ exp: %% ]]) -AT_BISON_CHECK([-o test.c test.y], 1, [], +AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [], [[test.y:50.51-60: error: invalid reference: '$lo9' + | exp[x] '+' { $$ = $x; } [l] exp[r] { $$ = $lo9 + $r; } + ^^^^^^^^^^ test.y:50.3-68: symbol not found in production: lo9 + | exp[x] '+' { $$ = $x; } [l] exp[r] { $$ = $lo9 + $r; } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ test.y:51.51-60: warning: misleading reference: '$exp' [-Wother] + | exp[x] '-' { $$ = $x; } [l] exp[r] { $$ = $exp - $r; } + ^^^^^^^^^^ test.y:42.1-3: refers to: $exp at $$ + exp: + ^^^ test.y:51.7: possibly meant: $x, hiding $exp at $1 + | exp[x] '-' { $$ = $x; } [l] exp[r] { $$ = $exp - $r; } + ^ test.y:51.41: possibly meant: $r, hiding $exp at $4 + | exp[x] '-' { $$ = $x; } [l] exp[r] { $$ = $exp - $r; } + ^ test.y:52.51-52: error: $l of 'exp' has no declared type + | exp[x] '*' { $$ = $x; } [l] exp[r] { $$ = $l * $r; } + ^^ test.y:55.40-43: error: invalid reference: '$r12' + | exp[l] '^' exp[r] { $$ = power ($l, $r12); } + ^^^^ test.y:55.3-47: symbol not found in production: r12 + | exp[l] '^' exp[r] { $$ = power ($l, $r12); } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ test.y:56.29-33: error: invalid reference: '$expo' + | '(' exp ')' { $$ = $expo; } + ^^^^^ test.y:56.3-46: symbol not found in production: expo + | '(' exp ')' { $$ = $expo; } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ]]) AT_BISON_OPTION_POPDEFS AT_CLEANUP -- 2.45.2