| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/token.h" | 5 #include "vm/token.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| 11 #define TOKEN_NAME(t, s, p, a) #t, | 11 #define TOKEN_NAME(t, s, p, a) #t, |
| 12 const char* Token::name_[] = { | 12 const char* Token::name_[] = {DART_TOKEN_LIST(TOKEN_NAME) |
| 13 DART_TOKEN_LIST(TOKEN_NAME) | 13 DART_KEYWORD_LIST(TOKEN_NAME)}; |
| 14 DART_KEYWORD_LIST(TOKEN_NAME) | |
| 15 }; | |
| 16 #undef TOKEN_NAME | 14 #undef TOKEN_NAME |
| 17 | 15 |
| 18 #define TOKEN_STRING(t, s, p, a) s, | 16 #define TOKEN_STRING(t, s, p, a) s, |
| 19 const char* Token::tok_str_[] = { | 17 const char* Token::tok_str_[] = {DART_TOKEN_LIST(TOKEN_STRING) |
| 20 DART_TOKEN_LIST(TOKEN_STRING) | 18 DART_KEYWORD_LIST(TOKEN_STRING)}; |
| 21 DART_KEYWORD_LIST(TOKEN_STRING) | |
| 22 }; | |
| 23 #undef TOKEN_STRING | 19 #undef TOKEN_STRING |
| 24 | 20 |
| 25 #define TOKEN_PRECEDENCE(t, s, p, a) p, | 21 #define TOKEN_PRECEDENCE(t, s, p, a) p, |
| 26 const uint8_t Token::precedence_[] = { | 22 const uint8_t Token::precedence_[] = {DART_TOKEN_LIST(TOKEN_PRECEDENCE) |
| 27 DART_TOKEN_LIST(TOKEN_PRECEDENCE) | 23 DART_KEYWORD_LIST(TOKEN_PRECEDENCE)}; |
| 28 DART_KEYWORD_LIST(TOKEN_PRECEDENCE) | |
| 29 }; | |
| 30 #undef TOKEN_PRECEDENCE | 24 #undef TOKEN_PRECEDENCE |
| 31 | 25 |
| 32 #define TOKEN_ATTRIBUTE(t, s, p, a) a, | 26 #define TOKEN_ATTRIBUTE(t, s, p, a) a, |
| 33 const Token::Attribute Token::attributes_[] = { | 27 const Token::Attribute Token::attributes_[] = { |
| 34 DART_TOKEN_LIST(TOKEN_ATTRIBUTE) | 28 DART_TOKEN_LIST(TOKEN_ATTRIBUTE) DART_KEYWORD_LIST(TOKEN_ATTRIBUTE)}; |
| 35 DART_KEYWORD_LIST(TOKEN_ATTRIBUTE) | |
| 36 }; | |
| 37 #undef TOKEN_ATTRIBUTE | 29 #undef TOKEN_ATTRIBUTE |
| 38 | 30 |
| 39 | 31 |
| 40 bool Token::IsBinaryOperator(Token::Kind token) { | 32 bool Token::IsBinaryOperator(Token::Kind token) { |
| 41 switch (token) { | 33 switch (token) { |
| 42 case Token::kOR: | 34 case Token::kOR: |
| 43 case Token::kAND: | 35 case Token::kAND: |
| 44 return true; | 36 return true; |
| 45 default: | 37 default: |
| 46 return IsBinaryArithmeticOperator(token); | 38 return IsBinaryArithmeticOperator(token); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 71 return false; | 63 return false; |
| 72 } | 64 } |
| 73 } | 65 } |
| 74 | 66 |
| 75 | 67 |
| 76 bool Token::IsUnaryArithmeticOperator(Token::Kind token) { | 68 bool Token::IsUnaryArithmeticOperator(Token::Kind token) { |
| 77 return (token == kBIT_NOT) || (token == kNEGATE); | 69 return (token == kBIT_NOT) || (token == kNEGATE); |
| 78 } | 70 } |
| 79 | 71 |
| 80 } // namespace dart | 72 } // namespace dart |
| OLD | NEW |