| 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 "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 int first_stack_local_index_; | 136 int first_stack_local_index_; |
| 137 int num_copied_params_; | 137 int num_copied_params_; |
| 138 int num_stack_locals_; | 138 int num_stack_locals_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 140 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 | 143 |
| 144 class Parser : public ValueObject { | 144 class Parser : public ValueObject { |
| 145 public: | 145 public: |
| 146 Parser(const Script& script, const Library& library); | 146 Parser(const Script& script, const Library& library, intptr_t token_pos); |
| 147 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 147 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); |
| 148 | 148 |
| 149 // Parse the top level of a whole script file and register declared classes | 149 // Parse the top level of a whole script file and register declared classes |
| 150 // in the given library. | 150 // in the given library. |
| 151 static void ParseCompilationUnit(const Library& library, | 151 static void ParseCompilationUnit(const Library& library, |
| 152 const Script& script); | 152 const Script& script); |
| 153 | 153 |
| 154 // Parse top level of a class and register all functions/fields. |
| 155 static void ParseClass(const Class& cls); |
| 156 |
| 154 static void ParseFunction(ParsedFunction* parsed_function); | 157 static void ParseFunction(ParsedFunction* parsed_function); |
| 155 | 158 |
| 156 // Format and print a message with source location. | 159 // Format and print a message with source location. |
| 157 // A null script means no source and a negative token_pos means no position. | 160 // A null script means no source and a negative token_pos means no position. |
| 158 static void PrintMessage(const Script& script, | 161 static void PrintMessage(const Script& script, |
| 159 intptr_t token_pos, | 162 intptr_t token_pos, |
| 160 const char* message_header, | 163 const char* message_header, |
| 161 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 164 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 162 | 165 |
| 163 // Build an error object containing a formatted error or warning message. | 166 // Build an error object containing a formatted error or warning message. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void ExpectSemicolon(); | 266 void ExpectSemicolon(); |
| 264 void UnexpectedToken(); | 267 void UnexpectedToken(); |
| 265 String* ExpectUserDefinedTypeIdentifier(const char* msg); | 268 String* ExpectUserDefinedTypeIdentifier(const char* msg); |
| 266 String* ExpectIdentifier(const char* msg); | 269 String* ExpectIdentifier(const char* msg); |
| 267 bool IsLiteral(const char* literal); | 270 bool IsLiteral(const char* literal); |
| 268 | 271 |
| 269 void SkipIf(Token::Kind); | 272 void SkipIf(Token::Kind); |
| 270 void SkipBlock(); | 273 void SkipBlock(); |
| 271 void SkipMetadata(); | 274 void SkipMetadata(); |
| 272 void SkipToMatchingParenthesis(); | 275 void SkipToMatchingParenthesis(); |
| 276 void SkipToMatchingBraces(); |
| 273 void SkipTypeArguments(); | 277 void SkipTypeArguments(); |
| 274 void SkipType(bool allow_void); | 278 void SkipType(bool allow_void); |
| 275 void SkipInitializers(); | 279 void SkipInitializers(); |
| 276 void SkipExpr(); | 280 void SkipExpr(); |
| 277 void SkipNestedExpr(); | 281 void SkipNestedExpr(); |
| 278 void SkipConditionalExpr(); | 282 void SkipConditionalExpr(); |
| 279 void SkipBinaryExpr(); | 283 void SkipBinaryExpr(); |
| 280 void SkipUnaryExpr(); | 284 void SkipUnaryExpr(); |
| 281 void SkipPostfixExpr(); | 285 void SkipPostfixExpr(); |
| 282 void SkipSelectors(); | 286 void SkipSelectors(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 AstNode* RunStaticFieldInitializer(const Field& field); | 329 AstNode* RunStaticFieldInitializer(const Field& field); |
| 326 RawObject* EvaluateConstConstructorCall( | 330 RawObject* EvaluateConstConstructorCall( |
| 327 const Class& type_class, | 331 const Class& type_class, |
| 328 const AbstractTypeArguments& type_arguments, | 332 const AbstractTypeArguments& type_arguments, |
| 329 const Function& constructor, | 333 const Function& constructor, |
| 330 ArgumentListNode* arguments); | 334 ArgumentListNode* arguments); |
| 331 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 335 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 332 | 336 |
| 333 // Support for parsing of scripts. | 337 // Support for parsing of scripts. |
| 334 void ParseTopLevel(); | 338 void ParseTopLevel(); |
| 335 void ParseClassDefinition(const GrowableObjectArray& pending_classes); | 339 void ParseClassDeclaration(const GrowableObjectArray& pending_classes); |
| 340 void ParseClassDefinition(const Class& cls); |
| 336 void ParseMixinTypedef(const GrowableObjectArray& pending_classes); | 341 void ParseMixinTypedef(const GrowableObjectArray& pending_classes); |
| 337 void ParseTypedef(const GrowableObjectArray& pending_classes); | 342 void ParseTypedef(const GrowableObjectArray& pending_classes); |
| 338 void ParseTopLevelVariable(TopLevel* top_level); | 343 void ParseTopLevelVariable(TopLevel* top_level); |
| 339 void ParseTopLevelFunction(TopLevel* top_level); | 344 void ParseTopLevelFunction(TopLevel* top_level); |
| 340 void ParseTopLevelAccessor(TopLevel* top_level); | 345 void ParseTopLevelAccessor(TopLevel* top_level); |
| 341 | 346 |
| 342 // Support for parsing libraries. | 347 // Support for parsing libraries. |
| 343 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, | 348 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, |
| 344 intptr_t token_pos, | 349 intptr_t token_pos, |
| 345 const String& url); | 350 const String& url); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // code at all points in the try block where an exit from the block is | 677 // code at all points in the try block where an exit from the block is |
| 673 // done using 'return', 'break' or 'continue' statements. | 678 // done using 'return', 'break' or 'continue' statements. |
| 674 TryBlocks* try_blocks_list_; | 679 TryBlocks* try_blocks_list_; |
| 675 | 680 |
| 676 DISALLOW_COPY_AND_ASSIGN(Parser); | 681 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 677 }; | 682 }; |
| 678 | 683 |
| 679 } // namespace dart | 684 } // namespace dart |
| 680 | 685 |
| 681 #endif // VM_PARSER_H_ | 686 #endif // VM_PARSER_H_ |
| OLD | NEW |