| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_TOKEN_H_ | 5 #ifndef VM_TOKEN_H_ |
| 6 #define VM_TOKEN_H_ | 6 #define VM_TOKEN_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 TOK(kGTE, ">=", 10, kNoAttribute) \ | 108 TOK(kGTE, ">=", 10, kNoAttribute) \ |
| 109 \ | 109 \ |
| 110 /* Internal token for !(expr is Type) negative type test operator */ \ | 110 /* Internal token for !(expr is Type) negative type test operator */ \ |
| 111 TOK(kISNOT, "", 10, kNoAttribute) \ | 111 TOK(kISNOT, "", 10, kNoAttribute) \ |
| 112 \ | 112 \ |
| 113 /* Internal token for (expr as Type) type cast operator */ \ | 113 /* Internal token for (expr as Type) type cast operator */ \ |
| 114 TOK(kAS, "", 10, kNoAttribute) \ | 114 TOK(kAS, "", 10, kNoAttribute) \ |
| 115 \ | 115 \ |
| 116 TOK(kINDEX, "[]", 0, kNoAttribute) \ | 116 TOK(kINDEX, "[]", 0, kNoAttribute) \ |
| 117 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \ | 117 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \ |
| 118 TOK(kNEGATE, "unary-", 0, kNoAttribute) \ |
| 118 \ | 119 \ |
| 119 TOK(kIDENT, "", 0, kNoAttribute) \ | 120 TOK(kIDENT, "", 0, kNoAttribute) \ |
| 120 TOK(kSTRING, "", 0, kNoAttribute) \ | 121 TOK(kSTRING, "", 0, kNoAttribute) \ |
| 121 TOK(kINTEGER, "", 0, kNoAttribute) \ | 122 TOK(kINTEGER, "", 0, kNoAttribute) \ |
| 122 TOK(kDOUBLE, "", 0, kNoAttribute) \ | 123 TOK(kDOUBLE, "", 0, kNoAttribute) \ |
| 123 \ | 124 \ |
| 124 TOK(kINTERPOL_VAR, "$", 0, kNoAttribute) \ | 125 TOK(kINTERPOL_VAR, "$", 0, kNoAttribute) \ |
| 125 TOK(kINTERPOL_START, "${", 0, kNoAttribute) \ | 126 TOK(kINTERPOL_START, "${", 0, kNoAttribute) \ |
| 126 TOK(kINTERPOL_END, "}", 0, kNoAttribute) \ | 127 TOK(kINTERPOL_END, "}", 0, kNoAttribute) \ |
| 127 \ | 128 \ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 KW(kFALSE, "false", 0, kKeyword) \ | 160 KW(kFALSE, "false", 0, kKeyword) \ |
| 160 KW(kFINAL, "final", 0, kKeyword) \ | 161 KW(kFINAL, "final", 0, kKeyword) \ |
| 161 KW(kFINALLY, "finally", 0, kKeyword) \ | 162 KW(kFINALLY, "finally", 0, kKeyword) \ |
| 162 KW(kFOR, "for", 0, kKeyword) \ | 163 KW(kFOR, "for", 0, kKeyword) \ |
| 163 KW(kGET, "get", 0, kPseudoKeyword) \ | 164 KW(kGET, "get", 0, kPseudoKeyword) \ |
| 164 KW(kIF, "if", 0, kKeyword) \ | 165 KW(kIF, "if", 0, kKeyword) \ |
| 165 KW(kIMPLEMENTS, "implements", 0, kPseudoKeyword) \ | 166 KW(kIMPLEMENTS, "implements", 0, kPseudoKeyword) \ |
| 166 KW(kIN, "in", 0, kKeyword) \ | 167 KW(kIN, "in", 0, kKeyword) \ |
| 167 KW(kINTERFACE, "interface", 0, kPseudoKeyword) \ | 168 KW(kINTERFACE, "interface", 0, kPseudoKeyword) \ |
| 168 KW(kIS, "is", 10, kKeyword) \ | 169 KW(kIS, "is", 10, kKeyword) \ |
| 169 KW(kNEGATE, "negate", 0, kPseudoKeyword) \ | |
| 170 KW(kNEW, "new", 0, kKeyword) \ | 170 KW(kNEW, "new", 0, kKeyword) \ |
| 171 KW(kNULL, "null", 0, kKeyword) \ | 171 KW(kNULL, "null", 0, kKeyword) \ |
| 172 KW(kOPERATOR, "operator", 0, kPseudoKeyword) \ | 172 KW(kOPERATOR, "operator", 0, kPseudoKeyword) \ |
| 173 KW(kRETURN, "return", 0, kKeyword) \ | 173 KW(kRETURN, "return", 0, kKeyword) \ |
| 174 KW(kSET, "set", 0, kPseudoKeyword) \ | 174 KW(kSET, "set", 0, kPseudoKeyword) \ |
| 175 KW(kSTATIC, "static", 0, kPseudoKeyword) \ | 175 KW(kSTATIC, "static", 0, kPseudoKeyword) \ |
| 176 KW(kSUPER, "super", 0, kKeyword) \ | 176 KW(kSUPER, "super", 0, kKeyword) \ |
| 177 KW(kSWITCH, "switch", 0, kKeyword) \ | 177 KW(kSWITCH, "switch", 0, kKeyword) \ |
| 178 KW(kTHIS, "this", 0, kKeyword) \ | 178 KW(kTHIS, "this", 0, kKeyword) \ |
| 179 KW(kTHROW, "throw", 0, kKeyword) \ | 179 KW(kTHROW, "throw", 0, kKeyword) \ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 static bool NeedsLiteralToken(Kind tok) { | 280 static bool NeedsLiteralToken(Kind tok) { |
| 281 ASSERT(tok < kNumTokens); | 281 ASSERT(tok < kNumTokens); |
| 282 return ((tok == Token::kINTEGER) || | 282 return ((tok == Token::kINTEGER) || |
| 283 (tok == Token::kSTRING) || | 283 (tok == Token::kSTRING) || |
| 284 (tok == Token::kINTERPOL_VAR) || | 284 (tok == Token::kINTERPOL_VAR) || |
| 285 (tok == Token::kERROR) || | 285 (tok == Token::kERROR) || |
| 286 (tok == Token::kDOUBLE)); | 286 (tok == Token::kDOUBLE)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 static bool IsBinaryToken(Token::Kind token); | 289 static bool IsBinaryOperator(Token::Kind token); |
| 290 static bool IsUnaryToken(Token::Kind token); | 290 static bool IsPrefixOperator(Token::Kind token); |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 static const char* name_[]; | 293 static const char* name_[]; |
| 294 static const char* tok_str_[]; | 294 static const char* tok_str_[]; |
| 295 static const uint8_t precedence_[]; | 295 static const uint8_t precedence_[]; |
| 296 static const Attribute attributes_[]; | 296 static const Attribute attributes_[]; |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 | 299 |
| 300 } // namespace dart | 300 } // namespace dart |
| 301 | 301 |
| 302 #endif // VM_TOKEN_H_ | 302 #endif // VM_TOKEN_H_ |
| OLD | NEW |