OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/longjump.h" | 5 #include "vm/longjump.h" |
6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
7 #include "vm/regexp_parser.h" | 7 #include "vm/regexp_parser.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 is_scanned_for_captures_(false), | 213 is_scanned_for_captures_(false), |
214 failed_(false) { | 214 failed_(false) { |
215 Advance(); | 215 Advance(); |
216 } | 216 } |
217 | 217 |
218 | 218 |
219 bool RegExpParser::ParseFunction(ParsedFunction *parsed_function) { | 219 bool RegExpParser::ParseFunction(ParsedFunction *parsed_function) { |
220 VMTagScope tagScope(parsed_function->thread(), | 220 VMTagScope tagScope(parsed_function->thread(), |
221 VMTag::kCompileParseRegExpTagId); | 221 VMTag::kCompileParseRegExpTagId); |
222 Zone* zone = parsed_function->zone(); | 222 Zone* zone = parsed_function->zone(); |
223 JSRegExp& regexp = JSRegExp::Handle(parsed_function->function().regexp()); | 223 RegExp& regexp = RegExp::Handle(parsed_function->function().regexp()); |
224 | 224 |
225 const String& pattern = String::Handle(regexp.pattern()); | 225 const String& pattern = String::Handle(regexp.pattern()); |
226 const bool multiline = regexp.is_multi_line(); | 226 const bool multiline = regexp.is_multi_line(); |
227 | 227 |
228 RegExpCompileData* compile_data = new(zone) RegExpCompileData(); | 228 RegExpCompileData* compile_data = new(zone) RegExpCompileData(); |
229 if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) { | 229 if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) { |
230 // Parsing failures are handled in the JSRegExp factory constructor. | 230 // Parsing failures are handled in the RegExp factory constructor. |
231 UNREACHABLE(); | 231 UNREACHABLE(); |
232 } | 232 } |
233 | 233 |
234 regexp.set_num_bracket_expressions(compile_data->capture_count); | 234 regexp.set_num_bracket_expressions(compile_data->capture_count); |
235 if (compile_data->simple) { | 235 if (compile_data->simple) { |
236 regexp.set_is_simple(); | 236 regexp.set_is_simple(); |
237 } else { | 237 } else { |
238 regexp.set_is_complex(); | 238 regexp.set_is_complex(); |
239 } | 239 } |
240 | 240 |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 String::Concat(result->error, input)); | 1071 String::Concat(result->error, input)); |
1072 const Array& args = Array::Handle(Array::New(1)); | 1072 const Array& args = Array::Handle(Array::New(1)); |
1073 args.SetAt(0, message); | 1073 args.SetAt(0, message); |
1074 | 1074 |
1075 Exceptions::ThrowByType(Exceptions::kFormat, args); | 1075 Exceptions::ThrowByType(Exceptions::kFormat, args); |
1076 } | 1076 } |
1077 return !parser.failed(); | 1077 return !parser.failed(); |
1078 } | 1078 } |
1079 | 1079 |
1080 } // namespace dart | 1080 } // namespace dart |
OLD | NEW |