mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
JavaScript: Distinguish {lo} and {lo,} in the regular expression parser.
This commit is contained in:
@@ -37,7 +37,7 @@ public class Main {
|
||||
* A version identifier that should be updated every time the extractor changes in such a way that
|
||||
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
|
||||
*/
|
||||
public static final String EXTRACTOR_VERSION = "2020-02-05";
|
||||
public static final String EXTRACTOR_VERSION = "2020-02-14";
|
||||
|
||||
public static final Pattern NEWLINE = Pattern.compile("\n");
|
||||
|
||||
|
||||
@@ -281,8 +281,19 @@ public class RegExpParser {
|
||||
if (this.match("+")) return this.finishTerm(new Plus(loc, atom, !this.match("?")));
|
||||
if (this.match("?")) return this.finishTerm(new Opt(loc, atom, !this.match("?")));
|
||||
if (this.match("{")) {
|
||||
Double lo = toNumber(this.readDigits(false)), hi = null;
|
||||
if (this.match(",") && !this.lookahead("}")) hi = toNumber(this.readDigits(false));
|
||||
Double lo = toNumber(this.readDigits(false)), hi;
|
||||
if (this.match(",")) {
|
||||
if (!this.lookahead("}")) {
|
||||
// atom{lo, hi}
|
||||
hi = toNumber(this.readDigits(false));
|
||||
} else {
|
||||
// atom{lo,}
|
||||
hi = null;
|
||||
}
|
||||
} else {
|
||||
// atom{lo}
|
||||
hi = lo;
|
||||
}
|
||||
this.expectRBrace();
|
||||
return this.finishTerm(new Range(loc, atom, !this.match("?"), lo, hi));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user