OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |