| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 kPreParseStackOverflow, | 109 kPreParseStackOverflow, |
| 110 kPreParseSuccess | 110 kPreParseSuccess |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 ~PreParser() {} | 113 ~PreParser() {} |
| 114 | 114 |
| 115 // Pre-parse the program from the character stream; returns true on | 115 // Pre-parse the program from the character stream; returns true on |
| 116 // success (even if parsing failed, the pre-parse data successfully | 116 // success (even if parsing failed, the pre-parse data successfully |
| 117 // captured the syntax error), and false if a stack-overflow happened | 117 // captured the syntax error), and false if a stack-overflow happened |
| 118 // during parsing. | 118 // during parsing. |
| 119 static PreParseResult PreParseProgram(i::JavaScriptScanner* scanner, | 119 static PreParseResult PreParseProgram(i::Scanner* scanner, |
| 120 i::ParserRecorder* log, | 120 i::ParserRecorder* log, |
| 121 int flags, | 121 int flags, |
| 122 uintptr_t stack_limit) { | 122 uintptr_t stack_limit) { |
| 123 bool allow_lazy = (flags & i::kAllowLazy) != 0; | 123 bool allow_lazy = (flags & i::kAllowLazy) != 0; |
| 124 bool allow_natives_syntax = (flags & i::kAllowNativesSyntax) != 0; | 124 bool allow_natives_syntax = (flags & i::kAllowNativesSyntax) != 0; |
| 125 return PreParser(scanner, log, stack_limit, | 125 return PreParser(scanner, log, stack_limit, |
| 126 allow_lazy, allow_natives_syntax).PreParse(); | 126 allow_lazy, allow_natives_syntax).PreParse(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 private: | 129 private: |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 Scope** const variable_; | 442 Scope** const variable_; |
| 443 Scope* const prev_; | 443 Scope* const prev_; |
| 444 const ScopeType type_; | 444 const ScopeType type_; |
| 445 int materialized_literal_count_; | 445 int materialized_literal_count_; |
| 446 int expected_properties_; | 446 int expected_properties_; |
| 447 int with_nesting_count_; | 447 int with_nesting_count_; |
| 448 i::StrictModeFlag strict_mode_flag_; | 448 i::StrictModeFlag strict_mode_flag_; |
| 449 }; | 449 }; |
| 450 | 450 |
| 451 // Private constructor only used in PreParseProgram. | 451 // Private constructor only used in PreParseProgram. |
| 452 PreParser(i::JavaScriptScanner* scanner, | 452 PreParser(i::Scanner* scanner, |
| 453 i::ParserRecorder* log, | 453 i::ParserRecorder* log, |
| 454 uintptr_t stack_limit, | 454 uintptr_t stack_limit, |
| 455 bool allow_lazy, | 455 bool allow_lazy, |
| 456 bool allow_natives_syntax) | 456 bool allow_natives_syntax) |
| 457 : scanner_(scanner), | 457 : scanner_(scanner), |
| 458 log_(log), | 458 log_(log), |
| 459 scope_(NULL), | 459 scope_(NULL), |
| 460 stack_limit_(stack_limit), | 460 stack_limit_(stack_limit), |
| 461 strict_mode_violation_location_(i::Scanner::Location::invalid()), | 461 strict_mode_violation_location_(i::Scanner::Location::invalid()), |
| 462 strict_mode_violation_type_(NULL), | 462 strict_mode_violation_type_(NULL), |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 const char* type, | 612 const char* type, |
| 613 bool *ok); | 613 bool *ok); |
| 614 | 614 |
| 615 void CheckDelayedStrictModeViolation(int beg_pos, int end_pos, bool* ok); | 615 void CheckDelayedStrictModeViolation(int beg_pos, int end_pos, bool* ok); |
| 616 | 616 |
| 617 void StrictModeIdentifierViolation(i::Scanner::Location, | 617 void StrictModeIdentifierViolation(i::Scanner::Location, |
| 618 const char* eval_args_type, | 618 const char* eval_args_type, |
| 619 Identifier identifier, | 619 Identifier identifier, |
| 620 bool* ok); | 620 bool* ok); |
| 621 | 621 |
| 622 i::JavaScriptScanner* scanner_; | 622 i::Scanner* scanner_; |
| 623 i::ParserRecorder* log_; | 623 i::ParserRecorder* log_; |
| 624 Scope* scope_; | 624 Scope* scope_; |
| 625 uintptr_t stack_limit_; | 625 uintptr_t stack_limit_; |
| 626 i::Scanner::Location strict_mode_violation_location_; | 626 i::Scanner::Location strict_mode_violation_location_; |
| 627 const char* strict_mode_violation_type_; | 627 const char* strict_mode_violation_type_; |
| 628 bool stack_overflow_; | 628 bool stack_overflow_; |
| 629 bool allow_lazy_; | 629 bool allow_lazy_; |
| 630 bool allow_natives_syntax_; | 630 bool allow_natives_syntax_; |
| 631 bool parenthesized_function_; | 631 bool parenthesized_function_; |
| 632 bool harmony_scoping_; | 632 bool harmony_scoping_; |
| 633 }; | 633 }; |
| 634 } } // v8::preparser | 634 } } // v8::preparser |
| 635 | 635 |
| 636 #endif // V8_PREPARSER_H | 636 #endif // V8_PREPARSER_H |
| OLD | NEW |