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

Unified Diff: src/jsregexp.cc

Issue 1712013: Fix bug in word-boundary-lookahead followed by end-of-input assertion. (Closed)
Patch Set: Added more tests Created 10 years, 8 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 | « no previous file | src/regexp-macro-assembler-tracer.cc » ('j') | 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 0ae8bd34df23641bebf25bf497423e309c6d0119..9a1f1f114c0145de49657882f6df3868d5a8db78 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -4872,17 +4872,18 @@ void Analysis::VisitAssertion(AssertionNode* that) {
SetRelation word_relation =
CharacterRange::WordCharacterRelation(following_chars);
- if (word_relation.ContainedIn()) {
- // Following character is definitely a word character.
+ if (word_relation.Disjoint()) {
+ // Includes the case where following_chars is empty (e.g., end-of-input).
+ // Following character is definitely *not* a word character.
type = (type == AssertionNode::AT_BOUNDARY) ?
- AssertionNode::AFTER_NONWORD_CHARACTER :
- AssertionNode::AFTER_WORD_CHARACTER;
+ AssertionNode::AFTER_WORD_CHARACTER :
+ AssertionNode::AFTER_NONWORD_CHARACTER;
that->set_type(type);
- } else if (word_relation.Disjoint()) {
- // Following character is definitely *not* a word character.
+ } else if (word_relation.ContainedIn()) {
+ // Following character is definitely a word character.
type = (type == AssertionNode::AT_BOUNDARY) ?
- AssertionNode::AFTER_WORD_CHARACTER :
- AssertionNode::AFTER_NONWORD_CHARACTER;
+ AssertionNode::AFTER_NONWORD_CHARACTER :
+ AssertionNode::AFTER_WORD_CHARACTER;
that->set_type(type);
}
}
« no previous file with comments | « no previous file | src/regexp-macro-assembler-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698