OLD | NEW |
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 class _JSRegExpMatch implements Match { | 5 class _JSRegExpMatch implements Match { |
6 _JSRegExpMatch(this.regexp, this.str, this._match); | 6 _JSRegExpMatch(this.regexp, this.str, this._match); |
7 | 7 |
8 int get start => _start(0); | 8 int get start => _start(0); |
9 int get end => _end(0); | 9 int get end => _end(0); |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 String get pattern => regexp.pattern; | 47 String get pattern => regexp.pattern; |
48 | 48 |
49 final RegExp regexp; | 49 final RegExp regexp; |
50 final String str; | 50 final String str; |
51 final List<int> _match; | 51 final List<int> _match; |
52 static const int MATCH_PAIR = 2; | 52 static const int MATCH_PAIR = 2; |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 patch class JSSyntaxRegExp { | 56 patch class JSSyntaxRegExp { |
57 /* patch */ factory JSSyntaxRegExp( | 57 /* patch */ const factory JSSyntaxRegExp( |
58 String pattern, | 58 String pattern, |
59 {bool multiLine: false, | 59 {bool multiLine: false, |
60 bool ignoreCase: false}) native "JSSyntaxRegExp_factory"; | 60 bool ignoreCase: false}) native "JSSyntaxRegExp_factory"; |
61 | 61 |
62 /* patch */ Match firstMatch(String str) { | 62 /* patch */ Match firstMatch(String str) { |
63 List match = _ExecuteMatch(str, 0); | 63 List match = _ExecuteMatch(str, 0); |
64 if (match == null) { | 64 if (match == null) { |
65 return null; | 65 return null; |
66 } | 66 } |
67 return new _JSRegExpMatch(this, str, match); | 67 return new _JSRegExpMatch(this, str, match); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; | 108 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; |
109 | 109 |
110 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; | 110 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
111 | 111 |
112 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; | 112 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; |
113 | 113 |
114 List _ExecuteMatch(String str, int start_index) | 114 List _ExecuteMatch(String str, int start_index) |
115 native "JSSyntaxRegExp_ExecuteMatch"; | 115 native "JSSyntaxRegExp_ExecuteMatch"; |
116 } | 116 } |
OLD | NEW |