marcioAlmada / yay

Yay is a high level PHP preprocessor
https://github.com/marcioAlmada/yay
MIT License
572 stars 35 forks source link

Can't alias in custom parser #56

Closed assertchris closed 5 years ago

assertchris commented 6 years ago

I'm seeing a strange bug, and the best way I could think of to explain it is with a video...

Can't alias in custom parser (video)

As mentioned in the video, this problem disappears when the aliased parser is more deeply nested.

assertchris commented 5 years ago

Ok! I think I've narrowed the problem down.

  1. It doesn't seem to matter whether or not the custom parsers are in the Yay namespace or not
  2. It works when I use a custom parser with a custom expander:
$(macro) {
    $(\Pre\Standard\Parser\argument())
} >> {
    $$(\Pre\Standard\Expander\argument($(argument)))
}
  1. It doesn't work when I try and expand an AST in the expander block:
$(macro) {
    // https://github.com/marcioAlmada/yay/issues/56
    $(\Pre\Standard\Parser\argument() as alias)
} >> {
    $(alias ... {
        // snip

Edit: You can find the code to support this at pre-standard

marcioAlmada commented 5 years ago

Hello. Any news?

assertchris commented 5 years ago

Will check with the newest master.

assertchris commented 5 years ago

Don't see this happening anymore.