| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
| 6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 bool is_patch_source() const { | 284 bool is_patch_source() const { |
| 285 return script_.kind() == RawScript::kPatchTag; | 285 return script_.kind() == RawScript::kPatchTag; |
| 286 } | 286 } |
| 287 | 287 |
| 288 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } | 288 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } |
| 289 | 289 |
| 290 Token::Kind CurrentToken() { | 290 Token::Kind CurrentToken() { |
| 291 if (token_kind_ == Token::kILLEGAL) { | 291 if (token_kind_ == Token::kILLEGAL) { |
| 292 ComputeCurrentToken(); | 292 ComputeCurrentToken(); |
| 293 } | 293 } |
| 294 CompilerStats::num_token_checks++; | 294 INC_STAT(isolate_, num_token_checks, 1); |
| 295 return token_kind_; | 295 return token_kind_; |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ComputeCurrentToken(); | 298 void ComputeCurrentToken(); |
| 299 | 299 |
| 300 RawLibraryPrefix* ParsePrefix(); | 300 RawLibraryPrefix* ParsePrefix(); |
| 301 | 301 |
| 302 Token::Kind LookaheadToken(int num_tokens); | 302 Token::Kind LookaheadToken(int num_tokens); |
| 303 String* CurrentLiteral() const; | 303 String* CurrentLiteral() const; |
| 304 RawDouble* CurrentDoubleLiteral() const; | 304 RawDouble* CurrentDoubleLiteral() const; |
| 305 RawInteger* CurrentIntegerLiteral() const; | 305 RawInteger* CurrentIntegerLiteral() const; |
| 306 | 306 |
| 307 // Sets parser to given token position in the stream. | 307 // Sets parser to given token position in the stream. |
| 308 void SetPosition(intptr_t position); | 308 void SetPosition(intptr_t position); |
| 309 | 309 |
| 310 void ConsumeToken() { | 310 void ConsumeToken() { |
| 311 // Reset cache and advance the token. | 311 // Reset cache and advance the token. |
| 312 token_kind_ = Token::kILLEGAL; | 312 token_kind_ = Token::kILLEGAL; |
| 313 tokens_iterator_.Advance(); | 313 tokens_iterator_.Advance(); |
| 314 CompilerStats::num_tokens_consumed++; | 314 INC_STAT(isolate_, num_tokens_consumed, 1); |
| 315 } | 315 } |
| 316 void ConsumeRightAngleBracket(); | 316 void ConsumeRightAngleBracket(); |
| 317 void CheckToken(Token::Kind token_expected, const char* msg = NULL); | 317 void CheckToken(Token::Kind token_expected, const char* msg = NULL); |
| 318 void ExpectToken(Token::Kind token_expected); | 318 void ExpectToken(Token::Kind token_expected); |
| 319 void ExpectSemicolon(); | 319 void ExpectSemicolon(); |
| 320 void UnexpectedToken(); | 320 void UnexpectedToken(); |
| 321 String* ExpectUserDefinedTypeIdentifier(const char* msg); | 321 String* ExpectUserDefinedTypeIdentifier(const char* msg); |
| 322 String* ExpectIdentifier(const char* msg); | 322 String* ExpectIdentifier(const char* msg); |
| 323 bool IsAwaitKeyword(); | 323 bool IsAwaitKeyword(); |
| 324 bool IsYieldKeyword(); | 324 bool IsYieldKeyword(); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 | 857 |
| 858 // Indentation of parser trace. | 858 // Indentation of parser trace. |
| 859 intptr_t trace_indent_; | 859 intptr_t trace_indent_; |
| 860 | 860 |
| 861 DISALLOW_COPY_AND_ASSIGN(Parser); | 861 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 862 }; | 862 }; |
| 863 | 863 |
| 864 } // namespace dart | 864 } // namespace dart |
| 865 | 865 |
| 866 #endif // VM_PARSER_H_ | 866 #endif // VM_PARSER_H_ |
| OLD | NEW |