Revision: 18087
Author:   [email protected]
Date:     Tue Nov 26 17:52:31 2013 UTC
Log:      ExperimentalScanner += SeekForward.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/88823004
http://code.google.com/p/v8/source/detail?r=18087

Modified:
 /branches/experimental/parser/src/lexer/experimental-scanner.h

=======================================
--- /branches/experimental/parser/src/lexer/experimental-scanner.h Tue Nov 26 15:58:36 2013 UTC +++ /branches/experimental/parser/src/lexer/experimental-scanner.h Tue Nov 26 17:52:31 2013 UTC
@@ -181,7 +181,12 @@
   }
   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 @@
   virtual ~ExperimentalScanner() { }

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

@@ -281,6 +287,15 @@
   const Char* cursor_;
   const Char* marker_;
 };
+
+
+template<typename Char>
+void ExperimentalScanner<Char>::SeekForward(int pos) {
+  cursor_ = buffer_ + pos;
+  start_ = cursor_;
+  marker_ = cursor_;
+  Scan();  // Fills in next_.
+}


 template<typename Char>

--
--
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