| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Features shared by parsing and pre-parsing scanners. | 5 // Features shared by parsing and pre-parsing scanners. |
| 6 | 6 |
| 7 #ifndef V8_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
| 8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Returns the next token and advances input. | 202 // Returns the next token and advances input. |
| 203 Token::Value Next(); | 203 Token::Value Next(); |
| 204 // Returns the token following peek() | 204 // Returns the token following peek() |
| 205 Token::Value PeekAhead(); | 205 Token::Value PeekAhead(); |
| 206 // Returns the current token again. | 206 // Returns the current token again. |
| 207 Token::Value current_token() { return current_.token; } | 207 Token::Value current_token() { return current_.token; } |
| 208 // Returns the location information for the current token | 208 // Returns the location information for the current token |
| 209 // (the token last returned by Next()). | 209 // (the token last returned by Next()). |
| 210 Location location() const { return current_.location; } | 210 Location location() const { return current_.location; } |
| 211 | 211 |
| 212 // This error is specifically an invalid hex or unicode escape sequence. |
| 212 bool has_error() const { return scanner_error_ != MessageTemplate::kNone; } | 213 bool has_error() const { return scanner_error_ != MessageTemplate::kNone; } |
| 213 MessageTemplate::Template error() const { return scanner_error_; } | 214 MessageTemplate::Template error() const { return scanner_error_; } |
| 214 Location error_location() const { return scanner_error_location_; } | 215 Location error_location() const { return scanner_error_location_; } |
| 215 | 216 |
| 217 void clear_error() { |
| 218 DCHECK(has_error()); |
| 219 scanner_error_ = MessageTemplate::kNone; |
| 220 scanner_error_location_ = Location(); |
| 221 } |
| 222 |
| 216 // Similar functions for the upcoming token. | 223 // Similar functions for the upcoming token. |
| 217 | 224 |
| 218 // One token look-ahead (past the token returned by Next()). | 225 // One token look-ahead (past the token returned by Next()). |
| 219 Token::Value peek() const { return next_.token; } | 226 Token::Value peek() const { return next_.token; } |
| 220 | 227 |
| 221 Location peek_location() const { return next_.location; } | 228 Location peek_location() const { return next_.location; } |
| 222 | 229 |
| 223 bool literal_contains_escapes() const { | 230 bool literal_contains_escapes() const { |
| 224 return LiteralContainsEscapes(current_); | 231 return LiteralContainsEscapes(current_); |
| 225 } | 232 } |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 bool found_html_comment_; | 762 bool found_html_comment_; |
| 756 | 763 |
| 757 MessageTemplate::Template scanner_error_; | 764 MessageTemplate::Template scanner_error_; |
| 758 Location scanner_error_location_; | 765 Location scanner_error_location_; |
| 759 }; | 766 }; |
| 760 | 767 |
| 761 } // namespace internal | 768 } // namespace internal |
| 762 } // namespace v8 | 769 } // namespace v8 |
| 763 | 770 |
| 764 #endif // V8_PARSING_SCANNER_H_ | 771 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |