| OLD | NEW |
| 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_TOKEN_H_ | 5 #ifndef V8_TOKEN_H_ |
| 6 #define V8_TOKEN_H_ | 6 #define V8_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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 K(EXPORT, "export", 0) \ | 156 K(EXPORT, "export", 0) \ |
| 157 K(EXTENDS, "extends", 0) \ | 157 K(EXTENDS, "extends", 0) \ |
| 158 K(IMPORT, "import", 0) \ | 158 K(IMPORT, "import", 0) \ |
| 159 K(LET, "let", 0) \ | 159 K(LET, "let", 0) \ |
| 160 K(STATIC, "static", 0) \ | 160 K(STATIC, "static", 0) \ |
| 161 K(YIELD, "yield", 0) \ | 161 K(YIELD, "yield", 0) \ |
| 162 K(SUPER, "super", 0) \ | 162 K(SUPER, "super", 0) \ |
| 163 \ | 163 \ |
| 164 /* Illegal token - not able to scan. */ \ | 164 /* Illegal token - not able to scan. */ \ |
| 165 T(ILLEGAL, "ILLEGAL", 0) \ | 165 T(ILLEGAL, "ILLEGAL", 0) \ |
| 166 T(ESCAPED_KEYWORD, NULL, 0) \ |
| 167 T(ESCAPED_STRICT_RESERVED_WORD, NULL, 0) \ |
| 166 \ | 168 \ |
| 167 /* Scanner-internal use only. */ \ | 169 /* Scanner-internal use only. */ \ |
| 168 T(WHITESPACE, NULL, 0) \ | 170 T(WHITESPACE, NULL, 0) \ |
| 169 T(UNINITIALIZED, NULL, 0) \ | 171 T(UNINITIALIZED, NULL, 0) \ |
| 170 \ | 172 \ |
| 171 /* ES6 Template Literals */ \ | 173 /* ES6 Template Literals */ \ |
| 172 T(TEMPLATE_SPAN, NULL, 0) \ | 174 T(TEMPLATE_SPAN, NULL, 0) \ |
| 173 T(TEMPLATE_TAIL, NULL, 0) | 175 T(TEMPLATE_TAIL, NULL, 0) |
| 174 | 176 |
| 175 | 177 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 193 // Predicates | 195 // Predicates |
| 194 static bool IsKeyword(Value tok) { | 196 static bool IsKeyword(Value tok) { |
| 195 return token_type[tok] == 'K'; | 197 return token_type[tok] == 'K'; |
| 196 } | 198 } |
| 197 | 199 |
| 198 static bool IsIdentifier(Value tok, LanguageMode language_mode, | 200 static bool IsIdentifier(Value tok, LanguageMode language_mode, |
| 199 bool is_generator) { | 201 bool is_generator) { |
| 200 switch (tok) { | 202 switch (tok) { |
| 201 case IDENTIFIER: | 203 case IDENTIFIER: |
| 202 return true; | 204 return true; |
| 205 case ESCAPED_STRICT_RESERVED_WORD: |
| 203 case FUTURE_STRICT_RESERVED_WORD: | 206 case FUTURE_STRICT_RESERVED_WORD: |
| 204 case LET: | 207 case LET: |
| 205 case STATIC: | 208 case STATIC: |
| 206 return is_sloppy(language_mode); | 209 return is_sloppy(language_mode); |
| 207 case YIELD: | 210 case YIELD: |
| 208 return !is_generator && is_sloppy(language_mode); | 211 return !is_generator && is_sloppy(language_mode); |
| 209 default: | 212 default: |
| 210 return false; | 213 return false; |
| 211 } | 214 } |
| 212 UNREACHABLE(); | 215 UNREACHABLE(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 static const char* const name_[NUM_TOKENS]; | 318 static const char* const name_[NUM_TOKENS]; |
| 316 static const char* const string_[NUM_TOKENS]; | 319 static const char* const string_[NUM_TOKENS]; |
| 317 static const int8_t precedence_[NUM_TOKENS]; | 320 static const int8_t precedence_[NUM_TOKENS]; |
| 318 static const char token_type[NUM_TOKENS]; | 321 static const char token_type[NUM_TOKENS]; |
| 319 }; | 322 }; |
| 320 | 323 |
| 321 } // namespace internal | 324 } // namespace internal |
| 322 } // namespace v8 | 325 } // namespace v8 |
| 323 | 326 |
| 324 #endif // V8_TOKEN_H_ | 327 #endif // V8_TOKEN_H_ |
| OLD | NEW |