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

Side by Side Diff: src/parser.cc

Issue 19300002: ES6: Add support for explicit octal and binary integer literals (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
OLDNEW
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 3555 matching lines...) Expand 10 before | Expand all | Expand 10 after
3566 result = top_scope_->NewUnresolved( 3566 result = top_scope_->NewUnresolved(
3567 factory(), name, interface, scanner().location().beg_pos); 3567 factory(), name, interface, scanner().location().beg_pos);
3568 break; 3568 break;
3569 } 3569 }
3570 3570
3571 case Token::NUMBER: { 3571 case Token::NUMBER: {
3572 Consume(Token::NUMBER); 3572 Consume(Token::NUMBER);
3573 ASSERT(scanner().is_literal_ascii()); 3573 ASSERT(scanner().is_literal_ascii());
3574 double value = StringToDouble(isolate()->unicode_cache(), 3574 double value = StringToDouble(isolate()->unicode_cache(),
3575 scanner().literal_ascii_string(), 3575 scanner().literal_ascii_string(),
3576 ALLOW_HEX | ALLOW_OCTALS); 3576 ALLOW_HEX | ALLOW_OCTAL |
3577 ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY);
3577 result = factory()->NewNumberLiteral(value); 3578 result = factory()->NewNumberLiteral(value);
3578 break; 3579 break;
3579 } 3580 }
3580 3581
3581 case Token::STRING: { 3582 case Token::STRING: {
3582 Consume(Token::STRING); 3583 Consume(Token::STRING);
3583 Handle<String> symbol = GetSymbol(); 3584 Handle<String> symbol = GetSymbol();
3584 result = factory()->NewLiteral(symbol); 3585 result = factory()->NewLiteral(symbol);
3585 if (fni_ != NULL) fni_->PushLiteralName(symbol); 3586 if (fni_ != NULL) fni_->PushLiteralName(symbol);
3586 break; 3587 break;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4019 break; 4020 break;
4020 } 4021 }
4021 key = factory()->NewLiteral(string); 4022 key = factory()->NewLiteral(string);
4022 break; 4023 break;
4023 } 4024 }
4024 case Token::NUMBER: { 4025 case Token::NUMBER: {
4025 Consume(Token::NUMBER); 4026 Consume(Token::NUMBER);
4026 ASSERT(scanner().is_literal_ascii()); 4027 ASSERT(scanner().is_literal_ascii());
4027 double value = StringToDouble(isolate()->unicode_cache(), 4028 double value = StringToDouble(isolate()->unicode_cache(),
4028 scanner().literal_ascii_string(), 4029 scanner().literal_ascii_string(),
4029 ALLOW_HEX | ALLOW_OCTALS); 4030 ALLOW_HEX | ALLOW_OCTAL |
4031 ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY);
4030 key = factory()->NewNumberLiteral(value); 4032 key = factory()->NewNumberLiteral(value);
4031 break; 4033 break;
4032 } 4034 }
4033 default: 4035 default:
4034 if (Token::IsKeyword(next)) { 4036 if (Token::IsKeyword(next)) {
4035 Consume(next); 4037 Consume(next);
4036 Handle<String> string = GetSymbol(); 4038 Handle<String> string = GetSymbol();
4037 key = factory()->NewLiteral(string); 4039 key = factory()->NewLiteral(string);
4038 } else { 4040 } else {
4039 // Unexpected token. 4041 // Unexpected token.
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
5913 ASSERT(info()->isolate()->has_pending_exception()); 5915 ASSERT(info()->isolate()->has_pending_exception());
5914 } else { 5916 } else {
5915 result = ParseProgram(); 5917 result = ParseProgram();
5916 } 5918 }
5917 } 5919 }
5918 info()->SetFunction(result); 5920 info()->SetFunction(result);
5919 return (result != NULL); 5921 return (result != NULL);
5920 } 5922 }
5921 5923
5922 } } // namespace v8::internal 5924 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/conversions-inl.h ('k') | src/preparser.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698