mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.21k stars 339 forks source link

syntax: IsIncomplete only works with Interactive #937

Open mvdan opened 1 year ago

mvdan commented 1 year ago

IsIncomplete reports whether a Parser error could have been avoided with extra input bytes. For example, if an io.EOF was encountered while there was an unclosed quote or parenthesis.

Given this godoc, it seems like it should work with all parse APIs, like Parse or Words, but it does not. For example, see https://go.dev/play/p/DxfQ8ZlBFuF.

We should either make it work everyhwere, or document its limitation. Ideally the former.