mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: Extract surrogate pairs as one constant node
This commit is contained in:
@@ -489,6 +489,11 @@ public class RegExpParser {
|
||||
if (this.match("b")) return this.finishTerm(new ControlEscape(loc, "\b", 8, "\\b"));
|
||||
return this.finishTerm(this.parseAtomEscape(loc, true));
|
||||
}
|
||||
return this.finishTerm(new Constant(loc, String.valueOf(c)));
|
||||
String value = String.valueOf(c);
|
||||
// Extract a surrogate pair as a single constant.
|
||||
if (Character.isHighSurrogate(c) && Character.isLowSurrogate(peekChar(true))) {
|
||||
value += this.nextChar();
|
||||
}
|
||||
return this.finishTerm(new Constant(loc, value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@
|
||||
/[aaa]/;
|
||||
/[\x0a\x0a]/;
|
||||
/[\u000a\n]/;
|
||||
/[\u{ff}]/;
|
||||
/[\u{ff}]/;
|
||||
/[\u{12340}-\u{12345}]/u; // OK
|
||||
new RegExp("[\u{12340}-\u{12345}]", "u"); // OK
|
||||
|
||||
Reference in New Issue
Block a user