bash-parser icon indicating copy to clipboard operation
bash-parser copied to clipboard

Here-doc implementation

Open dotmpe opened this issue 7 years ago • 1 comments
trafficstars

@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

dotmpe avatar Apr 23 '18 17:04 dotmpe

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...

parro-it avatar Apr 24 '18 07:04 parro-it