| Index: src/parsing/scanner.h
|
| diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
|
| index 53742c0b4bdb06363814c3248b18a7865b46c6be..5b943e2974bae1f57d5cf4255eeaead16dfb689c 100644
|
| --- a/src/parsing/scanner.h
|
| +++ b/src/parsing/scanner.h
|
| @@ -14,6 +14,7 @@
|
| #include "src/globals.h"
|
| #include "src/hashmap.h"
|
| #include "src/list.h"
|
| +#include "src/messages.h"
|
| #include "src/parsing/token.h"
|
| #include "src/unicode.h"
|
| #include "src/unicode-decoder.h"
|
| @@ -354,6 +355,10 @@ class Scanner {
|
| // (the token last returned by Next()).
|
| Location location() const { return current_.location; }
|
|
|
| + bool has_error() const { return scanner_error_ != MessageTemplate::kNone; }
|
| + MessageTemplate::Template error() const { return scanner_error_; }
|
| + Location error_location() const { return scanner_error_location_; }
|
| +
|
| // Similar functions for the upcoming token.
|
|
|
| // One token look-ahead (past the token returned by Next()).
|
| @@ -482,6 +487,7 @@ class Scanner {
|
| current_.raw_literal_chars = NULL;
|
| next_next_.token = Token::UNINITIALIZED;
|
| found_html_comment_ = false;
|
| + scanner_error_ = MessageTemplate::kNone;
|
| }
|
|
|
| // Support BookmarkScope functionality.
|
| @@ -492,6 +498,19 @@ class Scanner {
|
| void DropBookmark();
|
| static void CopyTokenDesc(TokenDesc* to, TokenDesc* from);
|
|
|
| + void ReportScannerError(const Location& location,
|
| + MessageTemplate::Template error) {
|
| + if (has_error()) return;
|
| + scanner_error_ = error;
|
| + scanner_error_location_ = location;
|
| + }
|
| +
|
| + void ReportScannerError(int pos, MessageTemplate::Template error) {
|
| + if (has_error()) return;
|
| + scanner_error_ = error;
|
| + scanner_error_location_ = Location(pos, pos + 1);
|
| + }
|
| +
|
| // Literal buffer support
|
| inline void StartLiteral() {
|
| LiteralBuffer* free_buffer =
|
| @@ -637,7 +656,7 @@ class Scanner {
|
| return current_.raw_literal_chars->is_one_byte();
|
| }
|
|
|
| - template <bool capture_raw>
|
| + template <bool capture_raw, bool unicode = false>
|
| uc32 ScanHexNumber(int expected_length);
|
| // Scan a number of any length but not bigger than max_value. For example, the
|
| // number can be 000000001, so it's very long in characters but its value is
|
| @@ -769,6 +788,9 @@ class Scanner {
|
| bool found_html_comment_;
|
|
|
| bool allow_harmony_exponentiation_operator_;
|
| +
|
| + MessageTemplate::Template scanner_error_;
|
| + Location scanner_error_location_;
|
| };
|
|
|
| } // namespace internal
|
|
|