marcioAlmada/yay

Make expansion context unpacking become recursive

marcioAlmada opened this issue · 1 comments

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.