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

Unified Diff: src/jsregexp.cc

Issue 11204: Assertion interest (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
« no previous file with comments | « src/jsregexp.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index 82ac3d91e2eb544af1c9e1febb4785bc1f682db2..da69c7bf9467163af4665b9dddfc6d302468e8a4 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -1452,7 +1452,20 @@ RegExpNode* RegExpQuantifier::ToNode(int min,
RegExpNode* RegExpAssertion::ToNode(RegExpCompiler* compiler,
RegExpNode* on_success,
RegExpNode* on_failure) {
- // TODO(self): implement assertions.
+ switch (type()) {
+ case START_OF_LINE:
+ on_success->info()->follows_newline_interest = true;
+ break;
+ case START_OF_INPUT:
+ on_success->info()->follows_start_interest = true;
+ break;
+ case BOUNDARY: case NON_BOUNDARY:
+ on_success->info()->follows_word_interest = true;
+ break;
+ case END_OF_LINE: case END_OF_INPUT:
+ // This is wrong but has the effect of making the compiler abort.
+ on_success->info()->follows_start_interest = true;
+ }
return on_success;
}
@@ -1803,8 +1816,9 @@ void Analysis::VisitText(TextNode* that) {
void Analysis::VisitAction(ActionNode* that) {
RegExpNode* next = that->on_success();
EnsureAnalyzed(next);
- that->info()->propagate_line = next->info()->propagate_line;
+ that->info()->propagate_newline = next->info()->propagate_newline;
that->info()->propagate_word = next->info()->propagate_word;
+ that->info()->propagate_start = next->info()->propagate_start;
}
@@ -1813,8 +1827,9 @@ void Analysis::VisitChoice(ChoiceNode* that) {
for (int i = 0; i < that->alternatives()->length(); i++) {
RegExpNode* node = that->alternatives()->at(i).node();
EnsureAnalyzed(node);
- info->propagate_line |= node->info()->propagate_line;
+ info->propagate_newline |= node->info()->propagate_newline;
info->propagate_word |= node->info()->propagate_word;
+ info->propagate_start |= node->info()->propagate_start;
}
if (!that->table_calculated()) {
DispatchTableConstructor cons(that->table());
« no previous file with comments | « src/jsregexp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698