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

Make expansion context unpacking become recursive #10

Closed
2 tasks done
marcioAlmada opened this issue Nov 22, 2015 · 1 comment
Closed
2 tasks done

Make expansion context unpacking become recursive #10

marcioAlmada opened this issue Nov 22, 2015 · 1 comment

Comments

@marcioAlmada
Copy link
Owner

Sometimes it's necessary to access deep nested Ast elements during expansions:

<?php
macro { /* ... ·some(·complex(·parser(·combinator(), ·match()))) ... */ } >> {
   ·some ··· {
        ·complex ··· {
            ·parser ··· {
                if (·combinator) { ·match }
            }
        }
   }
}

Right now the unpack syntax ·identifier ··· { ...expansion block... } was hardcoded just to pass some tests and need some care:

  • make unpack recursive
  • make captures access recursive (with parent access)

Maybe it would be nice to add a __parent·something in case some inner identifier casts a shadow over an upper one.

marcioAlmada added a commit that referenced this issue Nov 22, 2015
When a macro capture identifier is not found within the current
context, the call bubbles up to the upper context recursively, so
any deep nested block still can access upper level identifiers.

TODO: **maybe** it would be nice to add a `__parent·something`
in case some inner identifier casts a shadow over an upper one.
@marcioAlmada marcioAlmada mentioned this issue Nov 22, 2015
40 tasks
marcioAlmada added a commit that referenced this issue Nov 22, 2015
this serves as a good test for recursive context unpacking #10
@marcioAlmada
Copy link
Owner Author

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

No branches or pull requests

1 participant