| OLD | NEW |
| 1 // Copyright (c) 2011, 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 "vm/ast.h" | 10 #include "vm/ast.h" |
| 11 #include "vm/compiler_stats.h" | 11 #include "vm/compiler_stats.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 void ConsumeToken() { | 135 void ConsumeToken() { |
| 136 // Reset cache and advance the token. | 136 // Reset cache and advance the token. |
| 137 token_kind_ = Token::kILLEGAL; | 137 token_kind_ = Token::kILLEGAL; |
| 138 token_index_++; | 138 token_index_++; |
| 139 CompilerStats::num_tokens_consumed++; | 139 CompilerStats::num_tokens_consumed++; |
| 140 } | 140 } |
| 141 void ConsumeRightAngleBracket(); | 141 void ConsumeRightAngleBracket(); |
| 142 void ExpectToken(Token::Kind token_expected); | 142 void ExpectToken(Token::Kind token_expected); |
| 143 void ExpectSemicolon(); | 143 void ExpectSemicolon(); |
| 144 void UnexpectedToken(); | 144 void UnexpectedToken(); |
| 145 String* ExpectTypeIdentifier(const char* msg); |
| 145 String* ExpectIdentifier(const char* msg); | 146 String* ExpectIdentifier(const char* msg); |
| 146 bool IsLiteral(const char* literal); | 147 bool IsLiteral(const char* literal); |
| 147 | 148 |
| 148 void SkipIf(Token::Kind); | 149 void SkipIf(Token::Kind); |
| 149 void SkipBlock(); | 150 void SkipBlock(); |
| 150 void SkipToMatchingParenthesis(); | 151 void SkipToMatchingParenthesis(); |
| 151 void SkipTypeArguments(); | 152 void SkipTypeArguments(); |
| 152 void SkipType(bool allow_void); | 153 void SkipType(bool allow_void); |
| 153 void SkipInitializers(); | 154 void SkipInitializers(); |
| 154 void SkipExpr(); | 155 void SkipExpr(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 RawAbstractType* ParseFinalVarOrType(TypeSpecification type_specification, | 318 RawAbstractType* ParseFinalVarOrType(TypeSpecification type_specification, |
| 318 TypeResolution type_resolution); | 319 TypeResolution type_resolution); |
| 319 const AbstractType& ParseConstVarOrType(TypeSpecification type_specification); | 320 const AbstractType& ParseConstVarOrType(TypeSpecification type_specification); |
| 320 AstNode* ParseVariableDeclaration(const AbstractType& type, bool is_const); | 321 AstNode* ParseVariableDeclaration(const AbstractType& type, bool is_const); |
| 321 AstNode* ParseVariableDeclarationList(); | 322 AstNode* ParseVariableDeclarationList(); |
| 322 AstNode* ParseFunctionStatement(bool is_literal); | 323 AstNode* ParseFunctionStatement(bool is_literal); |
| 323 AstNode* ParseStatement(); | 324 AstNode* ParseStatement(); |
| 324 SequenceNode* ParseNestedStatement(bool parsing_loop_body, | 325 SequenceNode* ParseNestedStatement(bool parsing_loop_body, |
| 325 SourceLabel* label); | 326 SourceLabel* label); |
| 326 void ParseStatementSequence(); | 327 void ParseStatementSequence(); |
| 328 bool IsIdentifier(); |
| 327 bool IsFunctionTypeAliasName(); | 329 bool IsFunctionTypeAliasName(); |
| 328 bool IsTypeParameter(); | 330 bool IsTypeParameter(); |
| 329 bool IsOptionalType(); | 331 bool IsOptionalType(); |
| 330 bool IsReturnType(); | 332 bool IsReturnType(); |
| 331 bool IsVariableDeclaration(); | 333 bool IsVariableDeclaration(); |
| 332 bool IsFunctionDeclaration(); | 334 bool IsFunctionDeclaration(); |
| 333 bool IsFunctionLiteral(); | 335 bool IsFunctionLiteral(); |
| 334 bool IsForInStatement(); | 336 bool IsForInStatement(); |
| 335 bool IsTopLevelAccessor(); | 337 bool IsTopLevelAccessor(); |
| 336 bool IsTopLevelFunction(); | 338 bool IsTopLevelFunction(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 const String& field_name, | 373 const String& field_name, |
| 372 intptr_t ident_pos); | 374 intptr_t ident_pos); |
| 373 | 375 |
| 374 RawClass* LookupClass(const String& class_name); | 376 RawClass* LookupClass(const String& class_name); |
| 375 RawObject* LookupTypeClass(const QualIdent& type_name, | 377 RawObject* LookupTypeClass(const QualIdent& type_name, |
| 376 TypeResolution type_resolution); | 378 TypeResolution type_resolution); |
| 377 LocalVariable* LookupLocalScope(const String& ident); | 379 LocalVariable* LookupLocalScope(const String& ident); |
| 378 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); | 380 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); |
| 379 RawClass* TypeParametersScopeClass(); | 381 RawClass* TypeParametersScopeClass(); |
| 380 bool IsInstantiatorRequired() const; | 382 bool IsInstantiatorRequired() const; |
| 383 bool IsDefinedInLexicalScope(const String& ident); |
| 381 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 384 bool ResolveIdentInLocalScope(intptr_t ident_pos, |
| 382 const String &ident, | 385 const String &ident, |
| 383 AstNode** node); | 386 AstNode** node); |
| 384 static const bool kResolveLocally = true; | 387 static const bool kResolveLocally = true; |
| 385 static const bool kResolveIncludingImports = false; | 388 static const bool kResolveIncludingImports = false; |
| 386 AstNode* ResolveIdentInLibraryScope(const Library& lib, | 389 AstNode* ResolveIdentInLibraryScope(const Library& lib, |
| 387 const QualIdent& qual_ident, | 390 const QualIdent& qual_ident, |
| 388 bool resolve_locally); | 391 bool resolve_locally); |
| 389 AstNode* ResolveVarOrField(intptr_t ident_pos, const String &ident); | 392 AstNode* ResolveVarOrField(intptr_t ident_pos, const String &ident); |
| 390 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 393 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // code at all points in the try block where an exit from the block is | 452 // code at all points in the try block where an exit from the block is |
| 450 // done using 'return', 'break' or 'continue' statements. | 453 // done using 'return', 'break' or 'continue' statements. |
| 451 TryBlocks* try_blocks_list_; | 454 TryBlocks* try_blocks_list_; |
| 452 | 455 |
| 453 DISALLOW_COPY_AND_ASSIGN(Parser); | 456 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 454 }; | 457 }; |
| 455 | 458 |
| 456 } // namespace dart | 459 } // namespace dart |
| 457 | 460 |
| 458 #endif // VM_PARSER_H_ | 461 #endif // VM_PARSER_H_ |
| OLD | NEW |