bash-language-server
bash-language-server copied to clipboard
Failed to parse expression: here document
Code that triggers the issue:
#!/bin/sh
cat <<!HEREDOC!
hello
this
is
smth..
!HEREDOC!
Screenshot from VSCode:
Identified on: Bash IDE 1.3.3 + VSCode (Version: 1.33.1)
Seems that the exclamation mark causes the issue. Should it be reported here: https://github.com/tree-sitter/tree-sitter-bash/issues ?
Thanks for reporting this issue. It seems to be a grammar issue.
I created an issue: https://github.com/tree-sitter/tree-sitter-bash/issues/58
I had a similar problem, as I was using this in all my scripts:
cat <<!
text...
!
Although it worked, I thought I was working on the edge of legality, messing with "history" notations, So when I started using shellcheck, I switched to
cat <<Q
text...
Q
Note that the tabbed entry for readability is important (might impact how this gets fixed):
cat <<-!
<tab>...text...
!
i have a similar problem...
read -r -d '' some-var << __EOF__ || true
blabla
blabla
__EOF__
the parser does not like the underlin (__) at the beginning.
This seems to have been fixed in the newer version of the grammar