| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const Function& function, | 73 const Function& function, |
| 74 intptr_t token_index); | 74 intptr_t token_index); |
| 75 | 75 |
| 76 // Parse the top level of a whole script file and register declared classes | 76 // Parse the top level of a whole script file and register declared classes |
| 77 // and interfaces in the given library. | 77 // and interfaces in the given library. |
| 78 static void ParseCompilationUnit(const Library& library, | 78 static void ParseCompilationUnit(const Library& library, |
| 79 const Script& script); | 79 const Script& script); |
| 80 | 80 |
| 81 static void ParseFunction(ParsedFunction* parsed_function); | 81 static void ParseFunction(ParsedFunction* parsed_function); |
| 82 | 82 |
| 83 // Format an error or warning message into the message_buffer. | 83 // Build an error object containing a formatted error or warning message. |
| 84 // A null script means no source and a negative token_index means no position. | 84 // A null script means no source and a negative token_index means no position. |
| 85 static void FormatMessage(const Script& script, | 85 static RawError* FormatError(const Script& script, |
| 86 intptr_t token_index, | 86 intptr_t token_index, |
| 87 const char* message_header, | 87 const char* message_header, |
| 88 char* message_buffer, | 88 const char* format, |
| 89 intptr_t message_buffer_size, | 89 va_list args); |
| 90 const char* format, | |
| 91 va_list args); | |
| 92 | 90 |
| 93 private: | 91 private: |
| 94 struct Block; | 92 struct Block; |
| 95 class TryBlocks; | 93 class TryBlocks; |
| 96 | 94 |
| 97 // The function being parsed. | 95 // The function being parsed. |
| 98 const Function& current_function() const; | 96 const Function& current_function() const; |
| 99 | 97 |
| 100 // Note that a local function may be parsed multiple times. It is first parsed | 98 // Note that a local function may be parsed multiple times. It is first parsed |
| 101 // when its outermost enclosing function is being parsed. It is then parsed | 99 // when its outermost enclosing function is being parsed. It is then parsed |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void SkipMapLiteral(); | 163 void SkipMapLiteral(); |
| 166 void SkipListLiteral(); | 164 void SkipListLiteral(); |
| 167 void SkipFunctionLiteral(); | 165 void SkipFunctionLiteral(); |
| 168 void SkipStringLiteral(); | 166 void SkipStringLiteral(); |
| 169 | 167 |
| 170 void CheckConstructorCallTypeArguments( | 168 void CheckConstructorCallTypeArguments( |
| 171 intptr_t pos, | 169 intptr_t pos, |
| 172 Function& constructor, | 170 Function& constructor, |
| 173 const AbstractTypeArguments& type_arguments); | 171 const AbstractTypeArguments& type_arguments); |
| 174 | 172 |
| 173 // Format an error or warning message into the message_buffer. |
| 174 // A null script means no source and a negative token_index means no position. |
| 175 static void FormatMessage(const Script& script, |
| 176 intptr_t token_index, |
| 177 const char* message_header, |
| 178 char* message_buffer, |
| 179 intptr_t message_buffer_size, |
| 180 const char* format, |
| 181 va_list args); |
| 182 |
| 175 // Reports error message at location of current token. | 183 // Reports error message at location of current token. |
| 176 void ErrorMsg(const char* msg, ...); | 184 void ErrorMsg(const char* msg, ...); |
| 177 void ErrorMsg(intptr_t token_index, const char* msg, ...); | 185 void ErrorMsg(intptr_t token_index, const char* msg, ...); |
| 178 void Warning(const char* msg, ...); | 186 void Warning(const char* msg, ...); |
| 179 void Warning(intptr_t token_index, const char* msg, ...); | 187 void Warning(intptr_t token_index, const char* msg, ...); |
| 180 void Unimplemented(const char* msg); | 188 void Unimplemented(const char* msg); |
| 181 | 189 |
| 182 const Instance& EvaluateConstExpr(AstNode* expr); | 190 const Instance& EvaluateConstExpr(AstNode* expr); |
| 183 void RunStaticFieldInitializer(const Field& field); | 191 void RunStaticFieldInitializer(const Field& field); |
| 184 RawInstance* EvaluateConstConstructorCall( | 192 RawInstance* EvaluateConstConstructorCall( |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // code at all points in the try block where an exit from the block is | 460 // code at all points in the try block where an exit from the block is |
| 453 // done using 'return', 'break' or 'continue' statements. | 461 // done using 'return', 'break' or 'continue' statements. |
| 454 TryBlocks* try_blocks_list_; | 462 TryBlocks* try_blocks_list_; |
| 455 | 463 |
| 456 DISALLOW_COPY_AND_ASSIGN(Parser); | 464 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 457 }; | 465 }; |
| 458 | 466 |
| 459 } // namespace dart | 467 } // namespace dart |
| 460 | 468 |
| 461 #endif // VM_PARSER_H_ | 469 #endif // VM_PARSER_H_ |
| OLD | NEW |