Description
Several heredoc edge cases are not handled correctly.
Scope
- Multiple heredocs in loop conditions:
while cat <<E1 && cat <<E2; do ... done fails to parse
- Heredoc piped to external command:
cat <<EOF | sort produces wrong ordering (heredoc content not piped correctly)
- Heredoc pipe continuation:
cat <<EOF | followed by sort on next line — same pipe issue
- Partial quote in delimiter:
<<'EOF'"2" should combine to delimiter EOF2 with quoting preventing expansion
- Heredoc followed by multiline dquote:
cat <<EOF; echo "two\nthree" on same line does not parse correctly
Repro
Multiple heredocs in condition:
while cat <<E1 && cat <<E2; do cat <<E3; break; done
1
E1
2
E2
3
E3
bashkit: parse error "expected 'do'" — expected output: 1\n2\n3
Heredoc pipe ordering:
cat <<EOF | sort
c
a
b
EOF
bashkit outputs: c\na\nb (unsorted) — expected: a\nb\nc
Test coverage
6 skipped tests in crates/bashkit/tests/spec_cases/bash/heredoc-edge.test.sh (PR #351).
Oils reference: https://github.com/oilshell/oil/blob/master/spec/here-doc.test.sh
Description
Several heredoc edge cases are not handled correctly.
Scope
while cat <<E1 && cat <<E2; do ... donefails to parsecat <<EOF | sortproduces wrong ordering (heredoc content not piped correctly)cat <<EOF |followed bysorton next line — same pipe issue<<'EOF'"2"should combine to delimiterEOF2with quoting preventing expansioncat <<EOF; echo "two\nthree"on same line does not parse correctlyRepro
Multiple heredocs in condition:
bashkit: parse error "expected 'do'" — expected output:
1\n2\n3Heredoc pipe ordering:
bashkit outputs:
c\na\nb(unsorted) — expected:a\nb\ncTest coverage
6 skipped tests in
crates/bashkit/tests/spec_cases/bash/heredoc-edge.test.sh(PR #351).Oils reference: https://github.com/oilshell/oil/blob/master/spec/here-doc.test.sh