Files
bison/src
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-01-05 14:58:05 +01:00
2019-10-02 17:11:33 -07:00
2019-10-02 17:11:33 -07:00
2019-10-02 17:11:33 -07:00
2019-01-05 14:58:05 +01:00
2019-10-21 17:18:32 +02:00
2019-01-05 14:58:05 +01:00
2019-11-12 08:39:28 +01:00
2019-10-02 17:11:33 -07:00
2019-01-05 14:58:05 +01:00
2019-10-02 17:11:33 -07:00
2019-01-05 14:58:05 +01:00
2019-10-24 08:50:14 +02:00
2019-06-09 08:36:01 +02:00
2019-02-25 06:19:54 +01:00
2019-06-09 11:11:12 +02:00
2019-01-26 16:21:35 +01:00
2019-01-05 14:58:05 +01:00
2019-01-05 14:58:05 +01:00
2019-01-05 14:58:05 +01:00
2019-01-05 14:58:05 +01:00
2019-10-22 10:40:12 +02:00
2019-02-16 07:26:16 +01:00
2019-11-16 12:54:44 +01:00
2019-01-30 07:06:48 +01:00
2019-01-30 07:06:48 +01:00
2019-02-09 08:23:50 +01:00
2019-01-05 14:58:05 +01:00
2019-10-02 17:11:33 -07:00
2019-10-02 17:11:33 -07:00
2019-10-02 17:11:33 -07:00
2019-02-27 19:06:32 +01:00
2019-01-05 14:58:05 +01:00
2019-01-05 14:58:05 +01:00
2008-11-15 10:47:15 +01:00
2019-01-05 14:58:05 +01:00
2008-11-15 10:47:15 +01:00
2008-11-15 10:47:15 +01:00
2019-01-05 14:58:05 +01:00
2019-10-02 17:11:33 -07:00
2019-09-11 09:07:27 +02:00
2019-10-29 09:00:46 +01:00
2019-10-02 17:11:33 -07:00
2019-10-02 17:11:33 -07:00
2019-09-11 09:07:27 +02:00
2019-01-05 14:58:05 +01:00
2019-01-12 10:45:21 +01:00