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 "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class SourceLabel; | 29 class SourceLabel; |
30 template <typename T> class GrowableArray; | 30 template <typename T> class GrowableArray; |
31 class Parser; | 31 class Parser; |
32 | 32 |
33 struct CatchParamDesc; | 33 struct CatchParamDesc; |
34 class ClassDesc; | 34 class ClassDesc; |
35 struct MemberDesc; | 35 struct MemberDesc; |
36 struct ParamList; | 36 struct ParamList; |
37 struct QualIdent; | 37 struct QualIdent; |
38 class TopLevel; | 38 class TopLevel; |
| 39 class RecursionChecker; |
39 | 40 |
40 // The class ParsedFunction holds the result of parsing a function. | 41 // The class ParsedFunction holds the result of parsing a function. |
41 class ParsedFunction : public ZoneAllocated { | 42 class ParsedFunction : public ZoneAllocated { |
42 public: | 43 public: |
43 ParsedFunction(Thread* thread, const Function& function) | 44 ParsedFunction(Thread* thread, const Function& function) |
44 : thread_(thread), | 45 : thread_(thread), |
45 function_(function), | 46 function_(function), |
46 code_(Code::Handle(zone(), function.unoptimized_code())), | 47 code_(Code::Handle(zone(), function.unoptimized_code())), |
47 node_sequence_(NULL), | 48 node_sequence_(NULL), |
48 regexp_compile_data_(NULL), | 49 regexp_compile_data_(NULL), |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 void SkipStringLiteral(); | 359 void SkipStringLiteral(); |
359 void SkipQualIdent(); | 360 void SkipQualIdent(); |
360 void SkipFunctionPreamble(); | 361 void SkipFunctionPreamble(); |
361 | 362 |
362 AstNode* DartPrint(const char* str); | 363 AstNode* DartPrint(const char* str); |
363 | 364 |
364 void CheckConstructorCallTypeArguments(intptr_t pos, | 365 void CheckConstructorCallTypeArguments(intptr_t pos, |
365 const Function& constructor, | 366 const Function& constructor, |
366 const TypeArguments& type_arguments); | 367 const TypeArguments& type_arguments); |
367 | 368 |
| 369 // Report error if parsed code is too deeply nested; avoid stack overflow. |
| 370 void CheckStack(); |
| 371 |
368 // Report already formatted error. | 372 // Report already formatted error. |
369 static void ReportError(const Error& error); | 373 static void ReportError(const Error& error); |
370 | 374 |
371 // Concatenate and report an already formatted error and a new error message. | 375 // Concatenate and report an already formatted error and a new error message. |
372 static void ReportErrors(const Error& prev_error, | 376 static void ReportErrors(const Error& prev_error, |
373 const Script& script, intptr_t token_pos, | 377 const Script& script, intptr_t token_pos, |
374 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 378 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
375 | 379 |
376 // Report error message at location of current token in current script. | 380 // Report error message at location of current token in current script. |
377 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); | 381 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 891 |
888 int16_t last_used_try_index_; | 892 int16_t last_used_try_index_; |
889 | 893 |
890 bool unregister_pending_function_; | 894 bool unregister_pending_function_; |
891 | 895 |
892 LocalScope* async_temp_scope_; | 896 LocalScope* async_temp_scope_; |
893 | 897 |
894 // Indentation of parser trace. | 898 // Indentation of parser trace. |
895 intptr_t trace_indent_; | 899 intptr_t trace_indent_; |
896 | 900 |
| 901 intptr_t recursion_counter_; |
| 902 friend class RecursionChecker; |
| 903 |
897 DISALLOW_COPY_AND_ASSIGN(Parser); | 904 DISALLOW_COPY_AND_ASSIGN(Parser); |
898 }; | 905 }; |
899 | 906 |
900 } // namespace dart | 907 } // namespace dart |
901 | 908 |
902 #endif // VM_PARSER_H_ | 909 #endif // VM_PARSER_H_ |
OLD | NEW |