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

Side by Side Diff: src/scanner.cc

Issue 1024603002: Remove --harmony-numeric-literal flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 8 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
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 31
32 // ---------------------------------------------------------------------------- 32 // ----------------------------------------------------------------------------
33 // Scanner 33 // Scanner
34 34
35 Scanner::Scanner(UnicodeCache* unicode_cache) 35 Scanner::Scanner(UnicodeCache* unicode_cache)
36 : unicode_cache_(unicode_cache), 36 : unicode_cache_(unicode_cache),
37 octal_pos_(Location::invalid()), 37 octal_pos_(Location::invalid()),
38 harmony_modules_(false), 38 harmony_modules_(false),
39 harmony_numeric_literals_(false),
40 harmony_classes_(false), 39 harmony_classes_(false),
41 harmony_unicode_(false) {} 40 harmony_unicode_(false) {}
42 41
43 42
44 void Scanner::Initialize(Utf16CharacterStream* source) { 43 void Scanner::Initialize(Utf16CharacterStream* source) {
45 source_ = source; 44 source_ = source;
46 // Need to capture identifiers in order to recognize "get" and "set" 45 // Need to capture identifiers in order to recognize "get" and "set"
47 // in object literals. 46 // in object literals.
48 Init(); 47 Init();
49 // Skip initial whitespace allowing HTML comment ends just like 48 // Skip initial whitespace allowing HTML comment ends just like
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 // hex number 946 // hex number
948 kind = HEX; 947 kind = HEX;
949 AddLiteralCharAdvance(); 948 AddLiteralCharAdvance();
950 if (!IsHexDigit(c0_)) { 949 if (!IsHexDigit(c0_)) {
951 // we must have at least one hex digit after 'x'/'X' 950 // we must have at least one hex digit after 'x'/'X'
952 return Token::ILLEGAL; 951 return Token::ILLEGAL;
953 } 952 }
954 while (IsHexDigit(c0_)) { 953 while (IsHexDigit(c0_)) {
955 AddLiteralCharAdvance(); 954 AddLiteralCharAdvance();
956 } 955 }
957 } else if (harmony_numeric_literals_ && (c0_ == 'o' || c0_ == 'O')) { 956 } else if (c0_ == 'o' || c0_ == 'O') {
958 kind = OCTAL; 957 kind = OCTAL;
959 AddLiteralCharAdvance(); 958 AddLiteralCharAdvance();
960 if (!IsOctalDigit(c0_)) { 959 if (!IsOctalDigit(c0_)) {
961 // we must have at least one octal digit after 'o'/'O' 960 // we must have at least one octal digit after 'o'/'O'
962 return Token::ILLEGAL; 961 return Token::ILLEGAL;
963 } 962 }
964 while (IsOctalDigit(c0_)) { 963 while (IsOctalDigit(c0_)) {
965 AddLiteralCharAdvance(); 964 AddLiteralCharAdvance();
966 } 965 }
967 } else if (harmony_numeric_literals_ && (c0_ == 'b' || c0_ == 'B')) { 966 } else if (c0_ == 'b' || c0_ == 'B') {
968 kind = BINARY; 967 kind = BINARY;
969 AddLiteralCharAdvance(); 968 AddLiteralCharAdvance();
970 if (!IsBinaryDigit(c0_)) { 969 if (!IsBinaryDigit(c0_)) {
971 // we must have at least one binary digit after 'b'/'B' 970 // we must have at least one binary digit after 'b'/'B'
972 return Token::ILLEGAL; 971 return Token::ILLEGAL;
973 } 972 }
974 while (IsBinaryDigit(c0_)) { 973 while (IsBinaryDigit(c0_)) {
975 AddLiteralCharAdvance(); 974 AddLiteralCharAdvance();
976 } 975 }
977 } else if ('0' <= c0_ && c0_ <= '7') { 976 } else if ('0' <= c0_ && c0_ <= '7') {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 } 1559 }
1561 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1560 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1562 } 1561 }
1563 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1562 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1564 1563
1565 backing_store_.AddBlock(bytes); 1564 backing_store_.AddBlock(bytes);
1566 return backing_store_.EndSequence().start(); 1565 return backing_store_.EndSequence().start();
1567 } 1566 }
1568 1567
1569 } } // namespace v8::internal 1568 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698