Files
bison/tests
Akim Demaille 875ef1b90c symbol: use the first occurrence as an LHS as defining location
Currently on the following grammar:

    %type <foo> foo
    %%
    start: foo | bar | "baz"
    foo: foo
    bar: bar

bison reports:

    warning: 2 nonterminals useless in grammar [-Wother]
    warning: 4 rules useless in grammar [-Wother]
    1.13-15: warning: nonterminal useless in grammar: foo [-Wother]
     %type <foo> foo
                 ^^^
    3.14-16: warning: nonterminal useless in grammar: bar [-Wother]
     start: foo | bar | "baz"
                  ^^^
    [...]

i.e., the location of the first occurrence of a symbol is taken as its
definition point.  In the case of nonterminals, the first occurrence
as a left-hand side of a rule makes more sense:

    warning: 2 nonterminals useless in grammar [-Wother]
    warning: 4 rules useless in grammar [-Wother]
    4.1-3: warning: nonterminal useless in grammar: foo [-Wother]
     foo: foo
     ^^^
    5.1-3: warning: nonterminal useless in grammar: bar [-Wother]
     bar: bar
     ^^^
    [...]

* src/symtab.h, src/symtab.c (symbol::location_of_lhs): New.
(symbol_location_as_lhs_set): New.
* src/parse-gram.y (current_lhs): Use it.
* tests/reduce.at: Update locations.
2015-01-14 17:05:35 +01:00
..
2008-11-16 19:46:16 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00
2015-01-04 17:49:13 +01:00