Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wrong error msg



On 02/03/17 08:47 AM, Bart Schaefer wrote:
torch% echo "Restore \"${previous?\"? (y/n)"
dquote braceparam dquote>
Well shucks. I never understood those things, I always presumed it was some bizarre message, not a triple message. So bloody obvious now that I see it. But I don't see how the parser finds trouble with dquotes. Boiling it down:

    $ echo "${previous"
    dquote braceparam dquote>

Are you saying that, working left to right, the parser sorta can't consider the dquote closed since it becomes 'distracted' by the unclosed brace? IOW, until the brace is closed it doesn't know that the second dquote is 'available' since it could be something that's ...

  echo "Outer quote ${var:="inner quote"} outer again"

... right, the dquote could be within braces so the parser doesn't know that it is free to close the outside quote and leaves the issue unresolved and then simply reports the unresoved issues. Thus the second dquote is actually seen as another error -- an unclosed quote within an unclosed brace within and unclosed quote, yes? Whereas a human would tend to parse it outside-in and thus match the dquotes first and then see the unmatched brace -- thus a single error. But an interpreted language probably doesn't have that liberty. I think I get it.

But why is it 'worse' in a script? I'd expect more finality at EOF and thus, if anything, better messages. Anyway I think I can finally really use those error messages, that's huge, many thanks.



Messages sorted by: Reverse Date, Date, Thread, Author