Răsfoiți Sursa

allowed 'u' utf8 for regexp

Nicolas Cannasse 18 ani în urmă
părinte
comite
ea14bb26be
2 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 1 1
      lexer.mll
  2. 1 0
      std/EReg.hx

+ 1 - 1
lexer.mll

@@ -265,7 +265,7 @@ and regexp = parse
 	| [^ '\\' '/' '\r' '\n']+ { store lexbuf; regexp lexbuf }
 	| [^ '\\' '/' '\r' '\n']+ { store lexbuf; regexp lexbuf }
 
 
 and regexp_options = parse
 and regexp_options = parse
-	| 'g' | 'i' | 'm' | 's' {
+	| 'g' | 'i' | 'm' | 's' | 'u' {
 			let l = lexeme lexbuf in
 			let l = lexeme lexbuf in
 			l ^ regexp_options lexbuf
 			l ^ regexp_options lexbuf
 		}
 		}

+ 1 - 0
std/EReg.hx

@@ -51,6 +51,7 @@ class EReg {
 			opt = a.join("");
 			opt = a.join("");
 		this.r = regexp_new_options(untyped r.__s, untyped opt.__s);
 		this.r = regexp_new_options(untyped r.__s, untyped opt.__s);
 		#else js
 		#else js
+		opt = opt.split("u").join(""); // 'u' (utf8) depends on page encoding
 		this.r = untyped __new__("RegExp",r,opt);
 		this.r = untyped __new__("RegExp",r,opt);
 		#else flash9
 		#else flash9
 		this.r = untyped __new__(__global__["RegExp"],r,opt);
 		this.r = untyped __new__(__global__["RegExp"],r,opt);