Permalink
Browse files

[fix] compiler, syntax: Adding local binding directives

  • Loading branch information...
1 parent 32ca507 commit 34dba1fd72614939e8ccdefd3714f9a0ffc0f983 @BourgerieQuentin BourgerieQuentin committed Feb 7, 2012
@@ -504,6 +504,8 @@ let one_declaration_directive (((dir:parsing_directive),l,lt), label) bindings =
(p,e)) bindings
let declaration_directive dirs bindings =
List.fold_right one_declaration_directive dirs bindings
+let declaration_directive_1 dirs binding =
+ List.hd (declaration_directive dirs [binding])
(*
@@ -373,6 +373,9 @@ val double_dot : (string, 'a) expr -> string -> (string, 'a) expr
val declaration_directive :
(parsing_directive * (string, parsing_directive) expr list * string ty list) label list ->
((_ * (string, parsing_directive) expr) list as 'a) -> 'a
+val declaration_directive_1 :
+ (parsing_directive * (string, parsing_directive) expr list * string ty list) label list ->
+ ((_ * (string, parsing_directive) expr) as 'a) -> 'a
(** Utils for parser_xml *)
@@ -510,9 +510,8 @@ db_options <-
Bindings or assimilated (like do)
*)
binding_pattern <-
- / binding_pattern_simple
- / binding_pattern_lambda
- / binding_pattern_module
+ local_binding_directives:dirs (binding_pattern_simple / binding_pattern_lambda / binding_pattern_module):bnd
+ {{ declaration_directive_1 dirs bnd }}
binding_pattern_simple <-
'var'? spacing pattern:p assign expr:e {{ (p,e) }}
@@ -539,9 +538,8 @@ binding_pattern_simple_rec <- binding_pattern_simple:b
}}
binding_pattern_rec <-
- / binding_pattern_module
- / binding_pattern_simple_rec
- / binding_pattern_lambda
+ local_binding_directives:dirs (binding_pattern_module / binding_pattern_simple_rec / binding_pattern_lambda):bnd
+ {{ declaration_directive_1 dirs bnd }}
binding_ident <-
/ binding_lambda
@@ -1125,10 +1123,10 @@ slicing_directive0 <-
closure_instrumentation_directive <- "public_env" {{ `public_env }}
-local_binding_directive <- "@" (=exact_ident(slicing_directive0
- /closure_instrumentation_directive)):v !"("
- {{ (v, [], []) }}
-local_binding_directives <- (=deco(local_binding_directive:v))*
+local_binding_directive <-
+ / declaration_directive0_slicing:v {{ (v, [], []) }}
+ / "@" (=exact_ident(closure_instrumentation_directive)):v !"(" {{ (v, [], []) }}
+local_binding_directives <- (=deco(local_binding_directive))*:v spacing {{ v }}
(**
{7 Directives}

0 comments on commit 34dba1f

Please sign in to comment.