| 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 "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 void ConsumeToken() { | 199 void ConsumeToken() { |
| 200 // Reset cache and advance the token. | 200 // Reset cache and advance the token. |
| 201 token_kind_ = Token::kILLEGAL; | 201 token_kind_ = Token::kILLEGAL; |
| 202 tokens_iterator_.Advance(); | 202 tokens_iterator_.Advance(); |
| 203 CompilerStats::num_tokens_consumed++; | 203 CompilerStats::num_tokens_consumed++; |
| 204 } | 204 } |
| 205 void ConsumeRightAngleBracket(); | 205 void ConsumeRightAngleBracket(); |
| 206 void ExpectToken(Token::Kind token_expected); | 206 void ExpectToken(Token::Kind token_expected); |
| 207 void ExpectSemicolon(); | 207 void ExpectSemicolon(); |
| 208 void UnexpectedToken(); | 208 void UnexpectedToken(); |
| 209 String* ExpectTypeIdentifier(const char* msg); | 209 String* ExpectClassIdentifier(const char* msg); |
| 210 String* ExpectIdentifier(const char* msg); | 210 String* ExpectIdentifier(const char* msg); |
| 211 bool IsLiteral(const char* literal); | 211 bool IsLiteral(const char* literal); |
| 212 | 212 |
| 213 void SkipIf(Token::Kind); | 213 void SkipIf(Token::Kind); |
| 214 void SkipBlock(); | 214 void SkipBlock(); |
| 215 void SkipToMatchingParenthesis(); | 215 void SkipToMatchingParenthesis(); |
| 216 void SkipTypeArguments(); | 216 void SkipTypeArguments(); |
| 217 void SkipType(bool allow_void); | 217 void SkipType(bool allow_void); |
| 218 void SkipInitializers(); | 218 void SkipInitializers(); |
| 219 void SkipExpr(); | 219 void SkipExpr(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); | 475 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); |
| 476 RawClass* TypeParametersScopeClass() const; | 476 RawClass* TypeParametersScopeClass() const; |
| 477 const Type* ReceiverType(intptr_t type_pos) const; | 477 const Type* ReceiverType(intptr_t type_pos) const; |
| 478 bool IsInstantiatorRequired() const; | 478 bool IsInstantiatorRequired() const; |
| 479 bool IsDefinedInLexicalScope(const String& ident); | 479 bool IsDefinedInLexicalScope(const String& ident); |
| 480 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 480 bool ResolveIdentInLocalScope(intptr_t ident_pos, |
| 481 const String &ident, | 481 const String &ident, |
| 482 AstNode** node); | 482 AstNode** node); |
| 483 static const bool kResolveLocally = true; | 483 static const bool kResolveLocally = true; |
| 484 static const bool kResolveIncludingImports = false; | 484 static const bool kResolveIncludingImports = false; |
| 485 AstNode* ResolveIdentInLibraryScope(const Library& lib, | 485 |
| 486 const QualIdent& qual_ident, | 486 // Resolve a primary identifier in the libary or prefix scope and |
| 487 bool resolve_locally); | 487 // generate the corresponding AstNode. |
| 488 AstNode* ResolveIdentInLibraryPrefixScope(const LibraryPrefix& lib_prefix, | 488 AstNode* ResolveIdentInPrefixScope(intptr_t ident_pos, |
| 489 const QualIdent& qual_ident); | 489 const LibraryPrefix& prefix, |
| 490 const String& ident); |
| 491 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, |
| 492 const String& ident); |
| 493 |
| 494 // Find class with the given name in the library or prefix scope. |
| 495 RawClass* ResolveClassInCurrentLibraryScope(intptr_t ident_pos, |
| 496 const String& name); |
| 497 RawClass* ResolveClassInPrefixScope(intptr_t ident_pos, |
| 498 const LibraryPrefix& prefix, |
| 499 const String& name); |
| 500 |
| 501 // Find name in the library or prefix scope and return the corresponding |
| 502 // object (field, class, function etc). |
| 503 RawObject* ResolveNameInCurrentLibraryScope(intptr_t ident_pos, |
| 504 const String& ident); |
| 505 RawObject* ResolveNameInPrefixScope(intptr_t ident_pos, |
| 506 const LibraryPrefix& prefix, |
| 507 const String& name); |
| 508 |
| 490 AstNode* ResolveIdent(intptr_t ident_pos, | 509 AstNode* ResolveIdent(intptr_t ident_pos, |
| 491 const String& ident, | 510 const String& ident, |
| 492 bool allow_closure_names); | 511 bool allow_closure_names); |
| 493 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); | 512 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); |
| 494 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 513 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, |
| 495 Token::Kind binary_op, | 514 Token::Kind binary_op, |
| 496 AstNode* lhs, | 515 AstNode* lhs, |
| 497 AstNode* rhs); | 516 AstNode* rhs); |
| 498 AstNode* ExpandAssignableOp(intptr_t op_pos, | 517 AstNode* ExpandAssignableOp(intptr_t op_pos, |
| 499 Token::Kind assignment_op, | 518 Token::Kind assignment_op, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 590 |
| 572 // Allocate temporary only once per function. | 591 // Allocate temporary only once per function. |
| 573 LocalVariable* expression_temp_; | 592 LocalVariable* expression_temp_; |
| 574 | 593 |
| 575 DISALLOW_COPY_AND_ASSIGN(Parser); | 594 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 576 }; | 595 }; |
| 577 | 596 |
| 578 } // namespace dart | 597 } // namespace dart |
| 579 | 598 |
| 580 #endif // VM_PARSER_H_ | 599 #endif // VM_PARSER_H_ |
| OLD | NEW |