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

Unified Diff: src/jsregexp.h

Issue 1114001: Refactoring of RegExp interface to better support calling several times in a row. (Closed)
Patch Set: Fix type that snuck into the commit. Created 10 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
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index 46d53c215e043087ae7fae8f1aac81f364ddb887..60212d4b18bcf4cc10270b9f5a34c9af7c2b541d 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -77,7 +77,7 @@ class RegExpImpl {
Handle<JSArray> lastMatchInfo);
// Prepares a JSRegExp object with Irregexp-specific data.
- static void IrregexpPrepare(Handle<JSRegExp> re,
+ static void IrregexpInitialize(Handle<JSRegExp> re,
Handle<String> pattern,
Erik Corry 2010/03/19 11:04:11 indent
Lasse Reichstein 2010/03/19 11:25:42 Done.
JSRegExp::Flags flags,
int capture_register_count);
@@ -93,6 +93,29 @@ class RegExpImpl {
int index,
Handle<JSArray> lastMatchInfo);
+ enum IrregexpResult { RE_FAILURE = 0, RE_SUCCESS = 1, RE_EXCEPTION = -1 };
+
+ // Prepare a RegExp for being executed one or more times (using
+ // IrregexpExecOnce) on the subject.
+ // This ensures that the regexp is compiled for the subject, and that
+ // the subject is flat.
+ // Returns the number of integer spaces required by IrregexpExecOnce
+ // as its "registers" argument. If the regexp cannot be compiled,
+ // an exeception is thrown, and this function returns negative.
Erik Corry 2010/03/19 11:04:11 Unclear comment. You can't both throw an exceptio
Lasse Reichstein 2010/03/19 11:25:42 Reworded.
+ static int IrregexpPrepare(Handle<JSRegExp> regexp,
+ Handle<String> subject);
+
+ // Execute a regular expression once on the subject, starting from
+ // character "index".
+ // If successful, returns RE_SUCCESS and have set the capture positions
Erik Corry 2010/03/19 11:04:11 have -> set
+ // in the first registers.
+ // If matching fails, returns RE_FAILURE.
+ // If execution fails, throws an exception and returns RE_EXCEPTION.
Erik Corry 2010/03/19 11:04:11 Unclear again.
Lasse Reichstein 2010/03/19 11:25:42 Reworded.
+ static IrregexpResult IrregexpExecOnce(Handle<JSRegExp> regexp,
+ Handle<String> subject,
+ int index,
+ Vector<int32_t> registers);
+
// Execute an Irregexp bytecode pattern.
// On a successful match, the result is a JSArray containing
// captured positions. On a failure, the result is the null value.

Powered by Google App Engine
This is Rietveld 408576698