Reducing duplication in grammar
This commit is contained in:
parent
281ca50d32
commit
9e6f066763
@ -24,18 +24,18 @@ grammar JavascriptRegexp
|
||||
/ charset_literal <Literal>
|
||||
charset_escape <- "\\" esc:(
|
||||
code:[bdDfnrsStvwW] arg:""?
|
||||
/ code:"c" arg:[a-zA-Z]
|
||||
/ code:"0" arg:[0-7]+
|
||||
/ code:"x" arg:( [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"u" arg:( [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"0" arg:""? )
|
||||
/ control_escape
|
||||
/ octal_escape
|
||||
/ hex_escape
|
||||
/ unicode_escape
|
||||
/ null_escape )
|
||||
charset_range_escape <- "\\" esc:(
|
||||
code:[bfnrtv] arg:""?
|
||||
/ code:"c" arg:[a-zA-Z]
|
||||
/ code:"0" arg:[0-7]+
|
||||
/ code:"x" arg:( [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"u" arg:( [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"0" arg:""? )
|
||||
/ control_escape
|
||||
/ octal_escape
|
||||
/ hex_escape
|
||||
/ unicode_escape
|
||||
/ null_escape )
|
||||
charset_literal <- ( ""? literal:[^\\\]] )
|
||||
/ ( literal:"\\" &"c" )
|
||||
/ ( "\\" literal:[^bdDfnrsStvwW] )
|
||||
@ -44,11 +44,17 @@ grammar JavascriptRegexp
|
||||
/ literal <Literal>
|
||||
escape <- "\\" esc:(
|
||||
code:[bBdDfnrsStvwW1-9] arg:""?
|
||||
/ code:"c" arg:[a-zA-Z]
|
||||
/ code:"0" arg:[0-7]+
|
||||
/ code:"x" arg:( [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"u" arg:( [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] )
|
||||
/ code:"0" arg:""? )
|
||||
/ control_escape
|
||||
/ octal_escape
|
||||
/ hex_escape
|
||||
/ unicode_escape
|
||||
/ null_escape )
|
||||
literal <- ( ""? literal:[^|\\/.\[\(\)?+*$^] )
|
||||
/ ( literal:"\\" &"c" )
|
||||
/ ( "\\" literal:. )
|
||||
|
||||
control_escape <- code:"c" arg:[a-zA-Z]
|
||||
octal_escape <- code:"0" arg:[0-7]+
|
||||
hex_escape <- code:"x" arg:( [0-9a-fA-F] [0-9a-fA-F] )
|
||||
unicode_escape <- code:"u" arg:( [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] )
|
||||
null_escape <- code:"0" arg:""?
|
||||
|
Loading…
Reference in New Issue
Block a user