##// 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 if (!operator_names) {
53 if (!operator_names) {
54 operator_names = new QHash<QString, QString>;
54 operator_names = new QHash<QString, QString>;
55
55
56 operator_names->insert("+", "add");
56 operator_names->insert("+", "__add__");
57 operator_names->insert("-", "subtract");
57 operator_names->insert("-", "__sub__");
58 operator_names->insert("*", "multiply");
58 operator_names->insert("*", "__mul__");
59 operator_names->insert("/", "divide");
59 operator_names->insert("/", "__div__");
60 operator_names->insert("%", "modulo");
60 operator_names->insert("%", "__mod__");
61 operator_names->insert("&", "and");
61 operator_names->insert("&", "__and__");
62 operator_names->insert("|", "or");
62 operator_names->insert("|", "__or__");
63 operator_names->insert("^", "xor");
63 operator_names->insert("^", "__xor__");
64 operator_names->insert("~", "negate");
64 operator_names->insert("~", "__negate__");
65 operator_names->insert("<<", "shift_left");
65 operator_names->insert("<<", "__lshift__");
66 operator_names->insert(">>", "shift_right");
66 operator_names->insert(">>", "__rshift__");
67
67
68 // assigments
68 // assigments
69 operator_names->insert("=", "assign");
69 operator_names->insert("=", "assign");
70 operator_names->insert("+=", "add_assign");
70 operator_names->insert("+=", "__iadd__");
71 operator_names->insert("-=", "subtract_assign");
71 operator_names->insert("-=", "__isub__");
72 operator_names->insert("*=", "multiply_assign");
72 operator_names->insert("*=", "__imul__");
73 operator_names->insert("/=", "divide_assign");
73 operator_names->insert("/=", "__idiv__");
74 operator_names->insert("%=", "modulo_assign");
74 operator_names->insert("%=", "__imod__");
75 operator_names->insert("&=", "and_assign");
75 operator_names->insert("&=", "__iand__");
76 operator_names->insert("|=", "or_assign");
76 operator_names->insert("|=", "__ior__");
77 operator_names->insert("^=", "xor_assign");
77 operator_names->insert("^=", "__ixor__");
78 operator_names->insert("<<=", "shift_left_assign");
78 operator_names->insert("<<=", "__ilshift__");
79 operator_names->insert(">>=", "shift_right_assign");
79 operator_names->insert(">>=", "__irshift__");
80
80
81 // Logical
81 // Logical
82 operator_names->insert("&&", "logical_and");
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 AbstractMetaBuilder::AbstractMetaBuilder()
128 AbstractMetaBuilder::AbstractMetaBuilder()
General Comments 0
You need to be logged in to leave comments. Login now