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

Side by Side Diff: runtime/lib/regexp_patch.dart

Issue 11417058: Revert "Remove NullPointerException." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/lib/string.cc » ('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 4
5 patch class RegExp { 5 patch class RegExp {
6 /* patch */ factory RegExp(String pattern, 6 /* patch */ factory RegExp(String pattern,
7 {bool multiLine: false, 7 {bool multiLine: false,
8 bool ignoreCase: false}) { 8 bool ignoreCase: false}) {
9 return new _JSSyntaxRegExp(pattern, 9 return new _JSSyntaxRegExp(pattern,
10 multiLine: multiLine, 10 multiLine: multiLine,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 Match firstMatch(String str) { 71 Match firstMatch(String str) {
72 List match = _ExecuteMatch(str, 0); 72 List match = _ExecuteMatch(str, 0);
73 if (match == null) { 73 if (match == null) {
74 return null; 74 return null;
75 } 75 }
76 return new _JSRegExpMatch(this, str, match); 76 return new _JSRegExpMatch(this, str, match);
77 } 77 }
78 78
79 Iterable<Match> allMatches(String str) { 79 Iterable<Match> allMatches(String str) {
80 if (str is! String) throw new ArgumentError(str);
81 List<Match> result = new List<Match>(); 80 List<Match> result = new List<Match>();
82 int length = str.length; 81 int length = str.length;
83 int startIndex = 0; 82 int startIndex = 0;
84 while (true) { 83 while (true) {
85 List match = _ExecuteMatch(str, startIndex); 84 List match = _ExecuteMatch(str, startIndex);
86 if (match == null) { 85 if (match == null) {
87 break; 86 break;
88 } 87 }
89 result.add(new _JSRegExpMatch(this, str, match)); 88 result.add(new _JSRegExpMatch(this, str, match));
90 int endIndex = match[1]; 89 int endIndex = match[1];
(...skipping 25 matching lines...) Expand all
116 115
117 bool get multiLine native "JSSyntaxRegExp_multiLine"; 116 bool get multiLine native "JSSyntaxRegExp_multiLine";
118 117
119 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; 118 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase";
120 119
121 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; 120 int get _groupCount native "JSSyntaxRegExp_getGroupCount";
122 121
123 List _ExecuteMatch(String str, int start_index) 122 List _ExecuteMatch(String str, int start_index)
124 native "JSSyntaxRegExp_ExecuteMatch"; 123 native "JSSyntaxRegExp_ExecuteMatch";
125 } 124 }
OLDNEW
« no previous file with comments | « runtime/lib/regexp.cc ('k') | runtime/lib/string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698