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 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 /* Internal token for !(expr is Type) negative type test operator */ \ | 114 /* Internal token for !(expr is Type) negative type test operator */ \ |
115 TOK(kISNOT, "", 11, kNoAttribute) \ | 115 TOK(kISNOT, "", 11, kNoAttribute) \ |
116 \ | 116 \ |
117 TOK(kINDEX, "[]", 0, kNoAttribute) \ | 117 TOK(kINDEX, "[]", 0, kNoAttribute) \ |
118 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \ | 118 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \ |
119 TOK(kNEGATE, "unary-", 0, kNoAttribute) \ | 119 TOK(kNEGATE, "unary-", 0, kNoAttribute) \ |
120 \ | 120 \ |
121 TOK(kIDENT, "", 0, kNoAttribute) \ | 121 TOK(kIDENT, "", 0, kNoAttribute) \ |
122 TOK(kSTRING, "", 0, kNoAttribute) \ | 122 TOK(kSTRING, "", 0, kNoAttribute) \ |
123 TOK(kINTEGER, "", 0, kNoAttribute) \ | 123 TOK(kINTEGER, "", 0, kNoAttribute) \ |
| 124 TOK(kPIXELS, "", 0, kNoAttribute) \ |
124 TOK(kDOUBLE, "", 0, kNoAttribute) \ | 125 TOK(kDOUBLE, "", 0, kNoAttribute) \ |
125 \ | 126 \ |
126 TOK(kINTERPOL_VAR, "$", 0, kNoAttribute) \ | 127 TOK(kINTERPOL_VAR, "$", 0, kNoAttribute) \ |
127 TOK(kINTERPOL_START, "${", 0, kNoAttribute) \ | 128 TOK(kINTERPOL_START, "${", 0, kNoAttribute) \ |
128 TOK(kINTERPOL_END, "}", 0, kNoAttribute) \ | 129 TOK(kINTERPOL_END, "}", 0, kNoAttribute) \ |
129 \ | 130 \ |
130 TOK(kAT, "@", 0, kNoAttribute) \ | 131 TOK(kAT, "@", 0, kNoAttribute) \ |
131 TOK(kHASH, "#", 0, kNoAttribute) \ | 132 TOK(kHASH, "#", 0, kNoAttribute) \ |
132 \ | 133 \ |
133 TOK(kNEWLINE, "\n", 0, kNoAttribute) \ | 134 TOK(kNEWLINE, "\n", 0, kNoAttribute) \ |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 (tok == kINDEX) || | 286 (tok == kINDEX) || |
286 (tok == kASSIGN_INDEX); | 287 (tok == kASSIGN_INDEX); |
287 } | 288 } |
288 | 289 |
289 static bool NeedsLiteralToken(Kind tok) { | 290 static bool NeedsLiteralToken(Kind tok) { |
290 ASSERT(tok < kNumTokens); | 291 ASSERT(tok < kNumTokens); |
291 return ((tok == Token::kINTEGER) || | 292 return ((tok == Token::kINTEGER) || |
292 (tok == Token::kSTRING) || | 293 (tok == Token::kSTRING) || |
293 (tok == Token::kINTERPOL_VAR) || | 294 (tok == Token::kINTERPOL_VAR) || |
294 (tok == Token::kERROR) || | 295 (tok == Token::kERROR) || |
| 296 (tok == Token::kPIXELS) || |
295 (tok == Token::kDOUBLE)); | 297 (tok == Token::kDOUBLE)); |
296 } | 298 } |
297 | 299 |
298 static bool IsBinaryOperator(Token::Kind token); | 300 static bool IsBinaryOperator(Token::Kind token); |
299 static bool IsUnaryOperator(Token::Kind token); | 301 static bool IsUnaryOperator(Token::Kind token); |
300 | 302 |
301 static bool IsBinaryArithmeticOperator(Token::Kind token); | 303 static bool IsBinaryArithmeticOperator(Token::Kind token); |
302 static bool IsUnaryArithmeticOperator(Token::Kind token); | 304 static bool IsUnaryArithmeticOperator(Token::Kind token); |
303 | 305 |
304 // For a comparison operation return an operation for the negated comparison: | 306 // For a comparison operation return an operation for the negated comparison: |
(...skipping 19 matching lines...) Expand all Loading... |
324 private: | 326 private: |
325 static const char* name_[]; | 327 static const char* name_[]; |
326 static const char* tok_str_[]; | 328 static const char* tok_str_[]; |
327 static const uint8_t precedence_[]; | 329 static const uint8_t precedence_[]; |
328 static const Attribute attributes_[]; | 330 static const Attribute attributes_[]; |
329 }; | 331 }; |
330 | 332 |
331 } // namespace dart | 333 } // namespace dart |
332 | 334 |
333 #endif // VM_TOKEN_H_ | 335 #endif // VM_TOKEN_H_ |
OLD | NEW |