15 # |
15 # |
16 # pylint: disable=no-absolute-import,bad-python3-import |
16 # pylint: disable=no-absolute-import,bad-python3-import |
17 |
17 |
18 from __future__ import print_function |
18 from __future__ import print_function |
19 import sys |
19 import sys |
20 from types import StringType |
|
21 import compiler |
20 import compiler |
22 from compiler import ast |
21 from compiler import ast |
23 import os |
22 import os |
24 import copy |
23 import copy |
25 from builtins import str as text |
24 from builtins import str as text |
1386 |
1385 |
1387 def _mul(self, node, current_klass): |
1386 def _mul(self, node, current_klass): |
1388 return self.expr(node.left, current_klass) + " * " + self.expr(node.right, current_klass) |
1387 return self.expr(node.left, current_klass) + " * " + self.expr(node.right, current_klass) |
1389 |
1388 |
1390 def _mod(self, node, current_klass): |
1389 def _mod(self, node, current_klass): |
1391 if isinstance(node.left, ast.Const) and isinstance(node.left.value, StringType): |
1390 if isinstance(node.left, ast.Const) and isinstance(node.left.value, str): |
1392 self.imported_js.add("sprintf.js") # Include the sprintf functionality if it is used |
1391 self.imported_js.add("sprintf.js") # Include the sprintf functionality if it is used |
1393 return "sprintf("+self.expr(node.left, current_klass) + ", " + self.expr(node.right, current_klass)+")" |
1392 return "sprintf("+self.expr(node.left, current_klass) + ", " + self.expr(node.right, current_klass)+")" |
1394 return self.expr(node.left, current_klass) + " % " + self.expr(node.right, current_klass) |
1393 return self.expr(node.left, current_klass) + " % " + self.expr(node.right, current_klass) |
1395 |
1394 |
1396 def _invert(self, node, current_klass): |
1395 def _invert(self, node, current_klass): |