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

Side by Side Diff: runtime/lib/regexp_jsc.cc

Issue 12317130: Remove deprecated IllegalJSRegExpException class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/regexp.cc ('k') | runtime/vm/exceptions.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // This file encapsulates all the interaction with the 4 // This file encapsulates all the interaction with the
5 // JSC regular expression library also referred to as pcre 5 // JSC regular expression library also referred to as pcre
6 6
7 #include "lib/regexp_jsc.h" 7 #include "lib/regexp_jsc.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 23 matching lines...) Expand all
34 34
35 35
36 static void JSREFree(void* ptr) { 36 static void JSREFree(void* ptr) {
37 USE(ptr); // Do nothing, memory is garbage collected. 37 USE(ptr); // Do nothing, memory is garbage collected.
38 } 38 }
39 39
40 40
41 static void ThrowExceptionOnError(const String& pattern, 41 static void ThrowExceptionOnError(const String& pattern,
42 const char* error_msg) { 42 const char* error_msg) {
43 if (error_msg == NULL) { 43 if (error_msg == NULL) {
44 error_msg = "Unknown regexp compile error"; 44 error_msg = "Unknown regexp compile error. ";
45 } 45 }
46 const String& errmsg = String::Handle(String::New(error_msg)); 46 const String& errmsg = String::Handle(String::New(error_msg));
47 const Array& args = Array::Handle(Array::New(2)); 47 const String& message = String::Handle(String::Concat(errmsg, pattern));
48 args.SetAt(0, pattern); 48 const Array& args = Array::Handle(Array::New(1));
49 args.SetAt(1, errmsg); 49 args.SetAt(0, message);
50 Exceptions::ThrowByType(Exceptions::kIllegalJSRegExp, args); 50 Exceptions::ThrowByType(Exceptions::kFormat, args);
51 } 51 }
52 52
53 53
54 RawJSRegExp* Jscre::Compile(const String& pattern, 54 RawJSRegExp* Jscre::Compile(const String& pattern,
55 bool multi_line, 55 bool multi_line,
56 bool ignore_case) { 56 bool ignore_case) {
57 // First convert the pattern to UTF16 format as the jscre library expects 57 // First convert the pattern to UTF16 format as the jscre library expects
58 // strings to be in UTF16 encoding. 58 // strings to be in UTF16 encoding.
59 uint16_t* two_byte_pattern = GetTwoByteData(pattern); 59 uint16_t* two_byte_pattern = GetTwoByteData(pattern);
60 60
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 i += kMatchPair) { 163 i += kMatchPair) {
164 start = Smi::New(offsets[i]); 164 start = Smi::New(offsets[i]);
165 end = Smi::New(offsets[i + 1]); 165 end = Smi::New(offsets[i + 1]);
166 array.SetAt(i, start); 166 array.SetAt(i, start);
167 array.SetAt(i+1, end); 167 array.SetAt(i+1, end);
168 } 168 }
169 return array.raw(); 169 return array.raw();
170 } 170 }
171 171
172 } // namespace dart 172 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/regexp.cc ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698