]> git.saurik.com Git - bison.git/blobdiff - tests/named-refs.at
Revert "Simplify handling of '.' and '-' after unbracketed named references."
[bison.git] / tests / named-refs.at
index 17cbef3e53d3e6ecc1295cea4ad9bec87d6e3781..74549c6e78cc8652ce86db5e1b8e17b5df71b49f 100644 (file)
@@ -279,9 +279,11 @@ start: foo foo.bar { $foo.bar; }
 foo: '1'
 foo.bar: '2'
 ]])
-AT_BISON_CHECK([-o test.c test.y])
-AT_CHECK([if $CC $CFLAGS $CPPFLAGS test.c; then false; else true; fi],
-         [0], [ignore], [ignore])
+AT_BISON_CHECK([-o test.c test.y], 0, [],
+[[test.y:11.22-29: warning: misleading reference: `$foo.bar'
+test.y:11.8-10:      warning: refers to: $foo at $1
+test.y:11.12-18:     warning: possibly meant: $[foo.bar] at $2
+]])
 AT_CLEANUP
 
 #######################################################################
@@ -356,33 +358,43 @@ factor:     '(' expr ')'  { $$ = $2; }
 AT_BISON_CHECK([-o test.c test.y], 1, [],
 [[test.y:24.36-41: invalid reference: `$cond1'
 test.y:23.11-24.62:  symbol not found in production: cond1
-test.y:26.43-47: invalid reference: `$stmt'
+test.y:26.43-53: invalid reference: `$stmt.field'
 test.y:25.11-26.60:  symbol not found in production: stmt
-test.y:25.35-38:     possibly meant: $then, hiding $stmt at $4
-test.y:28.43-47: invalid reference: `$stmt'
+test.y:25.35-38:     possibly meant: $then.field, hiding $stmt.field at $4
+test.y:28.43-52: invalid reference: `$stmt.list'
 test.y:27.11-28.59:  symbol not found in production: stmt
+test.y:27.30-38:     possibly meant: $[stmt.list] at $4
 test.y:30.43-46: ambiguous reference: `$xyz'
 test.y:29.35-37:     refers to: $xyz at $4
 test.y:29.50-52:     refers to: $xyz at $6
-test.y:32.43-47: invalid reference: `$stmt'
+test.y:32.43-52: invalid reference: `$stmt.list'
 test.y:31.11-32.63:  symbol not found in production: stmt
-test.y:34.43-47: invalid reference: `$stmt'
+test.y:31.40-43:     possibly meant: $then, hiding $[stmt.list] at $4
+test.y:31.61-64:     possibly meant: $else, hiding $[stmt.list] at $6
+test.y:34.43-58: invalid reference: `$stmt.list.field'
 test.y:33.11-34.69:  symbol not found in production: stmt
+test.y:33.40-43:     possibly meant: $then.field, hiding $[stmt.list].field at $4
+test.y:33.61-64:     possibly meant: $else.field, hiding $[stmt.list].field at $6
 test.y:36.43-54: invalid reference: `$[stmt.list]'
 test.y:35.11-36.71:  symbol not found in production: stmt.list
 test.y:35.40-43:     possibly meant: $then, hiding $[stmt.list] at $4
 test.y:35.61-64:     possibly meant: $else, hiding $[stmt.list] at $6
-test.y:38.43-47: invalid reference: `$then'
+test.y:38.43-49: invalid reference: `$then.1'
 test.y:37.11-38.60:  symbol not found in production: then
-test.y:40.43-47: invalid reference: `$then'
+test.y:37.40-45:     possibly meant: $[then.1] at $4
+test.y:40.43-55: invalid reference: `$then.1.field'
 test.y:39.11-40.66:  symbol not found in production: then
-test.y:42.44-48: invalid reference: `$stmt'
+test.y:39.40-45:     possibly meant: $[then.1].field at $4
+test.y:42.44-50: invalid reference: `$stmt.x'
 test.y:41.12-42.57:  symbol not found in production: stmt
-test.y:41.36-41:     possibly meant: $[stmt.x], hiding $stmt at $4
-test.y:44.13-15: invalid reference: `$if'
+test.y:41.36-41:     possibly meant: $[stmt.x].x, hiding $stmt.x at $4
+test.y:41.36-41:     possibly meant: $[stmt.x] at $4
+test.y:44.13-22: invalid reference: `$if-stmt-a'
 test.y:43.12-44.59:  symbol not found in production: if
-test.y:46.46-50: invalid reference: `$then'
+test.y:43.1-9:       possibly meant: $[if-stmt-a] at $$
+test.y:46.46-54: invalid reference: `$then-a.f'
 test.y:45.12-46.65:  symbol not found in production: then
+test.y:45.41-46:     possibly meant: $[then-a].f at $4
 ]])
 AT_CLEANUP
 
@@ -515,9 +527,9 @@ sym_a : 'a';
 sym_b : 'b';
 ]])
 AT_BISON_CHECK([-o test.c test.y], 1, [],
-[[test.y:13.8-11: invalid reference: `$sym'
+[[test.y:13.8-17: invalid reference: `$sym.field'
 test.y:12.1-13.21:  symbol not found in production: sym
-test.y:16.8-15: invalid reference: `$<aa>sym'
+test.y:16.8-21: invalid reference: `$<aa>sym.field'
 test.y:15.1-16.25:  symbol not found in production: sym
 test.y:19.8-19: invalid reference: `$[sym.field]'
 test.y:18.1-19.23:  symbol not found in production: sym.field
@@ -531,9 +543,9 @@ test.y:31.8-13: invalid reference: `$[sym]'
 test.y:30.1-33.21:  symbol not found in production before $3: sym
 test.y:33.8-17: invalid reference: `$<aa>[sym]'
 test.y:30.1-33.21:  symbol not found in production: sym
-test.y:37.8-11: invalid reference: `$sym'
+test.y:37.8-17: invalid reference: `$sym-field'
 test.y:36.1-37.21:  symbol not found in production: sym
-test.y:40.8-15: invalid reference: `$<aa>sym'
+test.y:40.8-21: invalid reference: `$<aa>sym-field'
 test.y:39.1-40.25:  symbol not found in production: sym
 test.y:43.8-19: invalid reference: `$[sym-field]'
 test.y:42.1-43.23:  symbol not found in production: sym-field
@@ -560,15 +572,21 @@ start:
   .field { $.field; }
 | -field { @-field; }
 | 'a'    { @.field; }
-| 'b'    { $-field; }
+| 'a'    { $-field; }
 ;
-.field: 'c' ;
--field: 'd' ;
+.field: ;
+-field: ;
 ]])
-AT_BISON_CHECK([[test.y]], [], [],
-[[test.y:4.12: warning: stray `$'
-test.y:5.12: warning: stray `@'
-test.y:6.12: warning: stray `@'
-test.y:7.12: warning: stray `$'
+AT_BISON_CHECK([[test.y]], [[1]], [],
+[[test.y:4.12-18: invalid reference: `$.field'
+test.y:4.13:        syntax error after `$', expecting integer, letter, `_', `@<:@', or `$'
+test.y:4.3-8:       possibly meant: $[.field] at $1
+test.y:5.12-18: invalid reference: `@-field'
+test.y:5.13:        syntax error after `@', expecting integer, letter, `_', `@<:@', or `$'
+test.y:5.3-8:       possibly meant: @[-field] at $1
+test.y:6.12-18: invalid reference: `@.field'
+test.y:6.13:        syntax error after `@', expecting integer, letter, `_', `@<:@', or `$'
+test.y:7.12-18: invalid reference: `$-field'
+test.y:7.13:        syntax error after `$', expecting integer, letter, `_', `@<:@', or `$'
 ]])
 AT_CLEANUP