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

Re: wrong error msg



On Mar 2, 12:32pm, Ray Andrews wrote:
}
} ... 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?

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.

As usual, computers are much better at following what you did say than
they are at following what you intended to say.

} But why is it 'worse' in a script?

It's not really 'worse' -- but in a script there's no opportunity to
print the PS2 prompt and wait for you to figure out what you meant.
It just goes on reading from the file until it manages to find a
matching quote, and then goes on until it finds a matching brace,
and so on, probably piling up mismatched elements until it reaches
end of file and has to pick one of them to complain about.

Note that *none* of this is actually an *error* until the point at
which the input runs dry and there is still something left to close,
or until all the pairs have been closed and the thing that remains
doesn't make sense (e.g., "bad substitution").



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