tree-sitter-bash icon indicating copy to clipboard operation
tree-sitter-bash copied to clipboard

Parse error for here document inside an if with variable

Open skovhus opened this issue 6 years ago • 4 comments
trafficstars

Parse fails for the entire document when you have a here document inside an if, that contains a variable as the first expression.

MWE:

if true; then
  a_string='some stuff to cat'
  cat <<XXX
${a_string}
XXX
fi

The issue does not occur if:

  • not inside an if
  • there is anything except newlines before ${a_string}, including whitespace

Origin: https://github.com/mads-hartmann/bash-language-server/issues/136

skovhus avatar Sep 23 '19 19:09 skovhus

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.88. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Sep 23 '19 19:09 issue-label-bot[bot]

Also fails with for :

for a in b c d; do
     read NAME <<EOF
${a}
EOF
done

deedf avatar May 19 '20 12:05 deedf

Also fails within function definitions.

deedf avatar May 20 '20 13:05 deedf

It also fails everywhere.

brandonkal avatar Jul 21 '20 23:07 brandonkal

This seems to have been fixed in the newer version of the grammar

skovhus avatar Nov 25 '22 13:11 skovhus