Open DavidBakerEffendi opened 4 months ago
At one point I had something barely working using the following approach:
<<-
(and its variants). Token-wise, SOME_HEREDOC
would be some kind of identifier.<<-
IDENTIFIER
... \n
... IDENTIFIER
(matching the first one) into another synthetic token representing the heredoc's text.The thing is this isn't the whole story, though: they could be nested, interpolated, have methods directly applied to them, etc and it's all these use-cases that make this more time-consuming than it should otherwise be. I still reckon that the sanest way to go about this is to have a 2nd lexer pass though, hence why I'm sharing this somewhat positive experiment here.
HereDoc in a function argument is interesting, as in this case, the heredoc only starts from the next line onwards, and is meant to be inserted in the argument index where the first heredoc token starts.
Right now, the above causes a syntax issue which will fail parsing for that file.