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

Side by Side Diff: src/parsing/token.h

Issue 1841543003: [esnext] implement frontend changes for async/await proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Uncomment that test Created 4 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
« no previous file with comments | « src/parsing/scanner.cc ('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 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_PARSING_TOKEN_H_ 5 #ifndef V8_PARSING_TOKEN_H_
6 #define V8_PARSING_TOKEN_H_ 6 #define V8_PARSING_TOKEN_H_
7 7
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 K(FALSE_LITERAL, "false", 0) \ 142 K(FALSE_LITERAL, "false", 0) \
143 T(NUMBER, NULL, 0) \ 143 T(NUMBER, NULL, 0) \
144 T(SMI, NULL, 0) \ 144 T(SMI, NULL, 0) \
145 T(STRING, NULL, 0) \ 145 T(STRING, NULL, 0) \
146 \ 146 \
147 /* Identifiers (not keywords or future reserved words). */ \ 147 /* Identifiers (not keywords or future reserved words). */ \
148 T(IDENTIFIER, NULL, 0) \ 148 T(IDENTIFIER, NULL, 0) \
149 \ 149 \
150 /* Future reserved words (ECMA-262, section 7.6.1.2). */ \ 150 /* Future reserved words (ECMA-262, section 7.6.1.2). */ \
151 T(FUTURE_STRICT_RESERVED_WORD, NULL, 0) \ 151 T(FUTURE_STRICT_RESERVED_WORD, NULL, 0) \
152 K(ASYNC, "async", 0) \
152 /* `await` is a reserved word in module code only */ \ 153 /* `await` is a reserved word in module code only */ \
153 K(AWAIT, "await", 0) \ 154 K(AWAIT, "await", 0) \
154 K(CLASS, "class", 0) \ 155 K(CLASS, "class", 0) \
155 K(CONST, "const", 0) \ 156 K(CONST, "const", 0) \
156 K(ENUM, "enum", 0) \ 157 K(ENUM, "enum", 0) \
157 K(EXPORT, "export", 0) \ 158 K(EXPORT, "export", 0) \
158 K(EXTENDS, "extends", 0) \ 159 K(EXTENDS, "extends", 0) \
159 K(IMPORT, "import", 0) \ 160 K(IMPORT, "import", 0) \
160 K(LET, "let", 0) \ 161 K(LET, "let", 0) \
161 K(STATIC, "static", 0) \ 162 K(STATIC, "static", 0) \
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 // Predicates 196 // Predicates
196 static bool IsKeyword(Value tok) { 197 static bool IsKeyword(Value tok) {
197 return token_type[tok] == 'K'; 198 return token_type[tok] == 'K';
198 } 199 }
199 200
200 static bool IsIdentifier(Value tok, LanguageMode language_mode, 201 static bool IsIdentifier(Value tok, LanguageMode language_mode,
201 bool is_generator, bool is_module) { 202 bool is_generator, bool is_module) {
202 switch (tok) { 203 switch (tok) {
203 case IDENTIFIER: 204 case IDENTIFIER:
205 case ASYNC:
204 return true; 206 return true;
205 case ESCAPED_STRICT_RESERVED_WORD: 207 case ESCAPED_STRICT_RESERVED_WORD:
206 case FUTURE_STRICT_RESERVED_WORD: 208 case FUTURE_STRICT_RESERVED_WORD:
207 case LET: 209 case LET:
208 case STATIC: 210 case STATIC:
209 return is_sloppy(language_mode); 211 return is_sloppy(language_mode);
210 case YIELD: 212 case YIELD:
211 return !is_generator && is_sloppy(language_mode); 213 return !is_generator && is_sloppy(language_mode);
212 case AWAIT: 214 case AWAIT:
213 return !is_module; 215 return !is_module;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 static const char* const name_[NUM_TOKENS]; 336 static const char* const name_[NUM_TOKENS];
335 static const char* const string_[NUM_TOKENS]; 337 static const char* const string_[NUM_TOKENS];
336 static const int8_t precedence_[NUM_TOKENS]; 338 static const int8_t precedence_[NUM_TOKENS];
337 static const char token_type[NUM_TOKENS]; 339 static const char token_type[NUM_TOKENS];
338 }; 340 };
339 341
340 } // namespace internal 342 } // namespace internal
341 } // namespace v8 343 } // namespace v8
342 344
343 #endif // V8_PARSING_TOKEN_H_ 345 #endif // V8_PARSING_TOKEN_H_
OLDNEW
« no previous file with comments | « src/parsing/scanner.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698