Skip to content

Commit

Permalink
Individual pieces of ATL can't be reordered
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmcbarn committed Jul 9, 2015
1 parent a0a2ceb commit 6f274c5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions decompiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,31 +127,33 @@ def print_atl_rawmulti(self, ast):
words.append("circles %s" % ast.circles)

# splines
spline_words = WordConcatenator(False)
for name, expressions in ast.splines:
spline_words = WordConcatenator(False)
spline_words.append(name)
for expression in expressions:
spline_words.append("knot", expression)
words.append(spline_words.join())
words.append(spline_words.join())

# properties
property_words = WordConcatenator(False)
for key, value in ast.properties:
words.append("%s %s" % (key, value))
property_words.append(key, value)
words.append(property_words.join())

# with
expression_words = WordConcatenator(False)
# TODO There's a lot of cases where pass isn't needed, since we could
# reorder stuff so there's never 2 expressions in a row. (And it's never
# necessary for the last one, but we don't know what the last one is
# since it could get reordered.)
needs_pass = len(ast.expressions) > 1
for (expression, with_expression) in ast.expressions:
expression_words = WordConcatenator(False)
expression_words.append(expression)
if with_expression:
expression_words.append("with", with_expression)
if needs_pass:
expression_words.append("pass")
words.append(expression_words.join())
words.append(expression_words.join())

self.write(warp + words.join())

Expand Down

0 comments on commit 6f274c5

Please sign in to comment.