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

Side by Side Diff: src/parser.h

Issue 6246064: Issue 117 - strict mode and future reserved words (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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/messages.js ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 Handle<Object> GetBoilerplateValue(Expression* expression); 539 Handle<Object> GetBoilerplateValue(Expression* expression);
540 540
541 enum FunctionLiteralType { 541 enum FunctionLiteralType {
542 EXPRESSION, 542 EXPRESSION,
543 DECLARATION, 543 DECLARATION,
544 NESTED 544 NESTED
545 }; 545 };
546 546
547 ZoneList<Expression*>* ParseArguments(bool* ok); 547 ZoneList<Expression*>* ParseArguments(bool* ok);
548 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name, 548 FunctionLiteral* ParseFunctionLiteral(Handle<String> var_name,
549 bool name_is_reserved,
549 int function_token_position, 550 int function_token_position,
550 FunctionLiteralType type, 551 FunctionLiteralType type,
551 bool* ok); 552 bool* ok);
552 553
553 554
554 // Magical syntax support. 555 // Magical syntax support.
555 Expression* ParseV8Intrinsic(bool* ok); 556 Expression* ParseV8Intrinsic(bool* ok);
556 557
557 INLINE(Token::Value peek()) { 558 INLINE(Token::Value peek()) {
558 if (stack_overflow_) return Token::ILLEGAL; 559 if (stack_overflow_) return Token::ILLEGAL;
559 return scanner().peek(); 560 return scanner().peek();
560 } 561 }
561 562
562 INLINE(Token::Value Next()) { 563 INLINE(Token::Value Next()) {
563 // BUG 1215673: Find a thread safe way to set a stack limit in 564 // BUG 1215673: Find a thread safe way to set a stack limit in
564 // pre-parse mode. Otherwise, we cannot safely pre-parse from other 565 // pre-parse mode. Otherwise, we cannot safely pre-parse from other
565 // threads. 566 // threads.
566 if (stack_overflow_) { 567 if (stack_overflow_) {
567 return Token::ILLEGAL; 568 return Token::ILLEGAL;
568 } 569 }
569 if (StackLimitCheck().HasOverflowed()) { 570 if (StackLimitCheck().HasOverflowed()) {
570 // Any further calls to Next or peek will return the illegal token. 571 // Any further calls to Next or peek will return the illegal token.
571 // The current call must return the next token, which might already 572 // The current call must return the next token, which might already
572 // have been peek'ed. 573 // have been peek'ed.
573 stack_overflow_ = true; 574 stack_overflow_ = true;
574 } 575 }
575 return scanner().Next(); 576 return scanner().Next();
576 } 577 }
577 578
579 bool peek_any_identifier();
580
578 INLINE(void Consume(Token::Value token)); 581 INLINE(void Consume(Token::Value token));
579 void Expect(Token::Value token, bool* ok); 582 void Expect(Token::Value token, bool* ok);
580 bool Check(Token::Value token); 583 bool Check(Token::Value token);
581 void ExpectSemicolon(bool* ok); 584 void ExpectSemicolon(bool* ok);
582 585
583 Handle<String> LiteralString(PretenureFlag tenured) { 586 Handle<String> LiteralString(PretenureFlag tenured) {
584 if (scanner().is_literal_ascii()) { 587 if (scanner().is_literal_ascii()) {
585 return Factory::NewStringFromAscii(scanner().literal_ascii_string(), 588 return Factory::NewStringFromAscii(scanner().literal_ascii_string(),
586 tenured); 589 tenured);
587 } else { 590 } else {
(...skipping 13 matching lines...) Expand all
601 } 604 }
602 605
603 Handle<String> GetSymbol(bool* ok); 606 Handle<String> GetSymbol(bool* ok);
604 607
605 // Get odd-ball literals. 608 // Get odd-ball literals.
606 Literal* GetLiteralUndefined(); 609 Literal* GetLiteralUndefined();
607 Literal* GetLiteralTheHole(); 610 Literal* GetLiteralTheHole();
608 Literal* GetLiteralNumber(double value); 611 Literal* GetLiteralNumber(double value);
609 612
610 Handle<String> ParseIdentifier(bool* ok); 613 Handle<String> ParseIdentifier(bool* ok);
614 Handle<String> ParseIdentifierOrReservedWord(bool* is_reserved, bool* ok);
611 Handle<String> ParseIdentifierName(bool* ok); 615 Handle<String> ParseIdentifierName(bool* ok);
612 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get, 616 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get,
613 bool* is_set, 617 bool* is_set,
614 bool* ok); 618 bool* ok);
615 619
616 // Strict mode validation of LValue expressions 620 // Strict mode validation of LValue expressions
617 void CheckStrictModeLValue(Expression* expression, 621 void CheckStrictModeLValue(Expression* expression,
618 const char* error, 622 const char* error,
619 bool* ok); 623 bool* ok);
620 624
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } 786 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); }
783 // Converts the currently parsed literal to a JavaScript String. 787 // Converts the currently parsed literal to a JavaScript String.
784 Handle<String> GetString(); 788 Handle<String> GetString();
785 789
786 JsonScanner scanner_; 790 JsonScanner scanner_;
787 bool stack_overflow_; 791 bool stack_overflow_;
788 }; 792 };
789 } } // namespace v8::internal 793 } } // namespace v8::internal
790 794
791 #endif // V8_PARSER_H_ 795 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698