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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } else { | 68 } else { |
69 return kEndMarker; | 69 return kEndMarker; |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 void RegExpParser::Advance() { | 74 void RegExpParser::Advance() { |
75 if (has_next()) { | 75 if (has_next()) { |
76 StackLimitCheck check(isolate()); | 76 StackLimitCheck check(isolate()); |
77 if (check.HasOverflowed()) { | 77 if (check.HasOverflowed()) { |
78 ReportError(CStrVector(Isolate::kStackOverflowMessage)); | 78 ReportError(CStrVector( |
| 79 MessageTemplate::TemplateString(MessageTemplate::kStackOverflow))); |
79 } else if (zone()->excess_allocation()) { | 80 } else if (zone()->excess_allocation()) { |
80 ReportError(CStrVector("Regular expression too large")); | 81 ReportError(CStrVector("Regular expression too large")); |
81 } else { | 82 } else { |
82 current_ = ReadNext<true>(); | 83 current_ = ReadNext<true>(); |
83 } | 84 } |
84 } else { | 85 } else { |
85 current_ = kEndMarker; | 86 current_ = kEndMarker; |
86 // Advance so that position() points to 1-after-the-last-character. This is | 87 // Advance so that position() points to 1-after-the-last-character. This is |
87 // important so that Reset() to this position works correctly. | 88 // important so that Reset() to this position works correctly. |
88 next_pos_ = in()->length() + 1; | 89 next_pos_ = in()->length() + 1; |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 return false; | 1787 return false; |
1787 } | 1788 } |
1788 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), | 1789 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), |
1789 zone()); | 1790 zone()); |
1790 LAST(ADD_TERM); | 1791 LAST(ADD_TERM); |
1791 return true; | 1792 return true; |
1792 } | 1793 } |
1793 | 1794 |
1794 } // namespace internal | 1795 } // namespace internal |
1795 } // namespace v8 | 1796 } // namespace v8 |
OLD | NEW |