Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENHANCEMENT: new parameter for call_actions for not reversing #125

Open
goodguy00 opened this issue Aug 12, 2020 · 1 comment
Open

ENHANCEMENT: new parameter for call_actions for not reversing #125

goodguy00 opened this issue Aug 12, 2020 · 1 comment

Comments

@goodguy00
Copy link

  • 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.

@igordejanovic
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants