OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 void SkipMapLiteral(); | 162 void SkipMapLiteral(); |
165 void SkipListLiteral(); | 163 void SkipListLiteral(); |
166 void SkipFunctionLiteral(); | 164 void SkipFunctionLiteral(); |
167 void SkipStringLiteral(); | 165 void SkipStringLiteral(); |
168 | 166 |
169 void CheckConstructorCallTypeArguments( | 167 void CheckConstructorCallTypeArguments( |
170 intptr_t pos, | 168 intptr_t pos, |
171 Function& constructor, | 169 Function& constructor, |
172 const AbstractTypeArguments& type_arguments); | 170 const AbstractTypeArguments& type_arguments); |
173 | 171 |
| 172 // Format an error or warning message into the message_buffer. |
| 173 // A null script means no source and a negative token_index means no position. |
| 174 static void FormatMessage(const Script& script, |
| 175 intptr_t token_index, |
| 176 const char* message_header, |
| 177 char* message_buffer, |
| 178 intptr_t message_buffer_size, |
| 179 const char* format, |
| 180 va_list args); |
| 181 |
174 // Reports error message at location of current token. | 182 // Reports error message at location of current token. |
175 void ErrorMsg(const char* msg, ...); | 183 void ErrorMsg(const char* msg, ...); |
176 void ErrorMsg(intptr_t token_index, const char* msg, ...); | 184 void ErrorMsg(intptr_t token_index, const char* msg, ...); |
177 void Warning(const char* msg, ...); | 185 void Warning(const char* msg, ...); |
178 void Warning(intptr_t token_index, const char* msg, ...); | 186 void Warning(intptr_t token_index, const char* msg, ...); |
179 void Unimplemented(const char* msg); | 187 void Unimplemented(const char* msg); |
180 | 188 |
181 const Instance& EvaluateConstExpr(AstNode* expr); | 189 const Instance& EvaluateConstExpr(AstNode* expr); |
182 void RunStaticFieldInitializer(const Field& field); | 190 void RunStaticFieldInitializer(const Field& field); |
183 RawInstance* EvaluateConstConstructorCall( | 191 RawInstance* EvaluateConstConstructorCall( |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 // code at all points in the try block where an exit from the block is | 457 // code at all points in the try block where an exit from the block is |
450 // done using 'return', 'break' or 'continue' statements. | 458 // done using 'return', 'break' or 'continue' statements. |
451 TryBlocks* try_blocks_list_; | 459 TryBlocks* try_blocks_list_; |
452 | 460 |
453 DISALLOW_COPY_AND_ASSIGN(Parser); | 461 DISALLOW_COPY_AND_ASSIGN(Parser); |
454 }; | 462 }; |
455 | 463 |
456 } // namespace dart | 464 } // namespace dart |
457 | 465 |
458 #endif // VM_PARSER_H_ | 466 #endif // VM_PARSER_H_ |
OLD | NEW |