bash-parser
bash-parser copied to clipboard
Here-doc implementation
@parro-it since here-docs are a different beast than here-strings (#49), could you comment on what would be required to implement? I'm not familiar with Bison and neither have a good idea what the AST would look like.
I can see how extending the posix grammar it can be made to go into a javascript routine. E.g
io_here: [
~ [
~ 'DLESS here_end',
+ '$$ = yy.ioHere($1, $here_end);'
+ ],
+ [
+ 'DLESSDASH here_end',
+ '$$ = yy.ioHere($1, $here_end);'
+ ]
],
But its not clear to me how to handle the here-doc text as a specially interpolated string, and stop at the custom here-doc marker.
ref docs http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04
I remember I have a plan on how to implement this feature, it was one of the only POSIX left to be done. But I don't remember the plan details 😔. I have to think about this some time more...