aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/printer.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-01-24 21:38:29 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-01-24 21:38:29 +0100
commitdbb94f122ddeb5a37ff2603acbcc701b996958bb (patch)
tree1db39b23ee0826a10683c3231014a8855555dea8 /mesonbuild/ast/printer.py
parent4b3e21b8941fe53b85eb889734c34937438b0928 (diff)
downloadmeson-dbb94f122ddeb5a37ff2603acbcc701b996958bb.zip
meson-dbb94f122ddeb5a37ff2603acbcc701b996958bb.tar.gz
meson-dbb94f122ddeb5a37ff2603acbcc701b996958bb.tar.bz2
Fixed style issues
Diffstat (limited to 'mesonbuild/ast/printer.py')
-rw-r--r--mesonbuild/ast/printer.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/mesonbuild/ast/printer.py b/mesonbuild/ast/printer.py
index 1f58146..60e0b0d 100644
--- a/mesonbuild/ast/printer.py
+++ b/mesonbuild/ast/printer.py
@@ -51,7 +51,7 @@ class AstPrinter(AstVisitor):
self.result += data
self.is_newline = False
- def appendS(self, data: str, node: mparser.BaseNode):
+ def append_padded(self, data: str, node: mparser.BaseNode):
if self.result[-1] not in [' ', '\n']:
data = ' ' + data
self.append(data + ' ', node)
@@ -90,26 +90,26 @@ class AstPrinter(AstVisitor):
def visit_OrNode(self, node: mparser.OrNode):
node.left.accept(self)
- self.appendS('or', node)
+ self.append_padded('or', node)
node.right.accept(self)
def visit_AndNode(self, node: mparser.AndNode):
node.left.accept(self)
- self.appendS('and', node)
+ self.append_padded('and', node)
node.right.accept(self)
def visit_ComparisonNode(self, node: mparser.ComparisonNode):
node.left.accept(self)
- self.appendS(mparser.comparison_map[node.ctype], node)
+ self.append_padded(mparser.comparison_map[node.ctype], node)
node.right.accept(self)
def visit_ArithmeticNode(self, node: mparser.ArithmeticNode):
node.left.accept(self)
- self.appendS(arithmic_map[node.operation], node)
+ self.append_padded(arithmic_map[node.operation], node)
node.right.accept(self)
def visit_NotNode(self, node: mparser.NotNode):
- self.appendS('not', node)
+ self.append_padded('not', node)
node.value.accept(self)
def visit_CodeBlockNode(self, node: mparser.CodeBlockNode):
@@ -143,9 +143,9 @@ class AstPrinter(AstVisitor):
def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode):
varnames = [x.value for x in node.varnames]
- self.appendS('foreach', node)
- self.appendS(', '.join(varnames), node)
- self.appendS(':', node)
+ self.append_padded('foreach', node)
+ self.append_padded(', '.join(varnames), node)
+ self.append_padded(':', node)
node.items.accept(self)
self.newline()
node.block.accept(self)
@@ -154,7 +154,7 @@ class AstPrinter(AstVisitor):
def visit_IfClauseNode(self, node: mparser.IfClauseNode):
prefix = ''
for i in node.ifs:
- self.appendS(prefix + 'if', node)
+ self.append_padded(prefix + 'if', node)
prefix = 'el'
i.accept(self)
if node.elseblock:
@@ -163,7 +163,7 @@ class AstPrinter(AstVisitor):
self.append('endif', node)
def visit_UMinusNode(self, node: mparser.UMinusNode):
- self.appendS('-', node)
+ self.append_padded('-', node)
node.value.accept(self)
def visit_IfNode(self, node: mparser.IfNode):
@@ -173,9 +173,9 @@ class AstPrinter(AstVisitor):
def visit_TernaryNode(self, node: mparser.TernaryNode):
node.condition.accept(self)
- self.appendS('?', node)
+ self.append_padded('?', node)
node.trueblock.accept(self)
- self.appendS(':', node)
+ self.append_padded(':', node)
node.falseblock.accept(self)
def visit_ArgumentNode(self, node: mparser.ArgumentNode):
@@ -192,7 +192,7 @@ class AstPrinter(AstVisitor):
self.newline()
for key, val in node.kwargs.items():
self.append(key, node)
- self.appendS(':', node)
+ self.append_padded(':', node)
val.accept(self)
self.append(', ', node)
if break_args: