summaryrefslogtreecommitdiff
path: root/deps/v8/src/parsing/scanner.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/parsing/scanner.h')
-rw-r--r--deps/v8/src/parsing/scanner.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/deps/v8/src/parsing/scanner.h b/deps/v8/src/parsing/scanner.h
index 200054d893..08d77c686b 100644
--- a/deps/v8/src/parsing/scanner.h
+++ b/deps/v8/src/parsing/scanner.h
@@ -260,6 +260,8 @@ class Scanner {
double DoubleValue();
+ const char* CurrentLiteralAsCString(Zone* zone) const;
+
inline bool CurrentMatches(Token::Value token) const {
DCHECK(Token::IsKeyword(token));
return current_.token == token;
@@ -356,6 +358,9 @@ class Scanner {
bool FoundHtmlComment() const { return found_html_comment_; }
+ bool allow_harmony_bigint() const { return allow_harmony_bigint_; }
+ void set_allow_harmony_bigint(bool allow) { allow_harmony_bigint_ = allow; }
+
private:
// Scoped helper for saving & restoring scanner error state.
// This is used for tagged template literals, in which normally forbidden
@@ -409,7 +414,7 @@ class Scanner {
Vector<const uint16_t> two_byte_literal() const {
DCHECK(!is_one_byte_);
- DCHECK((position_ & 0x1) == 0);
+ DCHECK_EQ(position_ & 0x1, 0);
return Vector<const uint16_t>(
reinterpret_cast<const uint16_t*>(backing_store_.start()),
position_ >> 1);
@@ -494,18 +499,18 @@ class Scanner {
// Initialize current_ to not refer to a literal.
current_.token = Token::UNINITIALIZED;
current_.contextual_token = Token::UNINITIALIZED;
- current_.literal_chars = NULL;
- current_.raw_literal_chars = NULL;
+ current_.literal_chars = nullptr;
+ current_.raw_literal_chars = nullptr;
current_.invalid_template_escape_message = MessageTemplate::kNone;
next_.token = Token::UNINITIALIZED;
next_.contextual_token = Token::UNINITIALIZED;
- next_.literal_chars = NULL;
- next_.raw_literal_chars = NULL;
+ next_.literal_chars = nullptr;
+ next_.raw_literal_chars = nullptr;
next_.invalid_template_escape_message = MessageTemplate::kNone;
next_next_.token = Token::UNINITIALIZED;
next_next_.contextual_token = Token::UNINITIALIZED;
- next_next_.literal_chars = NULL;
- next_next_.raw_literal_chars = NULL;
+ next_next_.literal_chars = nullptr;
+ next_next_.raw_literal_chars = nullptr;
next_next_.invalid_template_escape_message = MessageTemplate::kNone;
found_html_comment_ = false;
scanner_error_ = MessageTemplate::kNone;
@@ -572,8 +577,8 @@ class Scanner {
// Stops scanning of a literal and drop the collected characters,
// e.g., due to an encountered error.
inline void DropLiteral() {
- next_.literal_chars = NULL;
- next_.raw_literal_chars = NULL;
+ next_.literal_chars = nullptr;
+ next_.raw_literal_chars = nullptr;
}
inline void AddLiteralCharAdvance() {
@@ -662,10 +667,6 @@ class Scanner {
bool is_literal_one_byte() const {
return !current_.literal_chars || current_.literal_chars->is_one_byte();
}
- int literal_length() const {
- if (current_.literal_chars) return current_.literal_chars->length();
- return Token::StringLength(current_.token);
- }
// Returns the literal string for the next token (the token that
// would be returned if Next() were called).
Vector<const uint8_t> next_literal_one_byte_string() const {
@@ -801,6 +802,9 @@ class Scanner {
// Whether this scanner encountered an HTML comment.
bool found_html_comment_;
+ // Whether to recognize BIGINT tokens.
+ bool allow_harmony_bigint_;
+
int* use_counts_;
MessageTemplate::Template scanner_error_;