Commit 1df26729 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Eliminate [expand_rule].

parent 379675e8
...@@ -366,21 +366,17 @@ let inline grammar = ...@@ -366,21 +366,17 @@ let inline grammar =
and expand_symbol symbol : rule = and expand_symbol symbol : rule =
let rule = find grammar symbol in let rule = find grammar symbol in
expand_rule symbol rule
(* Expand a rule if necessary. *)
and expand_rule k r =
try try
(match expanded_state k with (match expanded_state symbol with
| BeingExpanded -> | BeingExpanded ->
Error.error Error.error
r.positions rule.positions
"there is a cycle in the definition of %s." k "there is a cycle in the definition of %s." symbol
| Expanded r -> | Expanded r ->
r) r)
with Not_found -> with Not_found ->
mark_as_being_expanded k; mark_as_being_expanded symbol;
mark_as_expanded k { r with branches = r.branches >>= expand_branch } mark_as_expanded symbol { rule with branches = rule.branches >>= expand_branch }
in in
(* If we are in Coq mode, %inline is forbidden. *) (* If we are in Coq mode, %inline is forbidden. *)
......
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