Cleaning up some messy code in the grammar

This commit is contained in:
Jeff Avallone 2014-12-22 16:28:46 -05:00
parent 9e6f066763
commit a4f831bc60

View File

@ -12,10 +12,7 @@ grammar JavascriptRegexp
repeat_spec <- ( "{" min:[0-9]+ "," max:[0-9]+ "}" repeat_spec <- ( "{" min:[0-9]+ "," max:[0-9]+ "}"
/ "{" min:[0-9]+ ",}" / "{" min:[0-9]+ ",}"
/ "{" exact:[0-9]+ "}" ) <RepeatSpec> / "{" exact:[0-9]+ "}" ) <RepeatSpec>
subexp <- "(" capture:( subexp_no_capture / subexp_positive_lookahead / subexp_negative_lookahead )? regexp ")" <Subexp> subexp <- "(" capture:( "?:" / "?=" / "?!" )? regexp ")" <Subexp>
subexp_no_capture <- "?:"
subexp_positive_lookahead <- "?="
subexp_negative_lookahead <- "?!"
charset <- "[" invert:"^"? parts:( charset_range / charset_terminal )* "]" <Charset> charset <- "[" invert:"^"? parts:( charset_range / charset_terminal )* "]" <Charset>
charset_range <- first:charset_range_terminal "-" last:charset_range_terminal <CharsetRange> charset_range <- first:charset_range_terminal "-" last:charset_range_terminal <CharsetRange>
charset_terminal <- charset_escape <CharsetEscape> charset_terminal <- charset_escape <CharsetEscape>