Commit d881d53a authored by POTTIER Francois's avatar POTTIER Francois

Fix [Trim] by removing %type and %on_error_reduce declarations

for unreachable symbols.
parent 50c217d5
......@@ -433,7 +433,6 @@ type maybeInit =
%nonassoc QUEST IDENT CST_INT
%type <((string * Cil.formatArg) list -> Cil.exp) * (Cil.exp -> Cil.formatArg list option)> constant
%type <((string * Cil.formatArg) list -> Cil.exp) * (Cil.exp -> Cil.formatArg list option)> expression
%type <unit> initialize
%type <(Cil.location -> (string * Cil.formatArg) list -> Cil.instr) * (Cil.instr -> Cil.formatArg list option)> instr
%type <((string * Cil.formatArg) list -> Cil.lval) * (Cil.lval -> Cil.formatArg list option)> lval
%type <(Cil.typ -> (string * Cil.formatArg) list -> Cil.offset) * (Cil.offset -> Cil.formatArg list option)> offset
......
......@@ -183,7 +183,6 @@ module P = Parse_aux
%type <Ast0_cocci.rule> minus_main
%type <unit> never_used
%type <Ast0_cocci.rule> plus_main
%type <unit> reinit
%type <string * Ast_cocci.dependency list * string option> rule_name
%%
......
File "on-error-reduce-unreachable.mly", line 10, characters 0-3:
Warning: symbol bar is unreachable from any of the start symbol(s).
%token A B
%start<unit> main
%on_error_reduce bar
%%
main:
A B {}
bar:
A {}
File "on-error-reduce-unreachable.mly", line 10, characters 0-3:
Warning: symbol bar is unreachable from any of the start symbol(s).
%start main
%token B
%token A
%type <unit> main
%%
main:
_1 = A _2 = B
{ ()}
%%
......@@ -6,7 +6,6 @@ Warning: symbol s is unreachable from any of the start symbol(s).
%token A
%type <unit> dummy
%type <unit> s
%%
dummy:
......
......@@ -35,5 +35,8 @@ let trim grammar =
"symbol %s is unreachable from any of the start symbol(s)."
symbol
) grammar.rules;
{ grammar with rules = StringMap.restrict reachable grammar.rules }
{ grammar with
rules = StringMap.restrict reachable grammar.rules;
types = StringMap.restrict reachable grammar.types;
on_error_reduce = StringMap.restrict reachable grammar.on_error_reduce;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment