1.1 --- a/micropython/common.py Sat Aug 07 02:06:15 2010 +0200
1.2 +++ b/micropython/common.py Mon Aug 09 01:23:05 2010 +0200
1.3 @@ -216,4 +216,52 @@
1.4 "UnarySub" : "__neg__"
1.5 }
1.6
1.7 +operator_functions = {
1.8 +
1.9 + # Binary operations.
1.10 +
1.11 + "Add" : "add",
1.12 + "Bitand" : "and_",
1.13 + "Bitor" : "or_",
1.14 + "Bitxor" : "xor",
1.15 + "Div" : "div",
1.16 + "FloorDiv" : "floordiv",
1.17 + "LeftShift" : "lshift",
1.18 + "Mod" : "mod",
1.19 + "Mul" : "mul",
1.20 + "Power" : "pow",
1.21 + "RightShift" : "rshift",
1.22 + "Sub" : "sub",
1.23 +
1.24 + # Unary operations.
1.25 +
1.26 + "Invert" : "invert",
1.27 + "UnaryAdd" : "pos",
1.28 + "UnarySub" : "neg",
1.29 +
1.30 + # Augmented assignment.
1.31 +
1.32 + "+=" : "iadd",
1.33 + "-=" : "isub",
1.34 + "*=" : "imul",
1.35 + "/=" : "idiv",
1.36 + "//=" : "ifloordiv",
1.37 + "%=" : "imod",
1.38 + "**=" : "ipow",
1.39 + "<<=" : "ilshift",
1.40 + ">>=" : "irshift",
1.41 + "&=" : "iand",
1.42 + "^=" : "ixor",
1.43 + "|=" : "ior",
1.44 +
1.45 + # Comparisons.
1.46 +
1.47 + "==" : "eq",
1.48 + "!=" : "ne",
1.49 + "<" : "lt",
1.50 + "<=" : "le",
1.51 + ">=" : "ge",
1.52 + ">" : "gt"
1.53 + }
1.54 +
1.55 # vim: tabstop=4 expandtab shiftwidth=4