##// END OF EJS Templates
renamed known python operators to python naming conventions...
florianlink -
r76:fb379199aefd
parent child
Show More
@@ -53,30 +53,30 QString rename_operator(const QString &oper)
53 53 if (!operator_names) {
54 54 operator_names = new QHash<QString, QString>;
55 55
56 operator_names->insert("+", "add");
57 operator_names->insert("-", "subtract");
58 operator_names->insert("*", "multiply");
59 operator_names->insert("/", "divide");
60 operator_names->insert("%", "modulo");
61 operator_names->insert("&", "and");
62 operator_names->insert("|", "or");
63 operator_names->insert("^", "xor");
64 operator_names->insert("~", "negate");
65 operator_names->insert("<<", "shift_left");
66 operator_names->insert(">>", "shift_right");
56 operator_names->insert("+", "__add__");
57 operator_names->insert("-", "__sub__");
58 operator_names->insert("*", "__mul__");
59 operator_names->insert("/", "__div__");
60 operator_names->insert("%", "__mod__");
61 operator_names->insert("&", "__and__");
62 operator_names->insert("|", "__or__");
63 operator_names->insert("^", "__xor__");
64 operator_names->insert("~", "__negate__");
65 operator_names->insert("<<", "__lshift__");
66 operator_names->insert(">>", "__rshift__");
67 67
68 68 // assigments
69 69 operator_names->insert("=", "assign");
70 operator_names->insert("+=", "add_assign");
71 operator_names->insert("-=", "subtract_assign");
72 operator_names->insert("*=", "multiply_assign");
73 operator_names->insert("/=", "divide_assign");
74 operator_names->insert("%=", "modulo_assign");
75 operator_names->insert("&=", "and_assign");
76 operator_names->insert("|=", "or_assign");
77 operator_names->insert("^=", "xor_assign");
78 operator_names->insert("<<=", "shift_left_assign");
79 operator_names->insert(">>=", "shift_right_assign");
70 operator_names->insert("+=", "__iadd__");
71 operator_names->insert("-=", "__isub__");
72 operator_names->insert("*=", "__imul__");
73 operator_names->insert("/=", "__idiv__");
74 operator_names->insert("%=", "__imod__");
75 operator_names->insert("&=", "__iand__");
76 operator_names->insert("|=", "__ior__");
77 operator_names->insert("^=", "__ixor__");
78 operator_names->insert("<<=", "__ilshift__");
79 operator_names->insert(">>=", "__irshift__");
80 80
81 81 // Logical
82 82 operator_names->insert("&&", "logical_and");
@@ -117,7 +117,12 QString rename_operator(const QString &oper)
117 117 }
118 118 }
119 119
120 return "operator_" + operator_names->value(op);
120 QString r = operator_names->value(op);
121 if (r.startsWith("__")) {
122 return r;
123 } else {
124 return "operator_" + r;
125 }
121 126 }
122 127
123 128 AbstractMetaBuilder::AbstractMetaBuilder()
General Comments 0
You need to be logged in to leave comments. Login now