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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 template<class Traits> | 1009 template<class Traits> |
1010 ParserBase<Traits>::FunctionState::~FunctionState() { | 1010 ParserBase<Traits>::FunctionState::~FunctionState() { |
1011 *scope_stack_ = outer_scope_; | 1011 *scope_stack_ = outer_scope_; |
1012 *function_state_stack_ = outer_function_state_; | 1012 *function_state_stack_ = outer_function_state_; |
1013 Traits::TearDownFunctionState(this); | 1013 Traits::TearDownFunctionState(this); |
1014 } | 1014 } |
1015 | 1015 |
1016 | 1016 |
1017 template<class Traits> | 1017 template<class Traits> |
1018 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { | 1018 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { |
1019 // We don't report stack overflows here, to avoid increasing the | |
1020 // stack depth even further. Instead we report it after parsing is | |
1021 // over, in ParseProgram. | |
1022 if (token == Token::ILLEGAL && stack_overflow()) { | |
1023 return; | |
1024 } | |
1025 Scanner::Location source_location = scanner()->location(); | 1019 Scanner::Location source_location = scanner()->location(); |
1026 | 1020 |
1027 // Four of the tokens are treated specially | 1021 // Four of the tokens are treated specially |
1028 switch (token) { | 1022 switch (token) { |
1029 case Token::EOS: | 1023 case Token::EOS: |
1030 return ReportMessageAt(source_location, "unexpected_eos"); | 1024 return ReportMessageAt(source_location, "unexpected_eos"); |
1031 case Token::NUMBER: | 1025 case Token::NUMBER: |
1032 return ReportMessageAt(source_location, "unexpected_token_number"); | 1026 return ReportMessageAt(source_location, "unexpected_token_number"); |
1033 case Token::STRING: | 1027 case Token::STRING: |
1034 return ReportMessageAt(source_location, "unexpected_token_string"); | 1028 return ReportMessageAt(source_location, "unexpected_token_string"); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 "accessor_get_set"); | 1530 "accessor_get_set"); |
1537 } | 1531 } |
1538 *ok = false; | 1532 *ok = false; |
1539 } | 1533 } |
1540 } | 1534 } |
1541 | 1535 |
1542 | 1536 |
1543 } } // v8::internal | 1537 } } // v8::internal |
1544 | 1538 |
1545 #endif // V8_PREPARSER_H | 1539 #endif // V8_PREPARSER_H |
OLD | NEW |