ljd
ljd copied to clipboard
a*b => a * b, a/b => a / b, etc...
------------------------------ ljd/lua/writer.py ------------------------------
index dede627..2416648 100644
@@ -287,19 +287,19 @@ class Visitor(traverse.Visitor):
self._write(" + ")
elif node.type == nodes.BinaryOperator.T_SUBTRACT:
self._write(" - ")
elif node.type == nodes.BinaryOperator.T_DIVISION:
- self._write("/")
+ self._write(" / ")
elif node.type == nodes.BinaryOperator.T_MULTIPLY:
- self._write("*")
+ self._write(" * ")
elif node.type == nodes.BinaryOperator.T_MOD:
- self._write("%")
+ self._write(" % ")
else:
assert node.type == nodes.BinaryOperator.T_POW
- self._write("^")
+ self._write(" ^ ")
if right_parentheses:
self._write("(")
self._visit(node.right)
@@ -601,11 +601,11 @@ class Visitor(traverse.Visitor):
def visit_numeric_loop_warp(self, node):
self._write("for ")
self._visit(node.index)
- self._write("=")
+ self._write(" = ")
self._visit(node.controls)
Why?
I'm going to address formatting in the next milestone and current state is just some temporary state.
As there is no line addressing right now, it would be wise to just use some standard lua code formatter to keep things nice and clean for your taste. And i'll rather stick with the style I find more readable (because I don't have the option to run the reformatter on a debugger output) until there will be some more flexible formatting implementation.
This issue will be fixed as soon as there will be a configurable formatting implementation.
Why? for uniformity. if the operators + and - go with spaces, then * and / (etc...) must also be surrounded by spaces. or vice versa.