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

Unified Diff: compiler/lib/implementation/regexp.js

Issue 9865025: Revert "Removes dartc reliance on its own libraries, now can be targeted at any implementation's li… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiler/lib/implementation/regexp.dart ('k') | compiler/lib/implementation/rtt.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/lib/implementation/regexp.js
diff --git a/compiler/lib/implementation/regexp.js b/compiler/lib/implementation/regexp.js
new file mode 100644
index 0000000000000000000000000000000000000000..f3cf249a6fe32c686b695653f75a1b195b76620e
--- /dev/null
+++ b/compiler/lib/implementation/regexp.js
@@ -0,0 +1,67 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+function native_JSSyntaxRegExp_firstMatch(str) {
+ var re = $DartRegExpToJSRegExp(this);
+ var m = re.exec(str);
+ if (m != null) {
+ var match = native_JSSyntaxMatch__new(this, str);
+ match.match_ = m;
+ match.lastIndex_ = re.lastIndex;
+ return match;
+ }
+ return $Dart$Null;
+}
+
+function native_JSSyntaxRegExp_hasMatch(str) {
+ return $DartRegExpToJSRegExp(this).test(str);
+}
+
+function native_JSSyntaxRegExp_stringMatch(str) {
+ var m = $DartRegExpToJSRegExp(this).exec(str);
+ return (m != null ? m[0] : $Dart$Null);
+}
+
+function native_JSSyntaxMatch_group(nb) {
+ return this.match_[nb];
+}
+
+function native_JSSyntaxMatch_groupCount() {
+ return this.match_.length;
+}
+
+function native_JSSyntaxMatch_start() {
+ return this.match_.index;
+}
+
+function native_JSSyntaxMatch_end() {
+ return this.lastIndex_;
+}
+
+function native__LazyAllMatchesIterator__jsInit(regExp) {
+ this.re = $DartRegExpToJSRegExp(regExp);
+}
+
+// The given RegExp is only used to initialize a new Match. We use the
+// cached JS regexp to compute the next match.
+function native__LazyAllMatchesIterator__computeNextMatch(regExp, str) {
+ var re = this.re;
+ if (re === null) return $Dart$Null;
+ var m = re.exec(str);
+ if (m == null) {
+ this.re = null;
+ return $Dart$Null;
+ }
+ var match = native_JSSyntaxMatch__new(regExp, str);
+ match.match_ = m;
+ match.lastIndex_ = re.lastIndex;
+ return match;
+}
+
+function $DartRegExpToJSRegExp(exp) {
+ var flags = "g";
+ if (native_JSSyntaxRegExp__multiLine(exp)) flags += "m";
+ if (native_JSSyntaxRegExp__ignoreCase(exp)) flags += "i";
+ return new RegExp(native_JSSyntaxRegExp__pattern(exp), flags);
+}
« no previous file with comments | « compiler/lib/implementation/regexp.dart ('k') | compiler/lib/implementation/rtt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698