| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "src/parsing/token.h" | 7 #include "src/parsing/token.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 | 11 |
| 12 #define T(name, string, precedence) #name, | 12 #define T(name, string, precedence) #name, |
| 13 const char* const Token::name_[NUM_TOKENS] = { | 13 const char* const Token::name_[NUM_TOKENS] = { |
| 14 TOKEN_LIST(T, T) | 14 TOKEN_LIST(T, T) |
| 15 }; | 15 }; |
| 16 #undef T | 16 #undef T |
| 17 | 17 |
| 18 | 18 |
| 19 #define T(name, string, precedence) string, | 19 #define T(name, string, precedence) string, |
| 20 const char* const Token::string_[NUM_TOKENS] = { | 20 const char* const Token::string_[NUM_TOKENS] = { |
| 21 TOKEN_LIST(T, T) | 21 TOKEN_LIST(T, T) |
| 22 }; | 22 }; |
| 23 #undef T | 23 #undef T |
| 24 | 24 |
| 25 constexpr uint8_t length(const char* str) { return str ? strlen(str) : 0; } |
| 26 #define T(name, string, precedence) length(string), |
| 27 const uint8_t Token::string_length_[NUM_TOKENS] = {TOKEN_LIST(T, T)}; |
| 28 #undef T |
| 25 | 29 |
| 26 #define T(name, string, precedence) precedence, | 30 #define T(name, string, precedence) precedence, |
| 27 const int8_t Token::precedence_[NUM_TOKENS] = { | 31 const int8_t Token::precedence_[NUM_TOKENS] = { |
| 28 TOKEN_LIST(T, T) | 32 TOKEN_LIST(T, T) |
| 29 }; | 33 }; |
| 30 #undef T | 34 #undef T |
| 31 | 35 |
| 32 | 36 |
| 33 #define KT(a, b, c) 'T', | 37 #define KT(a, b, c) 'T', |
| 34 #define KK(a, b, c) 'K', | 38 #define KK(a, b, c) 'K', |
| 35 const char Token::token_type[] = { | 39 const char Token::token_type[] = { |
| 36 TOKEN_LIST(KT, KK) | 40 TOKEN_LIST(KT, KK) |
| 37 }; | 41 }; |
| 38 #undef KT | 42 #undef KT |
| 39 #undef KK | 43 #undef KK |
| 40 | 44 |
| 41 } // namespace internal | 45 } // namespace internal |
| 42 } // namespace v8 | 46 } // namespace v8 |
| OLD | NEW |