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