Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/preparser.h

Issue 300103005: Split StringLiteral from Literal. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: number literals Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "func-name-inferrer.h" 8 #include "func-name-inferrer.h"
9 #include "hashmap.h" 9 #include "hashmap.h"
10 #include "scopes.h" 10 #include "scopes.h"
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 737
738 private: 738 private:
739 ScopeType scope_type_; 739 ScopeType scope_type_;
740 StrictMode strict_mode_; 740 StrictMode strict_mode_;
741 }; 741 };
742 742
743 743
744 class PreParserFactory { 744 class PreParserFactory {
745 public: 745 public:
746 explicit PreParserFactory(void* extra_param) {} 746 explicit PreParserFactory(void* extra_param) {}
747 PreParserExpression NewLiteral(PreParserIdentifier identifier, 747 PreParserExpression NewStringLiteral(PreParserIdentifier identifier,
748 int pos) { 748 int pos) {
749 return PreParserExpression::Default(); 749 return PreParserExpression::Default();
750 } 750 }
751 PreParserExpression NewNumberLiteral(double number, 751 PreParserExpression NewNumberLiteral(double number,
752 int pos) { 752 int pos) {
753 return PreParserExpression::Default(); 753 return PreParserExpression::Default();
754 } 754 }
755 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern, 755 PreParserExpression NewRegExpLiteral(PreParserIdentifier js_pattern,
756 PreParserIdentifier js_flags, 756 PreParserIdentifier js_flags,
757 int literal_index, 757 int literal_index,
758 int pos) { 758 int pos) {
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 } 1568 }
1569 1569
1570 if (fni_ != NULL) { 1570 if (fni_ != NULL) {
1571 fni_->Infer(); 1571 fni_->Infer();
1572 fni_->Leave(); 1572 fni_->Leave();
1573 } 1573 }
1574 continue; // restart the while 1574 continue; // restart the while
1575 } 1575 }
1576 // Failed to parse as get/set property, so it's just a normal property 1576 // Failed to parse as get/set property, so it's just a normal property
1577 // (which might be called "get" or "set" or something else). 1577 // (which might be called "get" or "set" or something else).
1578 key = factory()->NewLiteral(id, next_pos); 1578 key = factory()->NewStringLiteral(id, next_pos);
1579 break; 1579 break;
1580 } 1580 }
1581 case Token::STRING: { 1581 case Token::STRING: {
1582 Consume(Token::STRING); 1582 Consume(Token::STRING);
1583 IdentifierT string = this->GetSymbol(scanner_); 1583 IdentifierT string = this->GetSymbol(scanner_);
1584 if (fni_ != NULL) this->PushLiteralName(fni_, string); 1584 if (fni_ != NULL) this->PushLiteralName(fni_, string);
1585 uint32_t index; 1585 uint32_t index;
1586 if (this->IsArrayIndex(string, &index)) { 1586 if (this->IsArrayIndex(string, &index)) {
1587 key = factory()->NewNumberLiteral(index, next_pos); 1587 key = factory()->NewNumberLiteral(index, next_pos);
1588 break; 1588 break;
1589 } 1589 }
1590 key = factory()->NewLiteral(string, next_pos); 1590 key = factory()->NewStringLiteral(string, next_pos);
1591 break; 1591 break;
1592 } 1592 }
1593 case Token::NUMBER: { 1593 case Token::NUMBER: {
1594 Consume(Token::NUMBER); 1594 Consume(Token::NUMBER);
1595 key = this->ExpressionFromLiteral(Token::NUMBER, next_pos, scanner_, 1595 key = this->ExpressionFromLiteral(Token::NUMBER, next_pos, scanner_,
1596 factory()); 1596 factory());
1597 break; 1597 break;
1598 } 1598 }
1599 default: 1599 default:
1600 if (Token::IsKeyword(next)) { 1600 if (Token::IsKeyword(next)) {
1601 Consume(next); 1601 Consume(next);
1602 IdentifierT string = this->GetSymbol(scanner_); 1602 IdentifierT string = this->GetSymbol(scanner_);
1603 key = factory()->NewLiteral(string, next_pos); 1603 key = factory()->NewStringLiteral(string, next_pos);
1604 } else { 1604 } else {
1605 Token::Value next = Next(); 1605 Token::Value next = Next();
1606 ReportUnexpectedToken(next); 1606 ReportUnexpectedToken(next);
1607 *ok = false; 1607 *ok = false;
1608 return this->EmptyLiteral(); 1608 return this->EmptyLiteral();
1609 } 1609 }
1610 } 1610 }
1611 1611
1612 // Validate the property 1612 // Validate the property
1613 checker.CheckProperty(next, kValueProperty, CHECK_OK); 1613 checker.CheckProperty(next, kValueProperty, CHECK_OK);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 result = factory()->NewCall(result, args, pos); 1962 result = factory()->NewCall(result, args, pos);
1963 if (fni_ != NULL) fni_->RemoveLastFunction(); 1963 if (fni_ != NULL) fni_->RemoveLastFunction();
1964 break; 1964 break;
1965 } 1965 }
1966 1966
1967 case Token::PERIOD: { 1967 case Token::PERIOD: {
1968 Consume(Token::PERIOD); 1968 Consume(Token::PERIOD);
1969 int pos = position(); 1969 int pos = position();
1970 IdentifierT name = ParseIdentifierName(CHECK_OK); 1970 IdentifierT name = ParseIdentifierName(CHECK_OK);
1971 result = factory()->NewProperty( 1971 result = factory()->NewProperty(
1972 result, factory()->NewLiteral(name, pos), pos); 1972 result, factory()->NewStringLiteral(name, pos), pos);
1973 if (fni_ != NULL) this->PushLiteralName(fni_, name); 1973 if (fni_ != NULL) this->PushLiteralName(fni_, name);
1974 break; 1974 break;
1975 } 1975 }
1976 1976
1977 default: 1977 default:
1978 return result; 1978 return result;
1979 } 1979 }
1980 } 1980 }
1981 } 1981 }
1982 1982
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 this->PushPropertyName(fni_, index); 2084 this->PushPropertyName(fni_, index);
2085 } 2085 }
2086 Expect(Token::RBRACK, CHECK_OK); 2086 Expect(Token::RBRACK, CHECK_OK);
2087 break; 2087 break;
2088 } 2088 }
2089 case Token::PERIOD: { 2089 case Token::PERIOD: {
2090 Consume(Token::PERIOD); 2090 Consume(Token::PERIOD);
2091 int pos = position(); 2091 int pos = position();
2092 IdentifierT name = ParseIdentifierName(CHECK_OK); 2092 IdentifierT name = ParseIdentifierName(CHECK_OK);
2093 expression = factory()->NewProperty( 2093 expression = factory()->NewProperty(
2094 expression, factory()->NewLiteral(name, pos), pos); 2094 expression, factory()->NewStringLiteral(name, pos), pos);
2095 if (fni_ != NULL) { 2095 if (fni_ != NULL) {
2096 this->PushLiteralName(fni_, name); 2096 this->PushLiteralName(fni_, name);
2097 } 2097 }
2098 break; 2098 break;
2099 } 2099 }
2100 default: 2100 default:
2101 return expression; 2101 return expression;
2102 } 2102 }
2103 } 2103 }
2104 ASSERT(false); 2104 ASSERT(false);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 "accessor_get_set"); 2165 "accessor_get_set");
2166 } 2166 }
2167 *ok = false; 2167 *ok = false;
2168 } 2168 }
2169 } 2169 }
2170 2170
2171 2171
2172 } } // v8::internal 2172 } } // v8::internal
2173 2173
2174 #endif // V8_PREPARSER_H 2174 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698