bashlex
bashlex copied to clipboard
single quoted heredoc token cannot find end
HREDOCs with surrounding single quote are ended with the token sans quotes
cat << 'EOF'
$literal `values` "without" 'interpolation'
EOF
but bashlex expects an end token with the quotes
here-document at line 0 delimited by end-of-file (wanted "'EOF'") (position 16)
when trying
bashlex.parse(": <<'EOF'\nx\nEOF")
ending with the included quotes 'EOF' works for bashlex but not bash
bashlex.parse(": <<'EOF'\nx\n'EOF'")
[CommandNode(parts=[WordNode(parts=[] pos=(0, 1) word=':'), RedirectNode(heredoc=HeredocNode(pos=(10, 17) value="x\n'EOF'") input=None output=WordNode(parts=[] pos=(4, 9) word="'EOF'") pos=(2, 17) type='<<')] pos=(0, 9))]
bash -c "cat <<'EOF'
x
'EOF'"
bash: line 3: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')