Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: regexp2000/src/parser.cc

Issue 8760: Experimental regexp: Use new RegExp parser to test syntax. (Closed)
Patch Set: Parses regexp using new parser. Rebased patch. Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « regexp2000/src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: regexp2000/src/parser.cc
diff --git a/regexp2000/src/parser.cc b/regexp2000/src/parser.cc
index 09fd1cafac302cca499d2330133bd4a5cf490af3..faca81ba52d0a99b57317dd7504683c596bf80fc 100644
--- a/regexp2000/src/parser.cc
+++ b/regexp2000/src/parser.cc
@@ -3820,6 +3820,7 @@ CharacterRange RegExpParser::ParseClassAtom(bool* ok) {
RegExpTree* RegExpParser::ParseCharacterClass(bool* ok) {
static const char* kUnterminated = "Unterminated character class";
static const char* kIllegal = "Illegal character class";
+ static const char* kRangeOutOfOrder = "Range out of order in character class";
ASSERT_EQ(current(), '[');
Advance();
@@ -3841,6 +3842,9 @@ RegExpTree* RegExpParser::ParseCharacterClass(bool* ok) {
if (next.is_character_class()) {
return ReportError(CStrVector(kIllegal), CHECK_OK);
}
+ if (first.from() > next.to()) {
+ ReportError(CStrVector(kRangeOutOfOrder), CHECK_OK);
+ }
ranges->Add(CharacterRange::Range(first.from(), next.to()));
} else {
ranges->Add(first);
« no previous file with comments | « regexp2000/src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698