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 RUNTIME_VM_TOKEN_H_ | 5 #ifndef RUNTIME_VM_TOKEN_H_ |
6 #define RUNTIME_VM_TOKEN_H_ | 6 #define RUNTIME_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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 (tok == Token::kERROR) || | 294 (tok == Token::kERROR) || |
295 (tok == Token::kDOUBLE)); | 295 (tok == Token::kDOUBLE)); |
296 } | 296 } |
297 | 297 |
298 static bool IsBinaryOperator(Token::Kind token); | 298 static bool IsBinaryOperator(Token::Kind token); |
299 static bool IsUnaryOperator(Token::Kind token); | 299 static bool IsUnaryOperator(Token::Kind token); |
300 | 300 |
301 static bool IsBinaryArithmeticOperator(Token::Kind token); | 301 static bool IsBinaryArithmeticOperator(Token::Kind token); |
302 static bool IsUnaryArithmeticOperator(Token::Kind token); | 302 static bool IsUnaryArithmeticOperator(Token::Kind token); |
303 | 303 |
| 304 static bool IsBinaryBitwiseOperator(Token::Kind token); |
| 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: |
305 // !(a (op) b) === a (op') b | 307 // !(a (op) b) === a (op') b |
306 static Token::Kind NegateComparison(Token::Kind op) { | 308 static Token::Kind NegateComparison(Token::Kind op) { |
307 switch (op) { | 309 switch (op) { |
308 case Token::kEQ: return Token::kNE; | 310 case Token::kEQ: return Token::kNE; |
309 case Token::kNE: return Token::kEQ; | 311 case Token::kNE: return Token::kEQ; |
310 case Token::kLT: return Token::kGTE; | 312 case Token::kLT: return Token::kGTE; |
311 case Token::kGT: return Token::kLTE; | 313 case Token::kGT: return Token::kLTE; |
312 case Token::kLTE: return Token::kGT; | 314 case Token::kLTE: return Token::kGT; |
313 case Token::kGTE: return Token::kLT; | 315 case Token::kGTE: return Token::kLT; |
(...skipping 10 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 // RUNTIME_VM_TOKEN_H_ | 335 #endif // RUNTIME_VM_TOKEN_H_ |
OLD | NEW |