class OperatorSpecs # TODO: move the binary op and unary op specs here shared var _rightAssoc = { # CC: change to Set 'STARSTAR': true, 'ASSIGN': true, 'PLUS_EQUALS': true, 'MINUS_EQUALS': true, 'STAR_EQUALS': true, 'SLASH_EQUALS': true, 'PERCENT_EQUALS': true, 'AMPERSAND_EQUALS': true, 'VERTICAL_BAR_EQUALS': true, 'CARET_EQUALS': true, 'DOUBLE_LT_EQUALS': true, 'DOUBLE_GT_EQUALS': true, } get rightAssoc as Dictionary .processTable return _rightAssoc # reference: http://msdn2.microsoft.com/en-us/library/ms229032.aspx var _table = [ 'u, , , ToXxx or FromXxx, op_Implicit', 'u, , , ToXxx or FromXxx, op_Explicit', 'b, +, +, Add, op_Addition', 'b, -, -, Subtract, op_Subtraction', 'b, *, *, Multiply, op_Multiply', 'br, **, , , ', 'b, /, /, Divide, op_Division', 'b, //, , IntegerDivide, op_IntegerDivision', 'b, %, %, Mod, op_Modulus', 'b, ^, ^, Xor, op_ExclusiveOr', 'b, &, &, BitwiseAnd, op_BitwiseAnd', 'b, |, |, BitwiseOr, op_BitwiseOr', 'b, and, &&, And, op_LogicalAnd', 'b, or, ||, Or, op_LogicalOr', 'br, =, =, Assign, op_Assign', 'b, <<, <<, LeftShift, op_LeftShift', 'b, >>, >>, RightShift, op_RightShift', 'b, , , LeftShift, op_SignedRightShift', 'b, , , RightShift, op_UnsignedRightShift', 'b, ==, ==, Equals, op_Equality', 'b, >, >, CompareTo, op_GreaterThan', 'b, <, <, CompareTo, op_LessThan', 'b, <>, !=, Equals, op_Inequality', 'b, >=, >=, CompareTo, op_GreaterThanOrEqual', 'b, <=, <=, CompareTo, op_LessThanOrEqual', 'br, *=, *=, Multiply, op_MultiplicationAssignment', 'br, -=, -=, Subtract, op_SubtractionAssignment', 'br, ^=, ^=, Xor, op_ExclusiveOrAssignment', 'br, <<=, <<=, LeftShift, op_LeftShiftAssignment', 'br, %=, %=, Mod, op_ModulusAssignment', 'br, +=, +=, Add, op_AdditionAssignment', 'br, &=, &=, BitwiseAnd, op_BitwiseAndAssignment', 'br, |=, |=, BitwiseOr, op_BitwiseOrAssignment', 'br, /=, /=, Divide, op_DivisionAssignment', 'br, //=, , IntegerDivide, op_IntegerDivide', 'u, , --, Decrement, op_Decrement', 'u, , ++, Increment, op_Increment', 'u, -, -, Negate, op_UnaryNegation', 'u, +, +, Plus, op_UnaryPlus', 'u, ~, ~, OnesComplement, op_OnesComplement', ] var _opSpecs = List() var _binaryOpSpecsByCobraText = Dictionary() var _unaryOpSpecsByCobraText = Dictionary() get opSpecs as List .processTable return _opSpecs get binaryOpSpecsByCobraText as Dictionary .processTable return _binaryOpSpecsByCobraText get unaryOpSpecsByCobraText as Dictionary .processTable return _unaryOpSpecsByCobraText var _didProcessTable = false def processTable if _didProcessTable return for row in _table parts = row.split(c',') assert parts.length == 5, row for i = 0 .. parts.length parts[i] = parts[i].trim spec = OpSpec(parts) _opSpecs.add(spec) if spec.cobraText <> '' if spec.isBinary _binaryOpSpecsByCobraText.add(spec.cobraText, spec) if spec.isUnary _unaryOpSpecsByCobraText.add(spec.cobraText, spec) _didProcessTable = true class OpSpec var _isBinary as bool var _isRightAssoc as bool var _cobraText as String var _sharpText as String var _methodName as String var _opMethodName as String cue init(specParts as System.Collections.IList) base.init _isBinary = specParts[0] to String in ['b', 'br'] _isRightAssoc = specParts[0] == 'br' _cobraText = specParts[1] to String _sharpText = specParts[2] to String _methodName = specParts[3] to String _opMethodName = specParts[4] to String get isBinary from var get isUnary as bool return not _isBinary get isRightAssoc from var get cobraText from var get sharpText from var get methodName from var get opMethodName from var