Skip to content
Browse files

[fix] parser,dom,ident: accept minus in dom ident syntactic sugar

  • Loading branch information...
1 parent eea542f commit ce762a12d8258952568226b5f3cd71ab4ecc812c @OpaOnWindowsNow OpaOnWindowsNow committed Feb 20, 2012
View
4 opalang/classic_syntax/opa_lexer.trx
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of OPA.
@@ -173,6 +173,7 @@ underscore<- spacing underscore_nosp $
alias <- spacing alias_nosp $
dots <- spacing dots_nosp $
assign <- spacing assign_nosp $
+sharp <- spacing sharp_nosp $
larrow_nosp <- "<-" $
rarrow_nosp <- "->" $
@@ -193,6 +194,7 @@ underscore_nosp<- '_' $
alias_nosp <- "as" $
dots_nosp <- "..."$
assign_nosp <- '=' ![=] $
+sharp_nosp <- '#' $
#
# Identifiers
View
17 opalang/classic_syntax/opa_parser.trx
@@ -805,15 +805,13 @@ just_expr_before_possible_function_call <-
(**
{7 Id}
*)
-id <- (=careful_deco("#")):p deco_ml_identifier_nosp:s
- {{ undecorate ((Ident "$",label p) & [string2 s]) }}
- / (=careful_deco("#")):p opa_in_braces_nosp:e
- {{ undecorate ((Ident "$",label p) & [e]) }}
-naked_id <-
- (=careful_deco("#")):p deco_ml_identifier_nosp:s
- {{ string2 s }}
- / (=careful_deco("#")):p opa_in_braces_nosp:e
- {{ e }}
+id <- (=deco(naked_id)):i
+{{ let (id,_) = i in undecorate ((Ident "$",label i) & [id]) }}
+
+naked_id <- sharp (
+ / (=careful_deco(Xml.sname)):s {{ string2 s }}
+ / opa_in_braces_nosp:e {{ e }}
+ ):id {{ id }}
(**
{7 Pattern matching}
@@ -1269,6 +1267,7 @@ underscore <- Opa_lexer.underscore $
alias <- Opa_lexer.alias $
dots <- Opa_lexer.dots $
assign <- Opa_lexer.assign $
+sharp <- Opa_lexer.sharp $
(**
{6 Meta-rules}
View
2 opalang/js_syntax/opa_lexer.trx
@@ -176,6 +176,7 @@ underscore<- spacing underscore_nosp $
alias <- spacing alias_nosp $
dots <- spacing dots_nosp $
assign <- spacing assign_nosp $
+sharp <- spacing sharp_nosp $
larrow_nosp <- "<-" $
rarrow_nosp <- "->" $
@@ -197,6 +198,7 @@ alias_nosp <- "as" $
or_nosp <- "or" $
dots_nosp <- "..."$
assign_nosp <- '=' ![=] $
+sharp_nosp <- '#' $
#
# Identifiers
View
17 opalang/js_syntax/opa_parser.trx
@@ -1337,15 +1337,13 @@ just_expr_before_possible_function_call <-
(**
{7 Id}
*)
-id <- (=careful_deco("#")):p deco_ml_identifier_nosp:s
- {{ undecorate ((Ident "$",label p) & [string2 s]) }}
- / (=careful_deco("#")):p opa_in_braces_nosp:e
- {{ undecorate ((Ident "$",label p) & [e]) }}
-naked_id <-
- (=careful_deco("#")):p deco_ml_identifier_nosp:s
- {{ string2 s }}
- / (=careful_deco("#")):p opa_in_braces_nosp:e
- {{ e }}
+id <- (=deco(naked_id)):i
+{{ let (id,_) = i in
+ undecorate ((Ident "$",label i) & [id]) }}
+naked_id <- sharp (
+ / (=careful_deco(Xml.sname)):s {{ string2 s }}
+ / opa_in_braces_nosp:e {{ e }}
+ ):id {{ id }}
(**
{7 Ip address}
@@ -1488,6 +1486,7 @@ underscore <- Opa_lexer.underscore $
alias <- Opa_lexer.alias $
dots <- Opa_lexer.dots $
assign <- Opa_lexer.assign $
+sharp <- Opa_lexer.sharp $
(**
{6 Meta-rules}

0 comments on commit ce762a1

Please sign in to comment.
Something went wrong with that request. Please try again.