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

Side by Side Diff: src/regexp/regexp-ast.cc

Issue 1578253005: [regexp] implement character classes for unicode regexps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: more tests 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 unified diff | Download patch
« no previous file with comments | « src/regexp/regexp-ast.h ('k') | src/regexp/regexp-parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ostreams.h" 5 #include "src/ostreams.h"
6 #include "src/regexp/regexp-ast.h" 6 #include "src/regexp/regexp-ast.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 for (int i = 0; i < that->nodes()->length(); i++) { 165 for (int i = 0; i < that->nodes()->length(); i++) {
166 os_ << " "; 166 os_ << " ";
167 that->nodes()->at(i)->Accept(this, data); 167 that->nodes()->at(i)->Accept(this, data);
168 } 168 }
169 os_ << ")"; 169 os_ << ")";
170 return NULL; 170 return NULL;
171 } 171 }
172 172
173 173
174 void RegExpUnparser::VisitCharacterRange(CharacterRange that) { 174 void RegExpUnparser::VisitCharacterRange(CharacterRange that) {
175 os_ << AsUC16(that.from()); 175 os_ << AsUC32(that.from());
176 if (!that.IsSingleton()) { 176 if (!that.IsSingleton()) {
177 os_ << "-" << AsUC16(that.to()); 177 os_ << "-" << AsUC32(that.to());
178 } 178 }
179 } 179 }
180 180
181 181
182 void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that, 182 void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that,
183 void* data) { 183 void* data) {
184 if (that->is_negated()) os_ << "^"; 184 if (that->is_negated()) os_ << "^";
185 os_ << "["; 185 os_ << "[";
186 for (int i = 0; i < that->ranges(zone_)->length(); i++) { 186 for (int i = 0; i < that->ranges(zone_)->length(); i++) {
187 if (i > 0) os_ << " "; 187 if (i > 0) os_ << " ";
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 int node_min_match = node->min_match(); 328 int node_min_match = node->min_match();
329 min_match_ = IncreaseBy(min_match_, node_min_match); 329 min_match_ = IncreaseBy(min_match_, node_min_match);
330 int node_max_match = node->max_match(); 330 int node_max_match = node->max_match();
331 max_match_ = IncreaseBy(max_match_, node_max_match); 331 max_match_ = IncreaseBy(max_match_, node_max_match);
332 } 332 }
333 } 333 }
334 334
335 335
336 } // namespace internal 336 } // namespace internal
337 } // namespace v8 337 } // namespace v8
OLDNEW
« no previous file with comments | « src/regexp/regexp-ast.h ('k') | src/regexp/regexp-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698