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

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

Issue 1776953002: [regexp] allow loose matching for property names. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/char-predicates-inl.h ('k') | test/mjsunit/harmony/regexp-property-general-category.js » ('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/regexp/regexp-parser.h" 5 #include "src/regexp/regexp-parser.h"
6 6
7 #include "src/char-predicates-inl.h" 7 #include "src/char-predicates-inl.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 833 }
834 Reset(start); 834 Reset(start);
835 } 835 }
836 return result; 836 return result;
837 } 837 }
838 838
839 ZoneList<CharacterRange>* RegExpParser::ParsePropertyClass() { 839 ZoneList<CharacterRange>* RegExpParser::ParsePropertyClass() {
840 #ifdef V8_I18N_SUPPORT 840 #ifdef V8_I18N_SUPPORT
841 ZoneList<char> property_name(0, zone()); 841 ZoneList<char> property_name(0, zone());
842 if (current() == '{') { 842 if (current() == '{') {
843 for (Advance(); IsAlpha(current()); Advance()) { 843 for (Advance(); current() != '}'; Advance()) {
844 if (!has_next()) return nullptr;
844 property_name.Add(static_cast<char>(current()), zone()); 845 property_name.Add(static_cast<char>(current()), zone());
845 } 846 }
846 if (current() != '}') return nullptr; 847 } else if (current() != kEndMarker) {
847 } else if (IsAlpha(current())) {
848 property_name.Add(static_cast<char>(current()), zone()); 848 property_name.Add(static_cast<char>(current()), zone());
849 } else { 849 } else {
850 return nullptr; 850 return nullptr;
851 } 851 }
852 Advance(); 852 Advance();
853 property_name.Add(0, zone()); // null-terminate string. 853 property_name.Add(0, zone()); // null-terminate string.
854 854
855 // Property names are defined in unicode database files. For aliases of 855 // Property names are defined in unicode database files. For aliases of
856 // these property names, see PropertyValueAliases.txt. 856 // these property names, see PropertyValueAliases.txt.
857 UProperty kPropertyClasses[] = { 857 UProperty kPropertyClasses[] = {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 return false; 1450 return false;
1451 } 1451 }
1452 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), 1452 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom),
1453 zone()); 1453 zone());
1454 LAST(ADD_TERM); 1454 LAST(ADD_TERM);
1455 return true; 1455 return true;
1456 } 1456 }
1457 1457
1458 } // namespace internal 1458 } // namespace internal
1459 } // namespace v8 1459 } // namespace v8
OLDNEW
« no previous file with comments | « src/char-predicates-inl.h ('k') | test/mjsunit/harmony/regexp-property-general-category.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698