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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 RegExpTree* tree = parser.ParsePattern(); | 1057 RegExpTree* tree = parser.ParsePattern(); |
1058 ASSERT(tree != NULL); | 1058 ASSERT(tree != NULL); |
1059 ASSERT(result->error.IsNull()); | 1059 ASSERT(result->error.IsNull()); |
1060 result->tree = tree; | 1060 result->tree = tree; |
1061 intptr_t capture_count = parser.captures_started(); | 1061 intptr_t capture_count = parser.captures_started(); |
1062 result->simple = tree->IsAtom() && parser.simple() && capture_count == 0; | 1062 result->simple = tree->IsAtom() && parser.simple() && capture_count == 0; |
1063 result->contains_anchor = parser.contains_anchor(); | 1063 result->contains_anchor = parser.contains_anchor(); |
1064 result->capture_count = capture_count; | 1064 result->capture_count = capture_count; |
1065 } else { | 1065 } else { |
1066 ASSERT(!result->error.IsNull()); | 1066 ASSERT(!result->error.IsNull()); |
1067 Isolate::Current()->object_store()->clear_sticky_error(); | 1067 Thread::Current()->clear_sticky_error(); |
1068 | 1068 |
1069 // Throw a FormatException on parsing failures. | 1069 // Throw a FormatException on parsing failures. |
1070 const String& message = String::Handle( | 1070 const String& message = String::Handle( |
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 |