Browse Source

allow \uXXXX in regexp

Nicolas Cannasse 13 năm trước cách đây
mục cha
commit
15b9e71c1f
2 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 1 0
      doc/CHANGES.txt
  2. 1 0
      lexer.mll

+ 1 - 0
doc/CHANGES.txt

@@ -27,6 +27,7 @@
 	all : fixed DCE removing empty but still used interfaces/superclasses
 	all : added haxe.Utf8 (crossplatform)
 	neko : Reflect now uses $fasthash (require neko 1.8.2)
+	all : allow \uXXXX in regexp (although not supported everywhere)
 
 2011-09-25: 2.08
 	js : added js.JQuery

+ 1 - 0
lexer.mll

@@ -292,6 +292,7 @@ and regexp = parse
 	| '\\' 't' { add "\t"; regexp lexbuf }
 	| '\\' ['\\' '$' '.' '*' '+' '^' '|' '{' '}' '[' ']' '(' ')' '?' '-' '0'-'9'] { add (lexeme lexbuf); regexp lexbuf }
 	| '\\' ['w' 'W' 'b' 'B' 's' 'S' 'd' 'D' 'x'] { add (lexeme lexbuf); regexp lexbuf }
+	| '\\' ['u' 'U'] ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F'] ['0'-'9' 'a'-'f' 'A'-'F'] { add (lexeme lexbuf); regexp lexbuf }
 	| '\\' [^ '\\'] { error (Invalid_character (lexeme lexbuf).[1]) (lexeme_end lexbuf - 1) }
 	| '/' { regexp_options lexbuf, lexeme_end lexbuf }
 	| [^ '\\' '/' '\r' '\n']+ { store lexbuf; regexp lexbuf }