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

Unified Diff: src/parser.cc

Issue 9638: More automaton translation (Closed)
Patch Set: Created 12 years, 1 month 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 4d2aeba6396d8a31e5afa735ad138e6201d4ef10..164d09c83a289971f0d60f14e057c29dca64ecda 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -465,6 +465,8 @@ class RegExpParser {
bool HasCharacterEscapes();
+ int captures_started() { return captures_started_; }
+
static const uc32 kEndMarker = unibrow::Utf8::kBadChar;
private:
uc32 current() { return current_; }
@@ -4146,24 +4148,24 @@ ScriptDataImpl* PreParse(unibrow::CharacterStream* stream,
}
-RegExpTree* ParseRegExp(unibrow::CharacterStream* stream,
- Handle<String>* error,
- bool* has_character_escapes) {
- ASSERT(error->is_null());
- RegExpParser parser(stream, error, false); // Get multiline flag somehow
+bool ParseRegExp(unibrow::CharacterStream* stream, RegExpParseResult* result) {
+ ASSERT(result != NULL);
+ // Get multiline flag somehow
+ RegExpParser parser(stream, &result->error, false);
bool ok = true;
- RegExpTree* result = parser.ParsePattern(&ok);
+ result->tree = parser.ParsePattern(&ok);
if (!ok) {
- ASSERT(result == NULL);
- ASSERT(!error->is_null());
+ ASSERT(result->tree == NULL);
+ ASSERT(!result->error.is_null());
} else {
- ASSERT(result != NULL);
- ASSERT(error->is_null());
+ ASSERT(result->tree != NULL);
+ ASSERT(result->error.is_null());
}
- if (ok && has_character_escapes != NULL) {
- *has_character_escapes = parser.HasCharacterEscapes();
+ if (ok) {
+ result->has_character_escapes = parser.HasCharacterEscapes();
+ result->capture_count = parser.captures_started();
}
- return result;
+ return ok;
}
« src/jsregexp.cc ('K') | « src/parser.h ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698