Files
bison/tests
Akim Demaille 28d1ca8f48 diagnostics: yacc reserves %type to nonterminals
On

    %token TOKEN1
    %type  <ival> TOKEN1 TOKEN2 't'
    %token TOKEN2
    %%
    expr:

bison -Wyacc gives

    input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
        2 | %type  <ival> TOKEN1 TOKEN2 't'
          |               ^~~~~~
    input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
        2 | %type  <ival> TOKEN1 TOKEN2 't'
          |                             ^~~
    input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
        2 | %type  <ival> TOKEN1 TOKEN2 't'
          |                      ^~~~~~

The messages appear to be out of order, but they are emitted when the
error is found.

* src/symtab.h (symbol_class): Add pct_type_sym, used to denote
symbols appearing in %type.
* src/symtab.c (complain_pct_type_on_token): New.
(symbol_class_set): Check that %type is not applied to tokens.
(symbol_check_defined): pct_type_sym also means undefined.
* src/parse-gram.y (symbol_decl.1): Set the class to pct_type_sym.
* src/reader.c (grammar_current_rule_begin): pct_type_sym also means
undefined.
* tests/input.at (Yacc's %type): New.
2019-11-17 09:45:25 +01:00
..
2019-02-21 06:46:07 +01:00
2019-11-02 16:40:50 +01:00
2019-10-10 17:53:48 +02:00
2019-11-01 12:04:13 +01:00
2019-10-13 09:22:05 +02:00
2019-10-13 09:22:05 +02:00
2019-08-09 06:40:38 -05:00
2019-11-02 16:40:50 +01:00
2019-04-24 13:21:24 +02:00
2019-11-02 16:40:50 +01:00
2019-11-02 16:40:50 +01:00
2019-06-19 19:15:31 +02:00
2019-09-14 10:09:08 +02:00
2019-10-17 11:51:20 -07:00
2019-10-13 09:22:05 +02:00
2019-02-21 17:46:11 +01:00
2019-04-23 18:29:10 +02:00
2019-02-09 08:23:50 +01:00
2019-10-17 11:51:20 -07:00
2019-09-14 09:55:17 +02:00
2019-11-03 10:32:22 +01:00
2019-11-02 16:40:50 +01:00
2019-11-02 16:40:50 +01:00