| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 static void ParseFunction(ParsedFunction* parsed_function); | 82 static void ParseFunction(ParsedFunction* parsed_function); |
| 83 | 83 |
| 84 // Build an error object containing a formatted error or warning message. | 84 // Build an error object containing a formatted error or warning message. |
| 85 // A null script means no source and a negative token_index means no position. | 85 // A null script means no source and a negative token_index means no position. |
| 86 static RawError* FormatError(const Script& script, | 86 static RawError* FormatError(const Script& script, |
| 87 intptr_t token_index, | 87 intptr_t token_index, |
| 88 const char* message_header, | 88 const char* message_header, |
| 89 const char* format, | 89 const char* format, |
| 90 va_list args); | 90 va_list args); |
| 91 | 91 |
| 92 // Same as FormatError, but appends the new error to the 'prev_error'. |
| 93 static RawError* FormatErrorWithAppend(const Error& prev_error, |
| 94 const Script& script, |
| 95 intptr_t token_index, |
| 96 const char* message_header, |
| 97 const char* format, |
| 98 va_list args); |
| 99 |
| 92 private: | 100 private: |
| 93 struct Block; | 101 struct Block; |
| 94 class TryBlocks; | 102 class TryBlocks; |
| 95 | 103 |
| 96 // The function being parsed. | 104 // The function being parsed. |
| 97 const Function& current_function() const; | 105 const Function& current_function() const; |
| 98 | 106 |
| 99 // Note that a local function may be parsed multiple times. It is first parsed | 107 // Note that a local function may be parsed multiple times. It is first parsed |
| 100 // when its outermost enclosing function is being parsed. It is then parsed | 108 // when its outermost enclosing function is being parsed. It is then parsed |
| 101 // again when an enclosing function calls this local function or calls | 109 // again when an enclosing function calls this local function or calls |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 va_list args); | 193 va_list args); |
| 186 | 194 |
| 187 // Reports error/warning message at location of current token. | 195 // Reports error/warning message at location of current token. |
| 188 void ErrorMsg(const char* msg, ...); | 196 void ErrorMsg(const char* msg, ...); |
| 189 void Warning(const char* msg, ...); | 197 void Warning(const char* msg, ...); |
| 190 void Unimplemented(const char* msg); | 198 void Unimplemented(const char* msg); |
| 191 | 199 |
| 192 // Reports error message at given location. | 200 // Reports error message at given location. |
| 193 void ErrorMsg(intptr_t token_index, const char* msg, ...); | 201 void ErrorMsg(intptr_t token_index, const char* msg, ...); |
| 194 void Warning(intptr_t token_index, const char* msg, ...); | 202 void Warning(intptr_t token_index, const char* msg, ...); |
| 203 |
| 204 // Reports an already formatted error message. |
| 205 void ErrorMsg(const Error& error); |
| 206 |
| 195 // Concatenates two error messages, the previous and the current one. | 207 // Concatenates two error messages, the previous and the current one. |
| 196 void AppendErrorMsg( | 208 void AppendErrorMsg( |
| 197 const Error& prev_error, intptr_t token_index, const char* format, ...); | 209 const Error& prev_error, intptr_t token_index, const char* format, ...); |
| 198 | 210 |
| 199 // Same as FormatError, but appends the new error to the 'prev_error'. | |
| 200 static RawError* FormatErrorWithAppend(const Error& prev_error, | |
| 201 const Script& script, | |
| 202 intptr_t token_index, | |
| 203 const char* message_header, | |
| 204 const char* format, | |
| 205 va_list args); | |
| 206 | |
| 207 const Instance& EvaluateConstExpr(AstNode* expr); | 211 const Instance& EvaluateConstExpr(AstNode* expr); |
| 208 void RunStaticFieldInitializer(const Field& field); | 212 void RunStaticFieldInitializer(const Field& field); |
| 209 RawObject* EvaluateConstConstructorCall( | 213 RawObject* EvaluateConstConstructorCall( |
| 210 const Class& type_class, | 214 const Class& type_class, |
| 211 const AbstractTypeArguments& type_arguments, | 215 const AbstractTypeArguments& type_arguments, |
| 212 const Function& constructor, | 216 const Function& constructor, |
| 213 ArgumentListNode* arguments); | 217 ArgumentListNode* arguments); |
| 214 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 218 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 215 | 219 |
| 216 // Support for parsing of scripts. | 220 // Support for parsing of scripts. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // code at all points in the try block where an exit from the block is | 480 // code at all points in the try block where an exit from the block is |
| 477 // done using 'return', 'break' or 'continue' statements. | 481 // done using 'return', 'break' or 'continue' statements. |
| 478 TryBlocks* try_blocks_list_; | 482 TryBlocks* try_blocks_list_; |
| 479 | 483 |
| 480 DISALLOW_COPY_AND_ASSIGN(Parser); | 484 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 481 }; | 485 }; |
| 482 | 486 |
| 483 } // namespace dart | 487 } // namespace dart |
| 484 | 488 |
| 485 #endif // VM_PARSER_H_ | 489 #endif // VM_PARSER_H_ |
| OLD | NEW |