| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #library("dart:coreimpl"); | 5 #library("dart:coreimpl"); |
| 6 | 6 |
| 7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); | 7 #source("../../corelib/src/implementation/dual_pivot_quicksort.dart"); |
| 8 #source("../../corelib/src/implementation/duration_implementation.dart"); | 8 #source("../../corelib/src/implementation/duration_implementation.dart"); |
| 9 #source("../../corelib/src/implementation/exceptions.dart"); | 9 #source("../../corelib/src/implementation/exceptions.dart"); |
| 10 #source("../../corelib/src/implementation/future_implementation.dart"); | 10 #source("../../corelib/src/implementation/future_implementation.dart"); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 Match firstMatch(String str) native | 248 Match firstMatch(String str) native |
| 249 '''var m = this.re.exec(str); | 249 '''var m = this.re.exec(str); |
| 250 return m && new MatchImplementation( | 250 return m && new MatchImplementation( |
| 251 this.pattern, str, m.index, this.re.lastIndex, m);'''; | 251 this.pattern, str, m.index, this.re.lastIndex, m);'''; |
| 252 | 252 |
| 253 bool hasMatch(String str) native "return this.re.test(str);"; | 253 bool hasMatch(String str) native "return this.re.test(str);"; |
| 254 | 254 |
| 255 String stringMatch(String str) { | 255 String stringMatch(String str) { |
| 256 var match = firstMatch(str); | 256 var match = firstMatch(str); |
| 257 return match && match.group(0); | 257 return match === null ? null : match.group(0); |
| 258 } | 258 } |
| 259 | 259 |
| 260 Iterable<Match> allMatches(String str) => new _AllMatchesIterable(this, str); | 260 Iterable<Match> allMatches(String str) => new _AllMatchesIterable(this, str); |
| 261 } | 261 } |
| 262 | 262 |
| 263 class MatchImplementation implements Match { | 263 class MatchImplementation implements Match { |
| 264 const MatchImplementation( | 264 const MatchImplementation( |
| 265 String this.pattern, | 265 String this.pattern, |
| 266 String this.str, | 266 String this.str, |
| 267 int this._start, | 267 int this._start, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } else if (isNaN()) { | 406 } else if (isNaN()) { |
| 407 if (other.isNaN()) { | 407 if (other.isNaN()) { |
| 408 return 0; | 408 return 0; |
| 409 } | 409 } |
| 410 return 1; | 410 return 1; |
| 411 } else { | 411 } else { |
| 412 return -1; | 412 return -1; |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 } | 415 } |
| OLD | NEW |