Commit 1542f265 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Renamings in [Action].

parent ab8b48b3
...@@ -59,7 +59,7 @@ type sw = ...@@ -59,7 +59,7 @@ type sw =
type keyword_renaming = type keyword_renaming =
string * sw * sw string * sw * sw
let rename_position_keyword let rename_position_keyword_outer
((psym, first_prod, last_prod) : keyword_renaming) ((psym, first_prod, last_prod) : keyword_renaming)
(subject, where) : sw = (subject, where) : sw =
match subject, where with match subject, where with
...@@ -70,7 +70,7 @@ let rename_position_keyword ...@@ -70,7 +70,7 @@ let rename_position_keyword
| WhereStart -> first_prod | WhereStart -> first_prod
| WhereEnd -> last_prod | WhereEnd -> last_prod
let rename_position_keyword_2 let rename_position_keyword_inner
((psym, first_prod, last_prod) : keyword_renaming) ((psym, first_prod, last_prod) : keyword_renaming)
(subject, where) : sw = (subject, where) : sw =
match subject, where with match subject, where with
...@@ -148,11 +148,11 @@ let rename f renaming phi a = ...@@ -148,11 +148,11 @@ let rename f renaming phi a =
keywords = keywords; keywords = keywords;
} }
let rename_inlined_psym = let rename_outer =
rename rename_position_keyword rename rename_position_keyword_outer
let rename = let rename_inner =
rename rename_position_keyword_2 rename rename_position_keyword_inner
let to_il_expr action = let to_il_expr action =
action.expr action.expr
......
...@@ -13,18 +13,18 @@ type sw = ...@@ -13,18 +13,18 @@ type sw =
type keyword_renaming = type keyword_renaming =
string * sw * sw string * sw * sw
(** [rename keyword_renaming phi a] builds the action (** [rename_inner keyword_renaming phi a] builds the action
[let x1 = x1' and ... xn = xn' in a] if [phi] is [(x1, x1') ... (xn, xn')]. [let x1 = x1' and ... xn = xn' in a] if [phi] is [(x1, x1') ... (xn, xn')].
Moreover, [renaming_env] is used to correctly replace $startpos/$endpos Moreover, [renaming_env] is used to correctly replace $startpos/$endpos
present in the semantic action. *) present in the semantic action. *)
val rename: val rename_inner:
keyword_renaming keyword_renaming
-> (string * string) list -> t -> t -> (string * string) list -> t -> t
(** [rename_inlined_psym keyword_renaming phi a] updates the occurrences of the (** [rename_outer keyword_renaming phi a] updates the occurrences of the
inlined non terminal in the action [a]. inlined non terminal in the action [a].
*) *)
val rename_inlined_psym: val rename_outer:
keyword_renaming keyword_renaming
-> (string * string) list -> t -> t -> (string * string) list -> t -> t
......
...@@ -138,10 +138,10 @@ let inline grammar = ...@@ -138,10 +138,10 @@ let inline grammar =
the first producer of the inlined branch if it is not empty or the first producer of the inlined branch if it is not empty or
the preceding producer found in the prefix. *) the preceding producer found in the prefix. *)
let outer_action = let outer_action =
Action.rename_inlined_psym renaming_env [] b.action Action.rename_outer renaming_env [] b.action
in in
let action' = let action' =
Action.rename renaming_env phi pb.action Action.rename_inner renaming_env phi pb.action
in in
{ b with { b with
......
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