You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Line continuation directly before # starts a comment that bash reads as part of the word #354
A backslash-newline (line continuation) directly before # is parsed as a separator, so the # starts a comment node. Bash removes the backslash-newline pair before it splits words, so the # is inside a word and is not a comment.
Input (a backslash at the end of line 1):
echo x\
#literal
Bash 5.3.9 prints x#literal:
$ printf'echo x\\\n#literal\n'| bashx#literal
tree-sitter-bash 0.25.1 (web-tree-sitter 0.27.0) parses it as a command plus a comment, with no error:
Expected: no comment node. The argument should cover x\ and #literal as one word or concatenation, the same way #100 made echo a\ + newline + b one concatenation.
Related: #68 (a # that does not start a word should not begin a comment) and #100 (a newline escaped without whitespace before the backslash). This case is the continuation form of #68. We hit it in a tool that uses the comment nodes to find comments in shell scripts.
Activity