@@ -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("-", " |
|
57 | operator_names->insert("-", "__sub__"); | |
58 |
operator_names->insert("*", " |
|
58 | operator_names->insert("*", "__mul__"); | |
59 |
operator_names->insert("/", " |
|
59 | operator_names->insert("/", "__div__"); | |
60 |
operator_names->insert("%", " |
|
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_ |
|
65 | operator_names->insert("<<", "__lshift__"); | |
66 |
operator_names->insert(">>", "shift_ |
|
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("+=", " |
|
70 | operator_names->insert("+=", "__iadd__"); | |
71 |
operator_names->insert("-=", " |
|
71 | operator_names->insert("-=", "__isub__"); | |
72 |
operator_names->insert("*=", " |
|
72 | operator_names->insert("*=", "__imul__"); | |
73 |
operator_names->insert("/=", " |
|
73 | operator_names->insert("/=", "__idiv__"); | |
74 |
operator_names->insert("%=", " |
|
74 | operator_names->insert("%=", "__imod__"); | |
75 |
operator_names->insert("&=", " |
|
75 | operator_names->insert("&=", "__iand__"); | |
76 |
operator_names->insert("|=", " |
|
76 | operator_names->insert("|=", "__ior__"); | |
77 |
operator_names->insert("^=", " |
|
77 | operator_names->insert("^=", "__ixor__"); | |
78 |
operator_names->insert("<<=", "shift_ |
|
78 | operator_names->insert("<<=", "__ilshift__"); | |
79 |
operator_names->insert(">>=", "shift_ |
|
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 |
|
|
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