OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1428 |
1429 PreParser(Scanner* scanner, ParserRecorder* log, uintptr_t stack_limit) | 1429 PreParser(Scanner* scanner, ParserRecorder* log, uintptr_t stack_limit) |
1430 : ParserBase<PreParserTraits>(scanner, stack_limit, NULL, log, NULL, | 1430 : ParserBase<PreParserTraits>(scanner, stack_limit, NULL, log, NULL, |
1431 this) {} | 1431 this) {} |
1432 | 1432 |
1433 // Pre-parse the program from the character stream; returns true on | 1433 // Pre-parse the program from the character stream; returns true on |
1434 // success (even if parsing failed, the pre-parse data successfully | 1434 // success (even if parsing failed, the pre-parse data successfully |
1435 // captured the syntax error), and false if a stack-overflow happened | 1435 // captured the syntax error), and false if a stack-overflow happened |
1436 // during parsing. | 1436 // during parsing. |
1437 PreParseResult PreParseProgram() { | 1437 PreParseResult PreParseProgram() { |
1438 PreParserScope scope(scope_, GLOBAL_SCOPE); | 1438 PreParserScope scope(scope_, SCRIPT_SCOPE); |
1439 PreParserFactory factory(NULL); | 1439 PreParserFactory factory(NULL); |
1440 FunctionState top_scope(&function_state_, &scope_, &scope, &factory); | 1440 FunctionState top_scope(&function_state_, &scope_, &scope, &factory); |
1441 bool ok = true; | 1441 bool ok = true; |
1442 int start_position = scanner()->peek_location().beg_pos; | 1442 int start_position = scanner()->peek_location().beg_pos; |
1443 ParseSourceElements(Token::EOS, &ok); | 1443 ParseSourceElements(Token::EOS, &ok); |
1444 if (stack_overflow()) return kPreParseStackOverflow; | 1444 if (stack_overflow()) return kPreParseStackOverflow; |
1445 if (!ok) { | 1445 if (!ok) { |
1446 ReportUnexpectedToken(scanner()->current_token()); | 1446 ReportUnexpectedToken(scanner()->current_token()); |
1447 } else if (scope_->strict_mode() == STRICT) { | 1447 } else if (scope_->strict_mode() == STRICT) { |
1448 CheckOctalLiteral(start_position, scanner()->location().end_pos, &ok); | 1448 CheckOctalLiteral(start_position, scanner()->location().end_pos, &ok); |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2864 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
2865 // Both accessors of the same type. | 2865 // Both accessors of the same type. |
2866 parser()->ReportMessage("accessor_get_set"); | 2866 parser()->ReportMessage("accessor_get_set"); |
2867 } | 2867 } |
2868 *ok = false; | 2868 *ok = false; |
2869 } | 2869 } |
2870 } | 2870 } |
2871 } } // v8::internal | 2871 } } // v8::internal |
2872 | 2872 |
2873 #endif // V8_PREPARSER_H | 2873 #endif // V8_PREPARSER_H |
OLD | NEW |