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

Unified Diff: frog/leg/lib/regexp_helper.dart

Issue 9873021: Move frog/leg to lib/compiler/implementation. (Closed) Base URL: http://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 | « frog/leg/lib/native_helper.dart ('k') | frog/leg/lib/string_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/lib/regexp_helper.dart
===================================================================
--- frog/leg/lib/regexp_helper.dart (revision 5925)
+++ frog/leg/lib/regexp_helper.dart (working copy)
@@ -1,46 +0,0 @@
-// Copyright (c) 2012, 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.
-
-List regExpExec(JSSyntaxRegExp regExp, String str) {
- var nativeRegExp = regExpGetNative(regExp);
- var result = JS('List', @'#.exec(#)', nativeRegExp, str);
- if (JS('bool', @'# === null', result)) return null;
- return result;
-}
-
-bool regExpTest(JSSyntaxRegExp regExp, String str) {
- var nativeRegExp = regExpGetNative(regExp);
- return JS('bool', @'#.test(#)', nativeRegExp, str);
-}
-
-regExpGetNative(JSSyntaxRegExp regExp) {
- var r = JS('var', @'#._re', regExp);
- if (r === null) {
- r = JS('var', @'#._re = #', regExp, regExpMakeNative(regExp));
- }
- return r;
-}
-
-regExpAttachGlobalNative(JSSyntaxRegExp regExp) {
- JS('var', @'#._re = #', regExp, regExpMakeNative(regExp, global: true));
-}
-
-regExpMakeNative(JSSyntaxRegExp regExp, [bool global = false]) {
- String pattern = regExp.pattern;
- bool multiLine = regExp.multiLine;
- bool ignoreCase = regExp.ignoreCase;
- checkString(pattern);
- StringBuffer sb = new StringBuffer();
- if (multiLine) sb.add('m');
- if (ignoreCase) sb.add('i');
- if (global) sb.add('g');
- try {
- return JS('Object', @'new RegExp(#, #)', pattern, sb.toString());
- } catch (var e) {
- throw new IllegalJSRegExpException(pattern,
- JS('String', @'String(#)', e));
- }
-}
-
-int regExpMatchStart(m) => JS('int', @'#.index', m);
« no previous file with comments | « frog/leg/lib/native_helper.dart ('k') | frog/leg/lib/string_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698