parglare icon indicating copy to clipboard operation
parglare copied to clipboard

ENHANCEMENT: new parameter for call_actions for not reversing

Open goodguy00 opened this issue 5 years ago • 1 comments

  • parglare version: 0.12.0
  • Python version: 3.7.8
  • Operating System: fedora 31

Description

for some uses, a non-reversing actions execution can be of good use. i propose to extend the definition:

      def call_actions(node, context=None, reverse=True):

...

        if (reverse):
            # Recursive right to left, bottom up. Simulate LR reductions.
            for n in reversed(node):
                subresults.append(inner_call_actions(n))
            subresults.reverse()
        else:
            for n in (node):
                subresults.append(inner_call_actions(n))

Usecase

text to be parsed (here a tikz example)

     \draw [line width=2pt,color=wwffqq,domain=-4:12.44] plot(\x,{(-1.4356438- -0.96*\x)/0.26});

in this case, definig the attributes (like "domain") in the same line and using them in the "plot" is only possible in a non-reversed execution. also, coincidentially, then the "draw" directive will be called last allowing for actually executing the completely assembled plot-code.

goodguy00 avatar Aug 12 '20 22:08 goodguy00

@goodguy00 Thanks for the idea and sorry for the delay.

I guess this option might be useful if the language is naturally processed from left to right.

igordejanovic avatar Sep 18 '20 14:09 igordejanovic