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