| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 static bool NeedsLiteralToken(Kind tok) { | 284 static bool NeedsLiteralToken(Kind tok) { |
| 285 ASSERT(tok < kNumTokens); | 285 ASSERT(tok < kNumTokens); |
| 286 return ((tok == Token::kINTEGER) || | 286 return ((tok == Token::kINTEGER) || |
| 287 (tok == Token::kSTRING) || | 287 (tok == Token::kSTRING) || |
| 288 (tok == Token::kINTERPOL_VAR) || | 288 (tok == Token::kINTERPOL_VAR) || |
| 289 (tok == Token::kERROR) || | 289 (tok == Token::kERROR) || |
| 290 (tok == Token::kDOUBLE)); | 290 (tok == Token::kDOUBLE)); |
| 291 } | 291 } |
| 292 | 292 |
| 293 static bool IsBinaryOperator(Token::Kind token); | 293 static bool IsBinaryOperator(Token::Kind token); |
| 294 static bool IsPrefixOperator(Token::Kind token); | 294 static bool IsUnaryOperator(Token::Kind token); |
| 295 |
| 296 static bool IsBinaryArithmeticOperator(Token::Kind token); |
| 297 static bool IsUnaryArithmeticOperator(Token::Kind token); |
| 295 | 298 |
| 296 // For a comparison operation return an operation for the negated comparison: | 299 // For a comparison operation return an operation for the negated comparison: |
| 297 // !(a (op) b) === a (op') b | 300 // !(a (op) b) === a (op') b |
| 298 static Token::Kind NegateComparison(Token::Kind op) { | 301 static Token::Kind NegateComparison(Token::Kind op) { |
| 299 switch (op) { | 302 switch (op) { |
| 300 case Token::kEQ: return Token::kNE; | 303 case Token::kEQ: return Token::kNE; |
| 301 case Token::kNE: return Token::kEQ; | 304 case Token::kNE: return Token::kEQ; |
| 302 case Token::kLT: return Token::kGTE; | 305 case Token::kLT: return Token::kGTE; |
| 303 case Token::kGT: return Token::kLTE; | 306 case Token::kGT: return Token::kLTE; |
| 304 case Token::kLTE: return Token::kGT; | 307 case Token::kLTE: return Token::kGT; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 317 static const char* name_[]; | 320 static const char* name_[]; |
| 318 static const char* tok_str_[]; | 321 static const char* tok_str_[]; |
| 319 static const uint8_t precedence_[]; | 322 static const uint8_t precedence_[]; |
| 320 static const Attribute attributes_[]; | 323 static const Attribute attributes_[]; |
| 321 }; | 324 }; |
| 322 | 325 |
| 323 | 326 |
| 324 } // namespace dart | 327 } // namespace dart |
| 325 | 328 |
| 326 #endif // VM_TOKEN_H_ | 329 #endif // VM_TOKEN_H_ |
| OLD | NEW |