bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/4] Fix caret errors


From: Akim Demaille
Subject: Re: [PATCH 0/4] Fix caret errors
Date: Mon, 22 Apr 2019 09:31:26 +0200

> Le 21 avr. 2019 à 20:05, Akim Demaille <address@hidden> a écrit :
> 
>> Le 21 avr. 2019 à 19:22, Paul Eggert <address@hidden> a écrit :
>> I suggest (d) as it fixes the alignment messup and is easy to do and this 
>> issue is not worth the hassle of (b). But that's just my opinion.
> 
> I just discovered that GCC9 has yet another approach (I just saw your
> message when I came to answer my own message about this).  This blog
> describes many details about it:
> 
> https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/

Below is my proposal to implement GCC9's format.  It is straightforward
to implement and fixes all our concerns!

However, I confess I had not anticipated that since it is somewhat
frequent to start lines with `|' in Bison files, the result might
sometimes be unsettling:

$ cat /tmp/foo.y
%%
a: {            }
 | {            }
 | {------------}
 | {éééééééééééé}
 | {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
 | {    42      }
 | {    "฿¥$€₦" }
 | {    🐃       }


$ LC_ALL=en_US.UTF-8 ./_build/8d/tests/bison /tmp/foo.y -Wall/tmp/foo.y:2.4-17: 
warning: empty rule without %empty [-Wempty-rule]
    2 | a: {            }
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:3.4-17: warning: empty rule without %empty [-Wempty-rule]
    3 |  | {            }
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:4.4-17: warning: empty rule without %empty [-Wempty-rule]
    4 |  | {------------}
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:5.4-17: warning: empty rule without %empty [-Wempty-rule]
    5 |  | {éééééééééééé}
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:6.4-17: warning: empty rule without %empty [-Wempty-rule]
    6 |  | {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:7.4-17: warning: empty rule without %empty [-Wempty-rule]
    7 |  | {    42      }
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:8.4-17: warning: empty rule without %empty [-Wempty-rule]
    8 |  | {    "฿¥$€₦" }
      |    ^~~~~~~~~~~~~~
/tmp/foo.y:9.4-17: warning: empty rule without %empty [-Wempty-rule]
    9 |  | {    🐃       }
      |    ^~~~~~~~~~~~~~
[...]


commit e6faed9b9f06169601954d7f9a3e5271aebc0912
Author: Akim Demaille <address@hidden>
Date:   Mon Apr 22 07:52:38 2019 +0200

    diagnostics: copy GCC9's format
    
    Currently, when we quote the source file, we indent it with one space,
    and preserve tabulations, so there is a discrepancy and the visual
    rendering is bad.  One way out is to indent with a tab instead of a
    space, but then this space can be used for more information.  This is
    what GCC9 does.  Let's play copy cats.
    
    See
    https://lists.gnu.org/archive/html/bison-patches/2019-04/msg00025.html
    
https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/
    
https://gcc.gnu.org/onlinedocs/gccint/Guidelines-for-Diagnostics.html#Guidelines-for-Diagnostics
    
    * src/location.c (location_caret): Prefix quoted lines with the line
    number and a pipe, fitting 8 columns.
    
    * tests/actions.at, tests/c++.at, tests/conflicts.at,
    * tests/diagnostics.at, tests/input.at, tests/java.at,
    * tests/named-refs.at, tests/reduce.at, tests/regression.at,
    * tests/sets.at: Adjust expectations.
    Partly by "./build-aux/update-test tests/testsuite.dir/*/testsuite.log"
    repeatedly, and partly by hand.

diff --git a/src/location.c b/src/location.c
index a10297e6..c5ec8569 100644
--- a/src/location.c
+++ b/src/location.c
@@ -191,7 +191,7 @@ location_caret (location loc, const char *style, FILE *out)
       {
         /* Quote the file (at most first line in the case of multiline
            location).  Indent by a single column.  */
-        fputc (' ', out);
+        fprintf (out, "%5d | ", loc.start.line);
         bool single_line = loc.start.line == loc.end.line;
         /* Consider that single point location (with equal boundaries)
            actually denote the character that they follow.  */
@@ -215,7 +215,7 @@ location_caret (location loc, const char *style, FILE *out)
 
         {
           /* Print the carets with the same indentation as above.  */
-          fprintf (out, " %*s", loc.start.column - 1, "");
+          fprintf (out, "      | %*s", loc.start.column - 1, "");
           begin_use_class (style, out);
           putc ('^', out);
           /* Underlining a multiline location ends with the first
diff --git a/tests/actions.at b/tests/actions.at
index 741fff12..f9fa20c8 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -131,8 +131,8 @@ b: {} {};
 
 AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
 [[1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
- a: /* empty. */ {};
-                 ^~
+   11 | a: /* empty. */ {};
+      |                 ^~
 ]])
 
 AT_DATA_GRAMMAR([[2.y]],
@@ -145,11 +145,11 @@ c: /* empty. */ {};
 
 AT_BISON_CHECK([-fcaret 2.y], [0], [],
 [[2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
- a: /* empty. */ {};
-                 ^~
+   11 | a: /* empty. */ {};
+      |                 ^~
 2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
- c: /* empty. */ {};
-                 ^~
+   13 | c: /* empty. */ {};
+      |                 ^~
 ]])
 
 AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
@@ -174,21 +174,21 @@ exp:
 
 AT_BISON_CHECK([-fcaret one.y], [1], [],
 [[one.y:11.13-18: error: only one %empty allowed per rule
-   %empty {} %empty
-             ^~~~~~
+   11 |   %empty {} %empty
+      |             ^~~~~~
 one.y:11.3-8:       previous declaration
-   %empty {} %empty
-   ^~~~~~
+   11 |   %empty {} %empty
+      |   ^~~~~~
 one.y: warning: fix-its can be applied.  Rerun with option '--update'. 
[-Wother]
 ]])
 
 AT_BISON_CHECK([-fcaret -u one.y], [1], [],
 [[one.y:11.13-18: error: only one %empty allowed per rule
-   %empty {} %empty
-             ^~~~~~
+   11 |   %empty {} %empty
+      |             ^~~~~~
 one.y:11.3-8:       previous declaration
-   %empty {} %empty
-   ^~~~~~
+   11 |   %empty {} %empty
+      |   ^~~~~~
 bison: file 'one.y' was updated (backup: 'one.y~')
 ]])
 
@@ -219,14 +219,14 @@ exp:
 
 AT_BISON_CHECK([-fcaret two.y], [1], [],
 [[two.y:11.7-12: error: %empty on non-empty rule
-   'a' %empty    {}
-       ^~~~~~
+   11 |   'a' %empty    {}
+      |       ^~~~~~
 two.y:12.3-8: error: %empty on non-empty rule
- | %empty 'a'    {}
-   ^~~~~~
+   12 | | %empty 'a'    {}
+      |   ^~~~~~
 two.y:13.3-8: error: %empty on non-empty rule
- | %empty {}     {}
-   ^~~~~~
+   13 | | %empty {}     {}
+      |   ^~~~~~
 ]])
 
 AT_BISON_OPTION_POPDEFS
@@ -1550,17 +1550,17 @@ input.y:32.3-23: warning: unused value: $3 [-Wother]
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
 [[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
- %printer    { #error "<*> printer should not be used" } <*>
-                                                         ^~~
+   24 | %printer    { #error "<*> printer should not be used" } <*>
+      |                                                         ^~~
 input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
- %printer    { #error "<*> printer should not be used" } <*>
-                                                         ^~~
+   24 | %printer    { #error "<*> printer should not be used" } <*>
+      |                                                         ^~~
 input.y:33.3-23: warning: unset value: $$ [-Wother]
-   {           @$ = 4; } // Only used.
-   ^~~~~~~~~~~~~~~~~~~~~
+   33 |   {           @$ = 4; } // Only used.
+      |   ^~~~~~~~~~~~~~~~~~~~~
 input.y:32.3-23: warning: unused value: $3 [-Wother]
-   { USE ($$); @$ = 3; } // Only set.
-   ^~~~~~~~~~~~~~~~~~~~~
+   32 |   { USE ($$); @$ = 3; } // Only set.
+      |   ^~~~~~~~~~~~~~~~~~~~~
 ]])
 
 AT_COMPILE([input])
diff --git a/tests/c++.at b/tests/c++.at
index f8bd3d2c..fc843c92 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -248,14 +248,14 @@ exp:
 
 AT_BISON_CHECK([[-fcaret input.yy]], [0], [],
 [[input.yy:16.33-34: warning: multiple occurrences of $2 with 
api.value.automove [-Wother]
- | "twice" exp       { $$ = $2 + $2; }
-                                 ^~
+   16 | | "twice" exp       { $$ = $2 + $2; }
+      |                                 ^~
 input.yy:17.33-36: warning: multiple occurrences of $2 with api.value.automove 
[-Wother]
- | "thrice" exp[val] { $$ = $2 + $val + $2; }
-                                 ^~~~
+   17 | | "thrice" exp[val] { $$ = $2 + $val + $2; }
+      |                                 ^~~~
 input.yy:17.40-41: warning: multiple occurrences of $2 with api.value.automove 
[-Wother]
- | "thrice" exp[val] { $$ = $2 + $val + $2; }
-                                        ^~
+   17 | | "thrice" exp[val] { $$ = $2 + $val + $2; }
+      |                                        ^~
 ]])
 
 AT_BISON_OPTION_POPDEFS
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 430a8271..4bc6eba4 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -247,17 +247,17 @@ f: B
 
 AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
 [[input.y:7.1-9: warning: useless precedence and associativity for U 
[-Wprecedence]
- %nonassoc U
- ^~~~~~~~~
+    7 | %nonassoc U
+      | ^~~~~~~~~
 input.y:6.1-6: warning: useless precedence and associativity for V 
[-Wprecedence]
- %right V
- ^~~~~~
+    6 | %right V
+      | ^~~~~~
 input.y:5.1-5: warning: useless precedence and associativity for W 
[-Wprecedence]
- %left W
- ^~~~~
+    5 | %left W
+      | ^~~~~
 input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
- %precedence Z
- ^~~~~~~~~~~
+    2 | %precedence Z
+      | ^~~~~~~~~~~
 ]])
 
 AT_CLEANUP
@@ -287,8 +287,8 @@ AT_BISON_CHECK([-o input.c input.y], 0, [],
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], 0, [],
 [[input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
- e: 'e' | /* Nothing. */;
-         ^
+    4 | e: 'e' | /* Nothing. */;
+      |         ^
 ]])
 
 AT_CLEANUP
@@ -1344,8 +1344,8 @@ b: %expect-rr 4
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
 [[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 4 
expected
- b: %expect-rr 4
-    ^~~~~~~~~~~~
+   12 | b: %expect-rr 4
+      |    ^~~~~~~~~~~~
 ]])
 AT_CLEANUP
 
@@ -1373,8 +1373,8 @@ b: %expect-rr 2
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
 [[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 2 
expected
- b: %expect-rr 2
-    ^~~~~~~~~~~~
+   12 | b: %expect-rr 2
+      |    ^~~~~~~~~~~~
 ]])
 AT_CLEANUP
 
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index 2b49debf..add313e0 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -60,20 +60,20 @@ AT_TEST([[Warnings]],
 exp: %empty;
 ]],
 [[input.y:9.12-14: <warning>warning:</warning> symbol FOO redeclared 
[<warning>-Wother</warning>]
- %token FOO <warning>FOO</warning> FOO
-            <warning>^~~</warning>
+    9 | %token FOO <warning>FOO</warning> FOO
+      |            <warning>^~~</warning>
 input.y:9.16-18: <warning>warning:</warning> symbol FOO redeclared 
[<warning>-Wother</warning>]
- %token FOO FOO <warning>FOO</warning>
-                <warning>^~~</warning>
+    9 | %token FOO FOO <warning>FOO</warning>
+      |                <warning>^~~</warning>
 input.y:10.8-10: <warning>warning:</warning> symbol FOO redeclared 
[<warning>-Wother</warning>]
- %token <warning>FOO</warning>  FOO  FOO
-        <warning>^~~</warning>
+   10 | %token <warning>FOO</warning>  FOO  FOO
+      |        <warning>^~~</warning>
 input.y:10.13-15: <warning>warning:</warning> symbol FOO redeclared 
[<warning>-Wother</warning>]
- %token FOO  <warning>FOO</warning>  FOO
-             <warning>^~~</warning>
+   10 | %token FOO  <warning>FOO</warning>  FOO
+      |             <warning>^~~</warning>
 input.y:10.18-20: <warning>warning:</warning> symbol FOO redeclared 
[<warning>-Wother</warning>]
- %token FOO  FOO  <warning>FOO</warning>
-                  <warning>^~~</warning>
+   10 | %token FOO  FOO  <warning>FOO</warning>
+      |                  <warning>^~~</warning>
 ]])
 
 
@@ -98,20 +98,20 @@ d
 e:
 ]],
 [[input.y:11.4-5: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- a: <warning>{}</warning>
-    <warning>^~</warning>
+   11 | a: <warning>{}</warning>
+      |    <warning>^~</warning>
 input.y:12.3-13.1: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- b:<warning>{</warning>
-   <warning>^</warning>
+   12 | b:<warning>{</warning>
+      |   <warning>^</warning>
 input.y:14.2: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- c<warning>:</warning>
-  <warning>^</warning>
+   14 | c<warning>:</warning>
+      |  <warning>^</warning>
 input.y:15.2: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- d
-  <warning>^</warning>
+   15 | d
+      |  <warning>^</warning>
 input.y:17.2: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- e<warning>:</warning>
-  <warning>^</warning>
+   17 | e<warning>:</warning>
+      |  <warning>^</warning>
 ]])
 
 
@@ -135,29 +135,29 @@ g: {      "฿¥$€₦" }
 h: {   🐃       }
 ]],
 [[input.y:11.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- a: <warning>{         }</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   11 | a: <warning>{          }</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:12.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- b: <warning>{            }</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   12 | b: <warning>{            }</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:13.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- c: <warning>{------------}</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   13 | c: <warning>{------------}</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:14.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- d: <warning>{éééééééééééé}</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   14 | d: <warning>{éééééééééééé}</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:15.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- e: <warning>{∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   15 | e: <warning>{∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:16.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- f: <warning>{ 42      }</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   16 | f: <warning>{  42      }</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:17.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- g: <warning>{ "฿¥$€₦" }</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   17 | g: <warning>{  "฿¥$€₦" }</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 input.y:18.4-17: <warning>warning:</warning> empty rule without %empty 
[<warning>-Wempty-rule</warning>]
- h: <warning>{ 🐃       }</warning>
-    <warning>^~~~~~~~~~~~~~</warning>
+   18 | h: <warning>{  🐃       }</warning>
+      |    <warning>^~~~~~~~~~~~~~</warning>
 ]])
 
 
diff --git a/tests/input.at b/tests/input.at
index 6471dd9b..822521f5 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -145,17 +145,17 @@ exp: "number";
 
 AT_BISON_CHECK([-fcaret -Wyacc input.y], [0], [],
 [[input.y:1.1-6: warning: POSIX Yacc does not support %nterm [-Wyacc]
- %nterm exp
- ^~~~~~
+    1 | %nterm exp
+      | ^~~~~~
 input.y:2.12-15: warning: POSIX Yacc does not support hexadecimal literals 
[-Wyacc]
- %token NUM 0x40 "number"
-            ^~~~
+    2 | %token NUM 0x40 "number"
+      |            ^~~~
 input.y:2.17-24: warning: POSIX Yacc does not support string literals [-Wyacc]
- %token NUM 0x40 "number"
-                 ^~~~~~~~
+    2 | %token NUM 0x40 "number"
+      |                 ^~~~~~~~
 input.y:4.6-13: warning: POSIX Yacc does not support string literals [-Wyacc]
- exp: "number";
-      ^~~~~~~~
+    4 | exp: "number";
+      |      ^~~~~~~~
 ]])
 
 AT_CLEANUP
@@ -179,17 +179,17 @@ b: %empty            { $$ = 42; };
 
 AT_BISON_CHECK([-fcaret -Wyacc input.y], [0], [],
 [[input.y:1.1-11: warning: POSIX Yacc does not support %destructor [-Wyacc]
- %destructor {} <int>
- ^~~~~~~~~~~
+    1 | %destructor {} <int>
+      | ^~~~~~~~~~~
 input.y:2.1-8: warning: POSIX Yacc does not support %printer [-Wyacc]
- %printer {} <int>
- ^~~~~~~~
+    2 | %printer {} <int>
+      | ^~~~~~~~
 input.y:6.9-20: warning: POSIX Yacc does not support typed midrule actions 
[-Wyacc]
- a: <int>{ $$ = 42; } { $$ = $1; };
-         ^~~~~~~~~~~~
+    6 | a: <int>{ $$ = 42; } { $$ = $1; };
+      |         ^~~~~~~~~~~~
 input.y:7.4-9: warning: POSIX Yacc does not support %empty [-Wyacc]
- b: %empty            { $$ = 42; };
-    ^~~~~~
+    7 | b: %empty            { $$ = 42; };
+      |    ^~~~~~
 ]])
 
 AT_CLEANUP
@@ -218,32 +218,32 @@ fact: "number";
 
 AT_BISON_CHECK([-fcaret input.y], [1], [],
 [[input.y:1.13-24: error: nonterminals cannot be given a string alias
- %nterm expr "expression";
-             ^~~~~~~~~~~~
+    1 | %nterm expr "expression";
+      |             ^~~~~~~~~~~~
 input.y:2.13-15: error: nonterminals cannot be given an explicit number
- %nterm term 123;
-             ^~~
+    2 | %nterm term 123;
+      |             ^~~
 input.y:3.13-15: error: nonterminals cannot be given an explicit number
- %nterm fact 124 "factor";
-             ^~~
+    3 | %nterm fact 124 "factor";
+      |             ^~~
 input.y:3.17-24: error: nonterminals cannot be given a string alias
- %nterm fact 124 "factor";
-                 ^~~~~~~~
+    3 | %nterm fact 124 "factor";
+      |                 ^~~~~~~~
 input.y:4.8-10: error: character literals cannot be nonterminals
- %nterm '+' '*';
-        ^~~
+    4 | %nterm '+' '*';
+      |        ^~~
 input.y:5.8-15: error: syntax error, unexpected string, expecting char or 
identifier or <tag>
- %nterm "number";
-        ^~~~~~~~
+    5 | %nterm "number";
+      |        ^~~~~~~~
 input.y:6.8-13: error: syntax error, unexpected string, expecting char or 
identifier or <tag>
- %token "tok1" 1;
-        ^~~~~~
+    6 | %token "tok1" 1;
+      |        ^~~~~~
 input.y:7.14: error: syntax error, unexpected integer
- %left "tok2" 2;
-              ^
+    7 | %left "tok2" 2;
+      |              ^
 input.y:8.14: error: syntax error, unexpected integer
- %type "tok3" 3;
-              ^
+    8 | %type "tok3" 3;
+      |              ^
 ]])
 
 AT_CLEANUP
@@ -363,11 +363,11 @@ exp: %empty { @$ = @1 ; };
 
 AT_BISON_CHECK([-fcaret input.y], [1], [],
 [[input.y:2.20-21: error: integer out of range: '$1'
- exp: %empty { $$ = $1 ; };
-                    ^~
+    2 | exp: %empty { $$ = $1 ; };
+      |                    ^~
 input.y:3.20-21: error: integer out of range: '@1'
- exp: %empty { @$ = @1 ; };
-                    ^~
+    3 | exp: %empty { @$ = @1 ; };
+      |                    ^~
 ]])
 
 AT_CLEANUP
@@ -392,20 +392,20 @@ exp: foo { $$; } foo { $2; } foo
 
 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
-            ^~
+    5 | exp: foo { $$; } foo { $2; } foo
+      |            ^~
 input.y:5.24-25: error: $2 of 'exp' has no declared type
- exp: foo { $$; } foo { $2; } foo
-                        ^~
+    5 | exp: foo { $$; } foo { $2; } foo
+      |                        ^~
 input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
- exp: foo { $$; } foo { $2; } foo
-      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
+    5 | exp: foo { $$; } foo { $2; } foo
+      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
-    | foo
-      ^~~
+    6 |    | foo
+      |      ^~~
 input.y:7.6-11: warning: empty rule for typed nonterminal, and no action 
[-Wother]
-    | %empty
-      ^~~~~~
+    7 |    | %empty
+      |      ^~~~~~
 ]])
 
 AT_CLEANUP
@@ -463,134 +463,134 @@ _AT_UNUSED_VALUES_DECLARATIONS])
 AT_BISON_CHECK(m4_ifval([$2], [--warnings=midrule-values ])[-fcaret input.y],
                [0], [],
 [[input.y:12.10-32: warning: unset value: $][$ [-Wother]
- a: INT | INT { } INT { } INT { };
-          ^~~~~~~~~~~~~~~~~~~~~~~
+   12 | a: INT | INT { } INT { } INT { };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~
 input.y:12.10-12: warning: unused value: $][1 [-Wother]
- a: INT | INT { } INT { } INT { };
-          ^~~
+   12 | a: INT | INT { } INT { } INT { };
+      |          ^~~
 input.y:12.18-20: warning: unused value: $][3 [-Wother]
- a: INT | INT { } INT { } INT { };
-                  ^~~
+   12 | a: INT | INT { } INT { } INT { };
+      |                  ^~~
 input.y:12.26-28: warning: unused value: $][5 [-Wother]
- a: INT | INT { } INT { } INT { };
-                          ^~~
+   12 | a: INT | INT { } INT { } INT { };
+      |                          ^~~
 input.y:13.10-15: warning: empty rule for typed nonterminal, and no action 
[-Wother]
- b: INT | %empty;
-          ^~~~~~
+   13 | b: INT | %empty;
+      |          ^~~~~~
 ]]m4_ifval([$2], [[[input.y:14.14-20: warning: unset value: $][$ 
[-Wmidrule-values]
- c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
-              ^~~~~~~
+   14 | c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
+      |              ^~~~~~~
 input.y:14.26-41: warning: unset value: $][$ [-Wmidrule-values]
- c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
-                          ^~~~~~~~~~~~~~~~
+   14 | c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
+      |                          ^~~~~~~~~~~~~~~~
 ]]])[[input.y:14.10-62: warning: unset value: $][$ [-Wother]
- c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   14 | c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:14.22-24: warning: unused value: $][3 [-Wother]
- c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
-                      ^~~
+   14 | c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
+      |                      ^~~
 input.y:14.43-45: warning: unused value: $][5 [-Wother]
- c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
-                                           ^~~
+   14 | c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
+      |                                           ^~~
 ]]m4_ifval([$2], [[[input.y:15.14-16: warning: unset value: $][$ 
[-Wmidrule-values]
- d: INT | INT { } INT { $][1; } INT { $<integer>2; };
-              ^~~
+   15 | d: INT | INT { } INT { $][1; } INT { $<integer>2; };
+      |              ^~~
 ]]])[[input.y:15.10-49: warning: unset value: $][$ [-Wother]
- d: INT | INT { } INT { $][1; } INT { $<integer>2; };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   15 | d: INT | INT { } INT { $][1; } INT { $<integer>2; };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:15.18-20: warning: unused value: $][3 [-Wother]
- d: INT | INT { } INT { $][1; } INT { $<integer>2; };
-                  ^~~
+   15 | d: INT | INT { } INT { $][1; } INT { $<integer>2; };
+      |                  ^~~
 input.y:15.30-32: warning: unused value: $][5 [-Wother]
- d: INT | INT { } INT { $][1; } INT { $<integer>2; };
-                              ^~~
+   15 | d: INT | INT { } INT { $][1; } INT { $<integer>2; };
+      |                              ^~~
 input.y:16.10-37: warning: unset value: $][$ [-Wother]
- e: INT | INT { } INT {  } INT { $][1; };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   16 | e: INT | INT { } INT {  } INT { $][1; };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:16.18-20: warning: unused value: $][3 [-Wother]
- e: INT | INT { } INT {  } INT { $][1; };
-                  ^~~
+   16 | e: INT | INT { } INT {  } INT { $][1; };
+      |                  ^~~
 input.y:16.27-29: warning: unused value: $][5 [-Wother]
- e: INT | INT { } INT {  } INT { $][1; };
-                           ^~~
+   16 | e: INT | INT { } INT {  } INT { $][1; };
+      |                           ^~~
 input.y:18.10-58: warning: unset value: $][$ [-Wother]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:18.10-12: warning: unused value: $][1 [-Wother]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-          ^~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |          ^~~
 ]]m4_ifval([$2], [[[input.y:18.14-29: warning: unused value: $][2 
[-Wmidrule-values]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-              ^~~~~~~~~~~~~~~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |              ^~~~~~~~~~~~~~~~
 ]]])[[input.y:18.31-33: warning: unused value: $][3 [-Wother]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-                               ^~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |                               ^~~
 ]]m4_ifval([$2], [[[input.y:18.35-50: warning: unused value: $][4 
[-Wmidrule-values]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-                                   ^~~~~~~~~~~~~~~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |                                   ^~~~~~~~~~~~~~~~
 ]]])[[input.y:18.52-54: warning: unused value: $][5 [-Wother]
- g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
-                                                    ^~~
+   18 | g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
+      |                                                    ^~~
 input.y:19.10-72: warning: unset value: $][$ [-Wother]
- h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   19 | h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { 
};
+      |          
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:19.10-12: warning: unused value: $][1 [-Wother]
- h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
-          ^~~
+   19 | h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { 
};
+      |          ^~~
 input.y:19.31-33: warning: unused value: $][3 [-Wother]
- h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
-                               ^~~
+   19 | h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { 
};
+      |                               ^~~
 ]]m4_ifval([$2], [[[input.y:19.35-64: warning: unused value: $][4 
[-Wmidrule-values]
- h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
-                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   19 | h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { 
};
+      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]]])[[input.y:19.66-68: warning: unused value: $][5 [-Wother]
- h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
-                                                                  ^~~
+   19 | h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { 
};
+      |                                                                  ^~~
 ]]m4_ifval([$2], [[[input.y:21.18-37: warning: unused value: $][3 
[-Wmidrule-values]
- j: INT | INT INT { $<integer>$ = 1; } { $][$ = $][1 + $][2; };
-                  ^~~~~~~~~~~~~~~~~~~~
+   21 | j: INT | INT INT { $<integer>$ = 1; } { $][$ = $][1 + $][2; };
+      |                  ^~~~~~~~~~~~~~~~~~~~
 ]]])[[input.y:22.10-68: warning: unset value: $][$ [-Wother]
- k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   22 | k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:22.10-12: warning: unused value: $][1 [-Wother]
- k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
-          ^~~
+   22 | k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
+      |          ^~~
 input.y:22.14-16: warning: unused value: $][2 [-Wother]
- k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
-              ^~~
+   22 | k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
+      |              ^~~
 ]]m4_ifval([$2], [[[input.y:22.35-64: warning: unused value: $][4 
[-Wmidrule-values]
- k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
-                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   22 | k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
+      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]]])[[input.y:25.23-25: warning: unset value: $][$ [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                       ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                       ^~~
 input.y:25.40-42: warning: unset value: $][$ [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                                        ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                                        ^~~
 input.y:25.10-50: warning: unset value: $][$ [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:25.10-12: warning: unused value: $][1 [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-          ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |          ^~~
 input.y:25.23-25: warning: unused value: $][2 [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                       ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                       ^~~
 input.y:25.27-29: warning: unused value: $][3 [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                           ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                           ^~~
 input.y:25.40-42: warning: unused value: $][4 [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                                        ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                                        ^~~
 input.y:25.44-46: warning: unused value: $][5 [-Wother]
- n: INT | INT <integer>{ } INT <integer>{ } INT { };
-                                            ^~~
+   25 | n: INT | INT <integer>{ } INT <integer>{ } INT { };
+      |                                            ^~~
 input.y:26.23-25: warning: unset value: $][$ [-Wother]
- o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 + 
$][4 + $][5; };
-                       ^~~
+   26 | o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + 
$][3 + $][4 + $][5; };
+      |                       ^~~
 input.y:26.40-42: warning: unset value: $][$ [-Wother]
- o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + $][3 + 
$][4 + $][5; };
-                                        ^~~
+   26 | o: INT | INT <integer>{ } INT <integer>{ } INT { $][$ = $][1 + $][2 + 
$][3 + $][4 + $][5; };
+      |                                        ^~~
 ]])
 
 ])
@@ -633,23 +633,23 @@ BAR:
 
 AT_BISON_CHECK([-fcaret input.y], [1], [],
 [[input.y:2.8-10: error: symbol FOO redeclared as a nonterminal
- %nterm FOO BAR
-        ^~~
+    2 | %nterm FOO BAR
+      |        ^~~
 input.y:1.8-10:     previous definition
- %token FOO
-        ^~~
+    1 | %token FOO
+      |        ^~~
 input.y:3.8-10: error: symbol BAR redeclared as a token
- %token BAR
-        ^~~
+    3 | %token BAR
+      |        ^~~
 input.y:2.12-14:    previous definition
- %nterm FOO BAR
-            ^~~
+    2 | %nterm FOO BAR
+      |            ^~~
 input.y:4.8-12: error: symbol error redeclared as a nonterminal
- %nterm error // The token error cannot be redefined as an nterm.
-        ^~~~~
+    4 | %nterm error // The token error cannot be redefined as an nterm.
+      |        ^~~~~
 input.y:6.1-3: error: rule given for FOO, which is a token
- FOO: BAR
- ^~~
+    6 | FOO: BAR
+      | ^~~
 ]])
 
 AT_CLEANUP
@@ -681,41 +681,41 @@ start: %empty;
 
 AT_BISON_CHECK([-fcaret input.y], [1], [],
 [[input.y:1.13-29: error: %destructor redeclaration for <>
- %destructor { destroy ($$); } <> <>
-             ^~~~~~~~~~~~~~~~~
+    1 | %destructor { destroy ($$); } <> <>
+      |             ^~~~~~~~~~~~~~~~~
 input.y:1.13-29:     previous declaration
- %destructor { destroy ($$); } <> <>
-             ^~~~~~~~~~~~~~~~~
+    1 | %destructor { destroy ($$); } <> <>
+      |             ^~~~~~~~~~~~~~~~~
 input.y:2.10-24: error: %printer redeclaration for <>
- %printer { print ($$); } <> <>
-          ^~~~~~~~~~~~~~~
+    2 | %printer { print ($$); } <> <>
+      |          ^~~~~~~~~~~~~~~
 input.y:2.10-24:     previous declaration
- %printer { print ($$); } <> <>
-          ^~~~~~~~~~~~~~~
+    2 | %printer { print ($$); } <> <>
+      |          ^~~~~~~~~~~~~~~
 input.y:4.13-29: error: %destructor redeclaration for <>
- %destructor { destroy ($$); } <>
-             ^~~~~~~~~~~~~~~~~
+    4 | %destructor { destroy ($$); } <>
+      |             ^~~~~~~~~~~~~~~~~
 input.y:1.13-29:     previous declaration
- %destructor { destroy ($$); } <> <>
-             ^~~~~~~~~~~~~~~~~
+    1 | %destructor { destroy ($$); } <> <>
+      |             ^~~~~~~~~~~~~~~~~
 input.y:5.10-24: error: %printer redeclaration for <>
- %printer { print ($$); } <>
-          ^~~~~~~~~~~~~~~
+    5 | %printer { print ($$); } <>
+      |          ^~~~~~~~~~~~~~~
 input.y:2.10-24:     previous declaration
- %printer { print ($$); } <> <>
-          ^~~~~~~~~~~~~~~
+    2 | %printer { print ($$); } <> <>
+      |          ^~~~~~~~~~~~~~~
 input.y:11.13-29: error: %destructor redeclaration for <>
- %destructor { destroy ($$); } <>;
-             ^~~~~~~~~~~~~~~~~
+   11 | %destructor { destroy ($$); } <>;
+      |             ^~~~~~~~~~~~~~~~~
 input.y:1.13-29:      previous declaration
- %destructor { destroy ($$); } <> <>
-             ^~~~~~~~~~~~~~~~~
+    1 | %destructor { destroy ($$); } <> <>
+      |             ^~~~~~~~~~~~~~~~~
 input.y:12.10-24: error: %printer redeclaration for <>
- %printer { print ($$); } <>;
-          ^~~~~~~~~~~~~~~
+   12 | %printer { print ($$); } <>;
+      |          ^~~~~~~~~~~~~~~
 input.y:2.10-24:      previous declaration
- %printer { print ($$); } <> <>
-          ^~~~~~~~~~~~~~~
+    2 | %printer { print ($$); } <> <>
+      |          ^~~~~~~~~~~~~~~
 ]])
 ])
 
@@ -785,17 +785,17 @@ exp: bar;
 
 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
-                ^~~
+    2 | %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
-                 ^~~
+    1 | %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
-             ^~~
+    1 | %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 <foo> qux
-             ^~~
+    3 | %type <foo> qux
+      |             ^~~
 ]])
 
 AT_CLEANUP
@@ -914,14 +914,14 @@ tagged: { } ;
 
 AT_BISON_CHECK([-fcaret input.y], [0], [],
 [[input.y:6.8-45: warning: unset value: $$ [-Wother]
- start: end end tagged tagged { $<tag>1; $3; } ;
-        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    6 | start: end end tagged tagged { $<tag>1; $3; } ;
+      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:6.12-14: warning: unused value: $2 [-Wother]
- start: end end tagged tagged { $<tag>1; $3; } ;
-            ^~~
+    6 | start: end end tagged tagged { $<tag>1; $3; } ;
+      |            ^~~
 input.y:7.6-8: warning: unset value: $$ [-Wother]
- end: { } ;
-      ^~~
+    7 | end: { } ;
+      |      ^~~
 ]])
 
 AT_DATA([[input.y]],
@@ -961,14 +961,14 @@ end: { }  ;
 
 AT_BISON_CHECK([-fcaret input.y], [0], [],
 [[input.y:6.8-22: warning: unset value: $$ [-Wother]
- start: end end { $1; } ;
-        ^~~~~~~~~~~~~~~
+    6 | start: end end { $1; } ;
+      |        ^~~~~~~~~~~~~~~
 input.y:6.12-14: warning: unused value: $2 [-Wother]
- start: end end { $1; } ;
-            ^~~
+    6 | start: end end { $1; } ;
+      |            ^~~
 input.y:7.6-8: warning: unset value: $$ [-Wother]
- end: { }  ;
-      ^~~
+    7 | end: { }  ;
+      |      ^~~
 ]])
 
 AT_CLEANUP
@@ -1018,14 +1018,14 @@ exp: FOO BAR;
 
 AT_BISON_CHECK([-fcaret input.y], [1], [],
 [[input.y:2.17-21: warning: symbol "foo" used more than once as a literal 
string [-Wother]
-          BAR 42 "foo"
-                 ^~~~~
+    2 |          BAR 42 "foo"
+      |                 ^~~~~
 input.y:2.10-12: error: user token number 42 redeclaration for BAR
-          BAR 42 "foo"
-          ^~~
+    2 |          BAR 42 "foo"
+      |          ^~~
 input.y:1.8-10:      previous declaration for FOO
- %token FOO 42 "foo"
-        ^~~
+    1 | %token FOO 42 "foo"
+      |        ^~~
 ]])
 
 AT_CLEANUP
@@ -1052,11 +1052,11 @@ AT_TEST([[%token foo "foo"
 exp: foo;
 ]],
 [[input.y:3.7-11: error: %type redeclaration for foo
- %type <baz> foo
-       ^~~~~
+    3 | %type <baz> foo
+      |       ^~~~~
 input.y:2.7-11:     previous declaration
- %type <bar> "foo"
-       ^~~~~
+    2 | %type <bar> "foo"
+      |       ^~~~~
 ]])
 
 AT_TEST([[%token foo "foo"
@@ -1066,11 +1066,11 @@ AT_TEST([[%token foo "foo"
 exp: foo;
 ]],
 [[input.y:3.10-14: error: %printer redeclaration for foo
- %printer {baz} foo
-          ^~~~~
+    3 | %printer {baz} foo
+      |          ^~~~~
 input.y:2.10-14:     previous declaration
- %printer {bar} "foo"
-          ^~~~~
+    2 | %printer {bar} "foo"
+      |          ^~~~~
 ]])
 
 AT_TEST([[%token foo "foo"
@@ -1080,11 +1080,11 @@ AT_TEST([[%token foo "foo"
 exp: foo;
 ]],
 [[input.y:3.13-17: error: %destructor redeclaration for foo
- %destructor {baz} foo
-             ^~~~~
+    3 | %destructor {baz} foo
+      |             ^~~~~
 input.y:2.13-17:     previous declaration
- %destructor {bar} "foo"
-             ^~~~~
+    2 | %destructor {bar} "foo"
+      |             ^~~~~
 ]])
 
 AT_TEST([[%token foo "foo"
@@ -1094,11 +1094,11 @@ AT_TEST([[%token foo "foo"
 exp: foo;
 ]],
 [[input.y:3.1-5: error: %left redeclaration for foo
- %left foo
- ^~~~~
+    3 | %left foo
+      | ^~~~~
 input.y:2.1-5:     previous declaration
- %left "foo"
- ^~~~~
+    2 | %left "foo"
+      | ^~~~~
 ]])
 
 # This time, declare the alias after its use.
@@ -1111,11 +1111,11 @@ AT_TEST([[%left "foo"
 exp: foo;
 ]],
 [[input.y:2.1-5: error: %left redeclaration for foo
- %left foo
- ^~~~~
+    2 | %left foo
+      | ^~~~~
 input.y:1.1-5:     previous declaration
- %left "foo"
- ^~~~~
+    1 | %left "foo"
+      | ^~~~~
 ]])
 
 # Printer.
@@ -1126,11 +1126,11 @@ AT_TEST([[%printer {} "foo"
 exp: foo;
 ]],
 [[input.y:2.10-11: error: %printer redeclaration for foo
- %printer {} foo
-          ^~
+    2 | %printer {} foo
+      |          ^~
 input.y:1.10-11:     previous declaration
- %printer {} "foo"
-          ^~
+    1 | %printer {} "foo"
+      |          ^~
 ]])
 
 # Destructor.
@@ -1141,11 +1141,11 @@ AT_TEST([[%destructor {} "foo"
 exp: foo;
 ]],
 [[input.y:2.13-14: error: %destructor redeclaration for foo
- %destructor {} foo
-             ^~
+    2 | %destructor {} foo
+      |             ^~
 input.y:1.13-14:     previous declaration
- %destructor {} "foo"
-             ^~
+    1 | %destructor {} "foo"
+      |             ^~
 ]])
 
 m4_popdef([AT_TEST])
@@ -1174,8 +1174,8 @@ AT_DATA([input.y],
 ])
 AT_BISON_CHECK([-fcaret  input.y], [1], [],
 [[input.y:1.1-2: error: syntax error, unexpected {...}
- {}
- ^~
+    1 | {}
+      | ^~
 ]])
 
 
@@ -1525,20 +1525,20 @@ start: %empty;
 
 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
-          ^~
+    1 | %token A "a
+      |          ^~
 input.y:4.10-5.0: error: missing "'" at end of line
- %token C '1
-          ^~
+    4 | %token C '1
+      |          ^~
 input.y:14.11-15.0: error: missing "'" at end of line
- %type <f> 'a
-           ^~
+   14 | %type <f> 'a
+      |           ^~
 input.y:16.11-17.0: error: missing '"' at end of line
- %type <f> "a
-           ^~
+   16 | %type <f> "a
+      |           ^~
 input.y:19.13-20.0: error: missing '}' at end of file
- %destructor { free ($$)
-             ^~~~~~~~~~~
+   19 | %destructor { free ($$)
+      |             ^~~~~~~~~~~
 input.y:20.1: error: syntax error, unexpected end of file
 ]])
 
@@ -1823,8 +1823,8 @@ start: %empty;
 ]])
 AT_BISON_CHECK([[-fcaret -Dvar=cmd-d input-dg.y]], [[1]], [],
 [[input-dg.y:1.1-18: error: %define variable 'var' redefined
- %define var "gram"
- ^~~~~~~~~~~~~~~~~~
+    1 | %define var "gram"
+      | ^~~~~~~~~~~~~~~~~~
 <command line>:4:      previous definition
 input-dg.y: warning: fix-its can be applied.  Rerun with option '--update'. 
[-Wother]
 ]])
@@ -1946,8 +1946,8 @@ start: %empty;
 ]])
 AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
 [[input.y:1.1-34: error: invalid value for %define variable 
'lr.default-reduction': 'bogus'
- %define lr.default-reduction bogus
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    1 | %define lr.default-reduction bogus
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:1.1-34:     accepted value: 'most'
 input.y:1.1-34:     accepted value: 'consistent'
 input.y:1.1-34:     accepted value: 'accepting'
@@ -1961,8 +1961,8 @@ start: %empty;
 ]])
 AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
 [[input.y:1.1-29: error: invalid value for %define variable 'api.push-pull': 
'neither'
- %define api.push-pull neither
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    1 | %define api.push-pull neither
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:1.1-29:     accepted value: 'pull'
 input.y:1.1-29:     accepted value: 'push'
 input.y:1.1-29:     accepted value: 'both'
@@ -1987,8 +1987,8 @@ start: %empty;
 ]])
 AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
 [[input.y:3.1-33: error: %define variable 'api.location.file' requires 'none' 
or '"..."' values
- %define api.location.file {bogus}
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    3 | %define api.location.file {bogus}
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]])
 
 AT_CLEANUP
@@ -2012,23 +2012,23 @@ start: %empty;
 ]])
 AT_BISON_CHECK([[-fcaret input.y]], [1], [],
 [[input.y:1.1-26: warning: deprecated directive, use '%define api.push-pull 
both' [-Wdeprecated]
- %define api.push_pull both
- ^~~~~~~~~~~~~~~~~~~~~~~~~~
+    1 | %define api.push_pull both
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:2.1-40: warning: deprecated directive, use '%define 
lr.keep-unreachable-state maybe' [-Wdeprecated]
- %define lr.keep_unreachable_states maybe
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    2 | %define lr.keep_unreachable_states maybe
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:3.1-23: warning: deprecated directive, use '%define api.namespace 
{foo}' [-Wdeprecated]
- %define namespace "foo"
- ^~~~~~~~~~~~~~~~~~~~~~~
+    3 | %define namespace "foo"
+      | ^~~~~~~~~~~~~~~~~~~~~~~
 input.y:4.1-15: warning: deprecated directive, use '%define api.value.type 
variant' [-Wdeprecated]
- %define variant
- ^~~~~~~~~~~~~~~
+    4 | %define variant
+      | ^~~~~~~~~~~~~~~
 input.y:5.1-34: warning: deprecated directive, use '%define api.parser.class 
{parser}' [-Wdeprecated]
- %define parser_class_name {parser}
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    5 | %define parser_class_name {parser}
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y:2.1-40: error: invalid value for %define Boolean variable 
'lr.keep-unreachable-state'
- %define lr.keep_unreachable_states maybe
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    2 | %define lr.keep_unreachable_states maybe
+      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 input.y: warning: fix-its can be applied.  Rerun with option '--update'. 
[-Wother]
 ]])
 
@@ -2143,20 +2143,20 @@ AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y || 
exit 77]])
 
 AT_BISON_CHECK([-fcaret empty.y], [1], [],
 [[empty.y:2.8-9: warning: empty character literal [-Wother]
- start: '';
-        ^~
+    2 | start: '';
+      |        ^~
 empty.y:3.8-4.0: error: missing "'" at end of line
- start: '
-        ^
+    3 | start: '
+      |        ^
 empty.y:3.8-4.0: warning: empty character literal [-Wother]
- start: '
-        ^
+    3 | start: '
+      |        ^
 empty.y:4.8: error: missing "'" at end of file
- start: '
-        ^
+    4 | start: '
+      |        ^
 empty.y:4.8: warning: empty character literal [-Wother]
- start: '
-        ^
+    4 | start: '
+      |        ^
 ]])
 
 AT_DATA([two.y],
@@ -2715,8 +2715,8 @@ exp: <int> {}
 
 AT_BISON_CHECK([[-fcaret input.y]], [[0]], [[]],
 [[input.y:10.6-13: warning: only midrule actions can be typed: int [-Wother]
- exp: <int> {}
-      ^~~~~~~~
+   10 | exp: <int> {}
+      |      ^~~~~~~~
 ]])
 
 AT_BISON_OPTION_POPDEFS
diff --git a/tests/java.at b/tests/java.at
index ee2bf082..29797154 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -35,8 +35,8 @@ exp:
 AT_BISON_CHECK([[-fcaret YYParser.y]], [1], [],
 [[YYParser.y: error: %defines does not make sense in Java
 YYParser.y:4.13-30: error: %destructor does not make sense in Java
- %destructor { /* Nothing. */ } exp
-             ^~~~~~~~~~~~~~~~~~
+    4 | %destructor { /* Nothing. */ } exp
+      |             ^~~~~~~~~~~~~~~~~~
 ]])
 
 AT_CLEANUP
diff --git a/tests/named-refs.at b/tests/named-refs.at
index 704600fe..fa67dbe5 100644
--- a/tests/named-refs.at
+++ b/tests/named-refs.at
@@ -253,38 +253,38 @@ exp:
 
 AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
 [[test.y:52.51-60: error: invalid reference: '$<ival>lo9'
- | exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
-                                                   ^~~~~~~~~~
+   52 | | exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
+      |                                                   ^~~~~~~~~~
 test.y:52.3-68:      symbol not found in production: lo9
- | exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
-   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   52 | | exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
+      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:53.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
- | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
-                                                   ^~~~~~~~~~
+   53 | | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
+      |                                                   ^~~~~~~~~~
 test.y:44.1-3:       refers to: $exp at $$
- exp:
- ^~~
+   44 | exp:
+      | ^~~
 test.y:53.7:         possibly meant: $x, hiding $exp at $1
- | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
-       ^
+   53 | | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
+      |       ^
 test.y:53.41:        possibly meant: $r, hiding $exp at $4
- | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
-                                         ^
+   53 | | exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
+      |                                         ^
 test.y:54.51-52: error: $l of 'exp' has no declared type
- | exp[x] '*' { $<ival>$ = $x; } [l] exp[r] { $$ = $l * $r; }
-                                                   ^~
+   54 | | exp[x] '*' { $<ival>$ = $x; } [l] exp[r] { $$ = $l * $r; }
+      |                                                   ^~
 test.y:57.40-43: error: invalid reference: '$r12'
- | exp[l] '^' exp[r]  { $$ = power ($l, $r12); }
-                                        ^~~~
+   57 | | exp[l] '^' exp[r]  { $$ = power ($l, $r12); }
+      |                                        ^~~~
 test.y:57.3-47:      symbol not found in production: r12
- | exp[l] '^' exp[r]  { $$ = power ($l, $r12); }
-   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   57 | | exp[l] '^' exp[r]  { $$ = power ($l, $r12); }
+      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:58.29-33: error: invalid reference: '$expo'
- | '(' exp ')'        { $$ = $expo;           }
-                             ^~~~~
+   58 | | '(' exp ')'        { $$ = $expo;           }
+      |                             ^~~~~
 test.y:58.3-46:      symbol not found in production: expo
- | '(' exp ')'        { $$ = $expo;           }
-   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   58 | | '(' exp ')'        { $$ = $expo;           }
+      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]])
 AT_BISON_OPTION_POPDEFS
 AT_CLEANUP
@@ -425,122 +425,122 @@ test.y:45.41-46:     possibly meant: $[then-a].f at $4
 
 AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
 [[test.y:24.36-41: error: invalid reference: '$cond1'
-           { $if_stmt1 = new IfStmt($cond1, $then.f1, $else); };
-                                    ^~~~~~
+   24 |           { $if_stmt1 = new IfStmt($cond1, $then.f1, $else); };
+      |                                    ^~~~~~
 test.y:23.11-24.62:  symbol not found in production: cond1
- if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   23 | if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:26.43-53: error: invalid reference: '$stmt.field'
-           { $if_stmt2 = new IfStmt($cond, $stmt.field, 0); };
-                                           ^~~~~~~~~~~
+   26 |           { $if_stmt2 = new IfStmt($cond, $stmt.field, 0); };
+      |                                           ^~~~~~~~~~~
 test.y:25.11-26.60:  symbol not found in production: stmt
- if_stmt2: IF expr[cond] THEN stmt[then] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   25 | if_stmt2: IF expr[cond] THEN stmt[then] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:25.35-38:     possibly meant: $then.field, hiding $stmt.field at $4
- if_stmt2: IF expr[cond] THEN stmt[then] FI
-                                   ^~~~
+   25 | if_stmt2: IF expr[cond] THEN stmt[then] FI
+      |                                   ^~~~
 test.y:28.43-52: error: invalid reference: '$stmt.list'
-           { $if_stmt3 = new IfStmt($cond, $stmt.list, 0); };
-                                           ^~~~~~~~~~
+   28 |           { $if_stmt3 = new IfStmt($cond, $stmt.list, 0); };
+      |                                           ^~~~~~~~~~
 test.y:27.11-28.59:  symbol not found in production: stmt
- if_stmt3: IF expr[cond] THEN stmt.list FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   27 | if_stmt3: IF expr[cond] THEN stmt.list FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:27.30-38:     possibly meant: $[stmt.list] at $4
- if_stmt3: IF expr[cond] THEN stmt.list FI
-                              ^~~~~~~~~
+   27 | if_stmt3: IF expr[cond] THEN stmt.list FI
+      |                              ^~~~~~~~~
 test.y:30.43-46: error: ambiguous reference: '$xyz'
-           { $if_stmt4 = new IfStmt($cond, $xyz, $cond); };
-                                           ^~~~
+   30 |           { $if_stmt4 = new IfStmt($cond, $xyz, $cond); };
+      |                                           ^~~~
 test.y:29.35-37:     refers to: $xyz at $4
- if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
-                                   ^~~
+   29 | if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
+      |                                   ^~~
 test.y:29.50-52:     refers to: $xyz at $6
- if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
-                                                  ^~~
+   29 | if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
+      |                                                  ^~~
 test.y:32.43-52: error: invalid reference: '$stmt.list'
-           { $if_stmt5 = new IfStmt($cond, $stmt.list, $else); };
-                                           ^~~~~~~~~~
+   32 |           { $if_stmt5 = new IfStmt($cond, $stmt.list, $else); };
+      |                                           ^~~~~~~~~~
 test.y:31.11-32.63:  symbol not found in production: stmt
- if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:31.40-43:     possibly meant: $then, hiding $[stmt.list] at $4
- if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                        ^~~~
+   31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                        ^~~~
 test.y:31.61-64:     possibly meant: $else, hiding $[stmt.list] at $6
- if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                                             ^~~~
+   31 | if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                                             ^~~~
 test.y:34.43-58: error: invalid reference: '$stmt.list.field'
-           { $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); };
-                                           ^~~~~~~~~~~~~~~~
+   34 |           { $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); };
+      |                                           ^~~~~~~~~~~~~~~~
 test.y:33.11-34.69:  symbol not found in production: stmt
- if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:33.40-43:     possibly meant: $then.field, hiding $[stmt.list].field at 
$4
- if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                        ^~~~
+   33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                        ^~~~
 test.y:33.61-64:     possibly meant: $else.field, hiding $[stmt.list].field at 
$6
- if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                                             ^~~~
+   33 | if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                                             ^~~~
 test.y:36.43-54: error: invalid reference: '$[stmt.list]'
-           { $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); };
-                                           ^~~~~~~~~~~~
+   36 |           { $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); 
};
+      |                                           ^~~~~~~~~~~~
 test.y:35.11-36.71:  symbol not found in production: stmt.list
- if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:35.40-43:     possibly meant: $then, hiding $[stmt.list] at $4
- if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                        ^~~~
+   35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                        ^~~~
 test.y:35.61-64:     possibly meant: $else, hiding $[stmt.list] at $6
- if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-                                                             ^~~~
+   35 | if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |                                                             ^~~~
 test.y:38.43-49: error: invalid reference: '$then.1'
-           { $if_stmt8 = new IfStmt($cond, $then.1, $else); };
-                                           ^~~~~~~
+   38 |           { $if_stmt8 = new IfStmt($cond, $then.1, $else); };
+      |                                           ^~~~~~~
 test.y:37.11-38.60:  symbol not found in production: then
- if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   37 | if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:37.40-45:     possibly meant: $[then.1] at $4
- if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
-                                        ^~~~~~
+   37 | if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
+      |                                        ^~~~~~
 test.y:40.43-55: error: invalid reference: '$then.1.field'
-           { $if_stmt9 = new IfStmt($cond, $then.1.field, $else); };
-                                           ^~~~~~~~~~~~~
+   40 |           { $if_stmt9 = new IfStmt($cond, $then.1.field, $else); };
+      |                                           ^~~~~~~~~~~~~
 test.y:39.11-40.66:  symbol not found in production: then
- if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
-           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   39 | if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
+      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:39.40-45:     possibly meant: $[then.1].field at $4
- if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
-                                        ^~~~~~
+   39 | if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
+      |                                        ^~~~~~
 test.y:42.44-50: error: invalid reference: '$stmt.x'
-           { $if_stmt10 = new IfStmt($cond, $stmt.x, 0); };
-                                            ^~~~~~~
+   42 |           { $if_stmt10 = new IfStmt($cond, $stmt.x, 0); };
+      |                                            ^~~~~~~
 test.y:41.12-42.57:  symbol not found in production: stmt
- if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
-            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
+      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:41.36-41:     possibly meant: $[stmt.x].x, hiding $stmt.x at $4
- if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
-                                    ^~~~~~
+   41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
+      |                                    ^~~~~~
 test.y:41.36-41:     possibly meant: $[stmt.x] at $4
- if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
-                                    ^~~~~~
+   41 | if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
+      |                                    ^~~~~~
 test.y:44.13-22: error: invalid reference: '$if-stmt-a'
-           { $if-stmt-a = new IfStmt($cond, $then, $else); };
-             ^~~~~~~~~~
+   44 |           { $if-stmt-a = new IfStmt($cond, $then, $else); };
+      |             ^~~~~~~~~~
 test.y:43.12-44.59:  symbol not found in production: if
- if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
-            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   43 | if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:43.1-9:       possibly meant: $[if-stmt-a] at $$
- if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
- ^~~~~~~~~
+   43 | if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
+      | ^~~~~~~~~
 test.y:46.46-54: error: invalid reference: '$then-a.f'
-           { $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else); };
-                                              ^~~~~~~~~
+   46 |           { $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else); };
+      |                                              ^~~~~~~~~
 test.y:45.12-46.65:  symbol not found in production: then
- if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
-            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   45 | if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
+      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 test.y:45.41-46:     possibly meant: $[then-a].f at $4
- if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
-                                         ^~~~~~
+   45 | if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
+      |                                         ^~~~~~
 ]])
 
 AT_BISON_OPTION_POPDEFS
diff --git a/tests/reduce.at b/tests/reduce.at
index 63fd5f37..fb098a61 100644
--- a/tests/reduce.at
+++ b/tests/reduce.at
@@ -147,32 +147,32 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
 [[input.y: warning: 9 nonterminals useless in grammar [-Wother]
 input.y: warning: 9 rules useless in grammar [-Wother]
 input.y:10.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
- useless1: '1';
- ^~~~~~~~
+   10 | useless1: '1';
+      | ^~~~~~~~
 input.y:11.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
- useless2: '2';
- ^~~~~~~~
+   11 | useless2: '2';
+      | ^~~~~~~~
 input.y:12.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
- useless3: '3';
- ^~~~~~~~
+   12 | useless3: '3';
+      | ^~~~~~~~
 input.y:13.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
- useless4: '4';
- ^~~~~~~~
+   13 | useless4: '4';
+      | ^~~~~~~~
 input.y:14.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
- useless5: '5';
- ^~~~~~~~
+   14 | useless5: '5';
+      | ^~~~~~~~
 input.y:15.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
- useless6: '6';
- ^~~~~~~~
+   15 | useless6: '6';
+      | ^~~~~~~~
 input.y:16.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
- useless7: '7';
- ^~~~~~~~
+   16 | useless7: '7';
+      | ^~~~~~~~
 input.y:17.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
- useless8: '8';
- ^~~~~~~~
+   17 | useless8: '8';
+      | ^~~~~~~~
 input.y:18.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
- useless9: '9';
- ^~~~~~~~
+   18 | useless9: '9';
+      | ^~~~~~~~
 ]])
 
 
@@ -262,8 +262,8 @@ AT_BISON_CHECK([[-fcaret -rall -o input.c input.y]], 0, [],
 [[input.y: warning: 1 nonterminal useless in grammar [-Wother]
 input.y: warning: 1 rule useless in grammar [-Wother]
 input.y:18.1-6: warning: nonterminal useless in grammar: unused [-Wother]
- unused
- ^~~~~~
+   18 | unused
+      | ^~~~~~
 ]])
 
 
@@ -342,14 +342,14 @@ AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
 [[not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
 not-reduced.y: warning: 3 rules useless in grammar [-Wother]
 not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable 
[-Wother]
- not_reachable: useful  { /* A not reachable action. */ }
- ^~~~~~~~~~~~~
+   14 | not_reachable: useful  { /* A not reachable action. */ }
+      | ^~~~~~~~~~~~~
 not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive 
[-Wother]
- non_productive: non_productive useless_token
- ^~~~~~~~~~~~~~
+   17 | non_productive: non_productive useless_token
+      | ^~~~~~~~~~~~~~
 not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
-    | non_productive    { /* A non productive action. */ }
-      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   11 |    | non_productive    { /* A non productive action. */ }
+      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]])
 
 AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
@@ -421,14 +421,14 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
 [[input.y: warning: 2 nonterminals useless in grammar [-Wother]
 input.y: warning: 3 rules useless in grammar [-Wother]
 input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother]
- underivable: indirection;
- ^~~~~~~~~~~
+    6 | underivable: indirection;
+      | ^~~~~~~~~~~
 input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother]
- indirection: underivable;
- ^~~~~~~~~~~
+    7 | indirection: underivable;
+      | ^~~~~~~~~~~
 input.y:5.15-25: warning: rule useless in grammar [-Wother]
- exp: useful | underivable;
-               ^~~~~~~~~~~
+    5 | exp: useful | underivable;
+      |               ^~~~~~~~~~~
 ]])
 
 AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
diff --git a/tests/regression.at b/tests/regression.at
index abbafe49..bf0b4754 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -404,11 +404,11 @@ input.y:22.16-63: warning: symbol 
"\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], [[0]], [[]],
 [[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
- %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
-        ^~~~~~~
+   22 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
+      |        ^~~~~~~
 input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" 
used more than once as a literal string [-Wother]
- %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
-                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   22 | %token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
+      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ]])
 AT_COMPILE([input])
 
diff --git a/tests/sets.at b/tests/sets.at
index 60c32767..2c173673 100644
--- a/tests/sets.at
+++ b/tests/sets.at
@@ -327,20 +327,20 @@ term: 'n'
 AT_BISON_CHECK([[-fcaret input.y]], [], [],
 [[input.y: warning: 5 reduce/reduce conflicts [-Wconflicts-rr]
 input.y:2.14-17: warning: rule useless in parser due to conflicts [-Wother]
- expr: term | term | term | term | term | term
-              ^~~~
+    2 | expr: term | term | term | term | term | term
+      |              ^~~~
 input.y:2.21-24: warning: rule useless in parser due to conflicts [-Wother]
- expr: term | term | term | term | term | term
-                     ^~~~
+    2 | expr: term | term | term | term | term | term
+      |                     ^~~~
 input.y:2.28-31: warning: rule useless in parser due to conflicts [-Wother]
- expr: term | term | term | term | term | term
-                            ^~~~
+    2 | expr: term | term | term | term | term | term
+      |                            ^~~~
 input.y:2.35-38: warning: rule useless in parser due to conflicts [-Wother]
- expr: term | term | term | term | term | term
-                                   ^~~~
+    2 | expr: term | term | term | term | term | term
+      |                                   ^~~~
 input.y:2.42-45: warning: rule useless in parser due to conflicts [-Wother]
- expr: term | term | term | term | term | term
-                                          ^~~~
+    2 | expr: term | term | term | term | term | term
+      |                                          ^~~~
 ]])
 
 AT_CLEANUP




reply via email to

[Prev in Thread] Current Thread [Next in Thread]