| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 static int Precedence(Kind tok) { | 251 static int Precedence(Kind tok) { |
| 252 ASSERT(tok < kNumTokens); | 252 ASSERT(tok < kNumTokens); |
| 253 return precedence_[tok]; | 253 return precedence_[tok]; |
| 254 } | 254 } |
| 255 | 255 |
| 256 static Attribute Attributes(Kind tok) { | 256 static Attribute Attributes(Kind tok) { |
| 257 ASSERT(tok < kNumTokens); | 257 ASSERT(tok < kNumTokens); |
| 258 return attributes_[tok]; | 258 return attributes_[tok]; |
| 259 } | 259 } |
| 260 | 260 |
| 261 // TODO(hausner): Remove the pseudo keyword 'negate' when old operator |
| 262 // syntax for unary - is removed. |
| 261 static bool CanBeOverloaded(Kind tok) { | 263 static bool CanBeOverloaded(Kind tok) { |
| 262 ASSERT(tok < kNumTokens); | 264 ASSERT(tok < kNumTokens); |
| 263 return IsRelationalOperator(tok) || | 265 return IsRelationalOperator(tok) || |
| 264 (tok == kEQ) || | 266 (tok == kEQ) || |
| 265 (tok >= kADD && tok <= kMOD) || // Arithmetic operations. | 267 (tok >= kADD && tok <= kMOD) || // Arithmetic operations. |
| 266 (tok >= kBIT_OR && tok <= kSHR) || // Bit operations. | 268 (tok >= kBIT_OR && tok <= kSHR) || // Bit operations. |
| 267 (tok == kINDEX) || | 269 (tok == kINDEX) || |
| 268 (tok == kASSIGN_INDEX) || | 270 (tok == kASSIGN_INDEX) || |
| 269 (tok == kNEGATE); | 271 (tok == kNEGATE); |
| 270 } | 272 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 285 static const char* name_[]; | 287 static const char* name_[]; |
| 286 static const char* tok_str_[]; | 288 static const char* tok_str_[]; |
| 287 static const uint8_t precedence_[]; | 289 static const uint8_t precedence_[]; |
| 288 static const Attribute attributes_[]; | 290 static const Attribute attributes_[]; |
| 289 }; | 291 }; |
| 290 | 292 |
| 291 | 293 |
| 292 } // namespace dart | 294 } // namespace dart |
| 293 | 295 |
| 294 #endif // VM_TOKEN_H_ | 296 #endif // VM_TOKEN_H_ |
| OLD | NEW |