Commit fe331e4f authored by POTTIER Francois's avatar POTTIER Francois

Plug in [SelectiveExpansion] and [Drop] instead of [ExpandParameterizedGrammar].…

Plug in [SelectiveExpansion] and [Drop] instead of [ExpandParameterizedGrammar]. Update a few test cases whose output changes slightly.
parent 7a3fec56
......@@ -65,19 +65,19 @@ let parameterized_grammar =
(* ------------------------------------------------------------------------- *)
(* Check that the grammar is well-sorted. *)
(* Check that the grammar is well-sorted; infer the sort of every symbol. *)
let (_ : SortUnification.ground_sort StringMap.t) =
SortInference.infer_grammar parameterized_grammar
let sorts =
SortInference.infer parameterized_grammar
(* ------------------------------------------------------------------------- *)
(* Expand away all applications of parameterized nonterminal symbols, so as to
obtain a grammar without parameterized nonterminal symbols. *)
(* Expand away all applications of parameterized nonterminal symbols, so as
to obtain a grammar without parameterized nonterminal symbols. *)
let grammar =
CheckSafeParameterizedGrammar.check parameterized_grammar;
ExpandParameterizedGrammar.expand parameterized_grammar
Drop.drop (SelectiveExpansion.expand sorts parameterized_grammar)
let () =
Time.tick "Joining and expanding"
......
File "multiple-type-definition-modules-2.mly", line 1, characters 12-13:
Error: there are multiple %type declarations for nonterminal a.
File "multiple-type-definition-modules-1.mly", line 1, characters 11-12:
Error: there are multiple %type declarations for the symbol a.
File "multiple-type-definition.mly", line 2, characters 12-13:
Error: there are multiple %type declarations for nonterminal a.
File "multiple-type-definition.mly", line 1, characters 11-12:
Error: there are multiple %type declarations for the symbol a.
%start main
%token A [@foo "foo"] [@a 0]
%token B [@foo "foo"] [@b 0]
%token C [@bar "bar"] [@baz "baz"] [@c 0] [@d 1]
%token C [@baz "baz"] [@bar "bar"] [@c 0] [@d 1]
%type <unit> main
%[@claim "this is a grammar attribute"]
%%
......
File "unused-attribute.mly", line 2, characters 19-31:
Warning: this attribute could not be transferred to the symbol list(B)
File "../../src/standard.mly", line 183, characters 8-12:
Warning: symbol list(B) is unreachable from any of the start symbol(s).
Grammar has 2 nonterminal symbols, among which 1 start symbols.
Grammar has 3 terminal symbols.
Grammar has 3 productions.
......
File "unused-attribute.mly", line 2, characters 19-31:
Warning: this attribute could not be transferred to the symbol list(B)
File "../../src/standard.mly", line 183, characters 8-12:
Warning: symbol list(B) is unreachable from any of the start symbol(s).
%start main
%token A
%token B
......
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