| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library fasta.operators; |
| 6 |
| 7 /// The user-definable operators in Dart. |
| 8 /// |
| 9 /// The names have been chosen to represent their normal semantic meaning. |
| 10 enum Operator { |
| 11 add, |
| 12 bitwiseAnd, |
| 13 bitwiseNot, |
| 14 bitwiseOr, |
| 15 bitwiseXor, |
| 16 divide, |
| 17 equals, |
| 18 greaterThan, |
| 19 greaterThanEquals, |
| 20 index, |
| 21 indexSet, |
| 22 leftShift, |
| 23 lessThan, |
| 24 lessThanEquals, |
| 25 multiply, |
| 26 modulo, |
| 27 rightShift, |
| 28 subtract, |
| 29 truncatingDivide, |
| 30 unaryMinus, |
| 31 } |
| 32 |
| 33 Operator fromString(String string) { |
| 34 if (identical("+", string)) return Operator.add; |
| 35 if (identical("&", string)) return Operator.bitwiseAnd; |
| 36 if (identical("~", string)) return Operator.bitwiseNot; |
| 37 if (identical("|", string)) return Operator.bitwiseOr; |
| 38 if (identical("^", string)) return Operator.bitwiseXor; |
| 39 if (identical("/", string)) return Operator.divide; |
| 40 if (identical("==", string)) return Operator.equals; |
| 41 if (identical(">", string)) return Operator.greaterThan; |
| 42 if (identical(">=", string)) return Operator.greaterThanEquals; |
| 43 if (identical("[]", string)) return Operator.index; |
| 44 if (identical("[]=", string)) return Operator.indexSet; |
| 45 if (identical("<<", string)) return Operator.leftShift; |
| 46 if (identical("<", string)) return Operator.lessThan; |
| 47 if (identical("<=", string)) return Operator.lessThanEquals; |
| 48 if (identical("*", string)) return Operator.multiply; |
| 49 if (identical("%", string)) return Operator.modulo; |
| 50 if (identical(">>", string)) return Operator.rightShift; |
| 51 if (identical("-", string)) return Operator.subtract; |
| 52 if (identical("~/", string)) return Operator.truncatingDivide; |
| 53 if (identical("unary-", string)) return Operator.unaryMinus; |
| 54 return null; |
| 55 } |
| OLD | NEW |