| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 static void ParseCompilationUnit(const Library& library, | 119 static void ParseCompilationUnit(const Library& library, |
| 120 const Script& script); | 120 const Script& script); |
| 121 | 121 |
| 122 static void ParseFunction(ParsedFunction* parsed_function); | 122 static void ParseFunction(ParsedFunction* parsed_function); |
| 123 | 123 |
| 124 // Format and print a message with source location. | 124 // Format and print a message with source location. |
| 125 // A null script means no source and a negative token_pos means no position. | 125 // A null script means no source and a negative token_pos means no position. |
| 126 static void PrintMessage(const Script& script, | 126 static void PrintMessage(const Script& script, |
| 127 intptr_t token_pos, | 127 intptr_t token_pos, |
| 128 const char* message_header, | 128 const char* message_header, |
| 129 const char* format, ...); | 129 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 130 | 130 |
| 131 // Build an error object containing a formatted error or warning message. | 131 // Build an error object containing a formatted error or warning message. |
| 132 // A null script means no source and a negative token_pos means no position. | 132 // A null script means no source and a negative token_pos means no position. |
| 133 static RawError* FormatError(const Script& script, | 133 static RawError* FormatError(const Script& script, |
| 134 intptr_t token_pos, | 134 intptr_t token_pos, |
| 135 const char* message_header, | 135 const char* message_header, |
| 136 const char* format, | 136 const char* format, |
| 137 va_list args); | 137 va_list args); |
| 138 | 138 |
| 139 // Same as FormatError, but appends the new error to the 'prev_error'. | 139 // Same as FormatError, but appends the new error to the 'prev_error'. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // A null script means no source and a negative token_pos means no position. | 246 // A null script means no source and a negative token_pos means no position. |
| 247 static void FormatMessage(const Script& script, | 247 static void FormatMessage(const Script& script, |
| 248 intptr_t token_pos, | 248 intptr_t token_pos, |
| 249 const char* message_header, | 249 const char* message_header, |
| 250 char* message_buffer, | 250 char* message_buffer, |
| 251 intptr_t message_buffer_size, | 251 intptr_t message_buffer_size, |
| 252 const char* format, | 252 const char* format, |
| 253 va_list args); | 253 va_list args); |
| 254 | 254 |
| 255 // Reports error/warning message at location of current token. | 255 // Reports error/warning message at location of current token. |
| 256 void ErrorMsg(const char* msg, ...); | 256 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 257 void Warning(const char* msg, ...); | 257 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| 258 void Unimplemented(const char* msg); | 258 void Unimplemented(const char* msg); |
| 259 | 259 |
| 260 // Reports error message at given location. | 260 // Reports error message at given location. |
| 261 void ErrorMsg(intptr_t token_pos, const char* msg, ...); | 261 void ErrorMsg(intptr_t token_pos, const char* msg, ...) |
| 262 void Warning(intptr_t token_pos, const char* msg, ...); | 262 PRINTF_ATTRIBUTE(3, 4); |
| 263 void Warning(intptr_t token_pos, const char* msg, ...) |
| 264 PRINTF_ATTRIBUTE(3, 4); |
| 263 | 265 |
| 264 // Reports an already formatted error message. | 266 // Reports an already formatted error message. |
| 265 void ErrorMsg(const Error& error); | 267 void ErrorMsg(const Error& error); |
| 266 | 268 |
| 267 // Concatenates two error messages, the previous and the current one. | 269 // Concatenates two error messages, the previous and the current one. |
| 268 void AppendErrorMsg( | 270 void AppendErrorMsg( |
| 269 const Error& prev_error, intptr_t token_pos, const char* format, ...); | 271 const Error& prev_error, intptr_t token_pos, const char* format, ...) |
| 272 PRINTF_ATTRIBUTE(4, 5); |
| 270 | 273 |
| 271 const Instance& EvaluateConstExpr(AstNode* expr); | 274 const Instance& EvaluateConstExpr(AstNode* expr); |
| 272 AstNode* RunStaticFieldInitializer(const Field& field); | 275 AstNode* RunStaticFieldInitializer(const Field& field); |
| 273 RawObject* EvaluateConstConstructorCall( | 276 RawObject* EvaluateConstConstructorCall( |
| 274 const Class& type_class, | 277 const Class& type_class, |
| 275 const AbstractTypeArguments& type_arguments, | 278 const AbstractTypeArguments& type_arguments, |
| 276 const Function& constructor, | 279 const Function& constructor, |
| 277 ArgumentListNode* arguments); | 280 ArgumentListNode* arguments); |
| 278 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 281 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 279 | 282 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 606 |
| 604 // Allocate temporary only once per function. | 607 // Allocate temporary only once per function. |
| 605 LocalVariable* expression_temp_; | 608 LocalVariable* expression_temp_; |
| 606 | 609 |
| 607 DISALLOW_COPY_AND_ASSIGN(Parser); | 610 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 608 }; | 611 }; |
| 609 | 612 |
| 610 } // namespace dart | 613 } // namespace dart |
| 611 | 614 |
| 612 #endif // VM_PARSER_H_ | 615 #endif // VM_PARSER_H_ |
| OLD | NEW |