Reviewers: dcarney,

Message:
Committed patchset #1 manually as r18087.

Description:
ExperimentalScanner += SeekForward.

[email protected]
BUG=

Committed: https://code.google.com/p/v8/source/detail?r=18087

Please review this at https://codereview.chromium.org/88823004/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser

Affected files (+16, -1 lines):
  M src/lexer/experimental-scanner.h


Index: src/lexer/experimental-scanner.h
diff --git a/src/lexer/experimental-scanner.h b/src/lexer/experimental-scanner.h index 4e2f153fdaff9aa78b62e4781ba02963a6d1bf52..39c3304cae7fe86c699c69d5c614e2dbb89659db 100644
--- a/src/lexer/experimental-scanner.h
+++ b/src/lexer/experimental-scanner.h
@@ -181,7 +181,12 @@ class ScannerBase {
   }
   void clear_octal_position() { }  // FIXME

-  void SeekForward(int pos) { }  // FIXME
+ // Seek forward to the given position. This operation works for simple cases + // such as seeking forward until simple delimiter tokens, which is what it is + // used for. After this call, we will have the token at the given position as + // the "next" token. The "current" token will be invalid. FIXME: for utf-8,
+  // we need to decide if pos is counted in characters or in bytes.
+  virtual void SeekForward(int pos) = 0;

   // Scans the input as a regular expression pattern, previous
   // character(s) must be /(=). Returns true if a pattern is scanned.
@@ -240,6 +245,7 @@ class ExperimentalScanner : public ScannerBase {
   virtual ~ExperimentalScanner() { }

   virtual void Scan();
+  virtual void SeekForward(int pos);
   virtual bool ScanRegExpPattern(bool seen_equal);
   virtual bool ScanRegExpFlags();

@@ -284,6 +290,15 @@ class ExperimentalScanner : public ScannerBase {


 template<typename Char>
+void ExperimentalScanner<Char>::SeekForward(int pos) {
+  cursor_ = buffer_ + pos;
+  start_ = cursor_;
+  marker_ = cursor_;
+  Scan();  // Fills in next_.
+}
+
+
+template<typename Char>
 bool ExperimentalScanner<Char>::ScanRegExpPattern(bool seen_equal) {
   // Scan: ('/' | '/=') RegularExpressionBody '/' RegularExpressionFlags
   bool in_character_class = false;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to