Comment 2 for bug 568178

Revision history for this message
Yary H (spam-launchpad) wrote :

Works, thanks!

Now I've found another heredoc related issue, an edge case.

Both shell scripts and perl allow code after the heredoc, on the same line.

Shell example (bteq is the Teredata sql shell)-

bteq <<EOF | grep '\\$'| read start_dt_ya start_dt end_dt_ya end_dt
-- SQL code here
select '$',start_date- '1 year', start_date ....
EOF

Perl example-
print SOCKET <<HTML or warn "Cannot write to socket: $!";
<input type="text">html continues...
HTML

In both those cases, the mumamo heredoc modes don't detect the heredoc closer, because it is looking for the entire line.

Also, both ksh, bash (all shells?) and perl allow quoted strings as the heredoc terminator, here's perl's documentation:

  The terminating string may be either an identifier (a word), or some quoted text. An unquoted identifier works like double quotes. There may not be a space between the << and the identifier, unless the identifier is explicitly quoted. (If you put a space it will be treated as a null identifier, which is valid, and matches the first empty line.)

shell example:
cat<<'foo bar'
foo
bar
foobar
foo bar

So, it seems the bit that detects the heredoc terminator needs a little polishing

Thanks for your help