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

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

Powered by Google App Engine
This is Rietveld 408576698