OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 kPreParseStackOverflow, | 236 kPreParseStackOverflow, |
237 kPreParseSuccess | 237 kPreParseSuccess |
238 }; | 238 }; |
239 | 239 |
240 PreParser(Scanner* scanner, | 240 PreParser(Scanner* scanner, |
241 ParserRecorder* log, | 241 ParserRecorder* log, |
242 uintptr_t stack_limit) | 242 uintptr_t stack_limit) |
243 : ParserBase(scanner, stack_limit), | 243 : ParserBase(scanner, stack_limit), |
244 log_(log), | 244 log_(log), |
245 scope_(NULL), | 245 scope_(NULL), |
246 strict_mode_violation_location_(Scanner::Location::invalid()), | |
247 strict_mode_violation_type_(NULL), | |
248 parenthesized_function_(false) { } | 246 parenthesized_function_(false) { } |
249 | 247 |
250 ~PreParser() {} | 248 ~PreParser() {} |
251 | 249 |
252 // Pre-parse the program from the character stream; returns true on | 250 // Pre-parse the program from the character stream; returns true on |
253 // success (even if parsing failed, the pre-parse data successfully | 251 // success (even if parsing failed, the pre-parse data successfully |
254 // captured the syntax error), and false if a stack-overflow happened | 252 // captured the syntax error), and false if a stack-overflow happened |
255 // during parsing. | 253 // during parsing. |
256 PreParseResult PreParseProgram() { | 254 PreParseResult PreParseProgram() { |
257 Scope top_scope(&scope_, kTopLevelScope); | 255 Scope top_scope(&scope_, kTopLevelScope); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 } | 646 } |
649 | 647 |
650 bool is_extended_mode() { | 648 bool is_extended_mode() { |
651 return scope_->language_mode() == EXTENDED_MODE; | 649 return scope_->language_mode() == EXTENDED_MODE; |
652 } | 650 } |
653 | 651 |
654 LanguageMode language_mode() { return scope_->language_mode(); } | 652 LanguageMode language_mode() { return scope_->language_mode(); } |
655 | 653 |
656 bool CheckInOrOf(bool accept_OF); | 654 bool CheckInOrOf(bool accept_OF); |
657 | 655 |
658 void SetStrictModeViolation(Scanner::Location, | |
659 const char* type, | |
660 bool* ok); | |
661 | |
662 void CheckDelayedStrictModeViolation(int beg_pos, int end_pos, bool* ok); | |
663 | |
664 void StrictModeIdentifierViolation(Scanner::Location, | |
665 Identifier identifier, | |
666 bool* ok); | |
667 | |
668 ParserRecorder* log_; | 656 ParserRecorder* log_; |
669 Scope* scope_; | 657 Scope* scope_; |
670 Scanner::Location strict_mode_violation_location_; | |
671 const char* strict_mode_violation_type_; | |
672 bool parenthesized_function_; | 658 bool parenthesized_function_; |
673 }; | 659 }; |
674 | 660 |
675 } } // v8::internal | 661 } } // v8::internal |
676 | 662 |
677 #endif // V8_PREPARSER_H | 663 #endif // V8_PREPARSER_H |
OLD | NEW |