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

Unified Diff: src/regexp/regexp-parser.cc

Issue 1567413002: [regexp] simplify unicode flag check. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicoderegexpatom
Patch Set: Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/regexp-parser.cc
diff --git a/src/regexp/regexp-parser.cc b/src/regexp/regexp-parser.cc
index fd8906c79c394049778f8478697376fee53f79ce..728be5ba7b7b5bcc5e86a3699a70c82c90361648 100644
--- a/src/regexp/regexp-parser.cc
+++ b/src/regexp/regexp-parser.cc
@@ -343,7 +343,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
// escaped,
// no other identity escapes are allowed. If the 'u' flag is not
// present, all identity escapes are allowed.
- if (!FLAG_harmony_unicode_regexps || !unicode_) {
+ if (!unicode_) {
builder->AddCharacter(first_digit);
Advance(2);
} else {
@@ -404,7 +404,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
uc32 value;
if (ParseHexEscape(2, &value)) {
builder->AddCharacter(value);
- } else if (!FLAG_harmony_unicode_regexps || !unicode_) {
+ } else if (!unicode_) {
builder->AddCharacter('x');
} else {
// If the 'u' flag is present, invalid escapes are not treated as
@@ -418,7 +418,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
uc32 value;
if (ParseUnicodeEscape(&value)) {
builder->AddCharacter(value);
- } else if (!FLAG_harmony_unicode_regexps || !unicode_) {
+ } else if (!unicode_) {
builder->AddCharacter('u');
} else {
// If the 'u' flag is present, invalid escapes are not treated as
@@ -434,8 +434,7 @@ RegExpTree* RegExpParser::ParseDisjunction() {
// other identity escapes are allowed. If the 'u' flag is not
// present,
// all identity escapes are allowed.
- if (!FLAG_harmony_unicode_regexps || !unicode_ ||
- IsSyntaxCharacter(current())) {
+ if (!unicode_ || IsSyntaxCharacter(current())) {
builder->AddCharacter(current());
Advance();
} else {
@@ -736,7 +735,7 @@ bool RegExpParser::ParseUnicodeEscape(uc32* value) {
// Accept both \uxxxx and \u{xxxxxx} (if harmony unicode escapes are
// allowed). In the latter case, the number of hex digits between { } is
// arbitrary. \ and u have already been read.
- if (current() == '{' && FLAG_harmony_unicode_regexps && unicode_) {
+ if (current() == '{' && unicode_) {
int start = position();
Advance();
if (ParseUnlimitedLengthHexNumber(0x10ffff, value)) {
@@ -831,7 +830,7 @@ uc32 RegExpParser::ParseClassCharacterEscape() {
if (ParseHexEscape(2, &value)) {
return value;
}
- if (!FLAG_harmony_unicode_regexps || !unicode_) {
+ if (!unicode_) {
// If \x is not followed by a two-digit hexadecimal, treat it
// as an identity escape.
return 'x';
@@ -847,7 +846,7 @@ uc32 RegExpParser::ParseClassCharacterEscape() {
if (ParseUnicodeEscape(&value)) {
return value;
}
- if (!FLAG_harmony_unicode_regexps || !unicode_) {
+ if (!unicode_) {
return 'u';
}
// If the 'u' flag is present, invalid escapes are not treated as
@@ -860,8 +859,7 @@ uc32 RegExpParser::ParseClassCharacterEscape() {
// If the 'u' flag is present, only syntax characters can be escaped, no
// other identity escapes are allowed. If the 'u' flag is not present, all
// identity escapes are allowed.
- if (!FLAG_harmony_unicode_regexps || !unicode_ ||
- IsSyntaxCharacter(result)) {
+ if (!unicode_ || IsSyntaxCharacter(result)) {
Advance();
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698