On 02/03/17 03:14 PM, Bart Schaefer wrote:
As usual, computers are much better at following what you did say than they are at following what you intended to say.
Although IIRC the most natural parsing system is the way we do it -- outside-in, as, I believe, C does it, but I think the point needs to be hammered in that that's not available to an interpreter. One of those deep breakages that ruin your life.
} 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.
I see, so rather than collect a cascade of errors, since it can't show the prompt it doesn't even try. Well .... it could try couldn't it? I can see that it might have to abort that tho. I'd have found my error faster if the command line style message had been shown. And in the case of unclosings of every kind, isn't it a fairly simple list?
Absolutely. Although surely there are constructions that can't go on for ever? Or are there? My editor has nice syntax highlighting, and if you erase a closing quote, the entire rest of the file turns green (for quoted text) so there's no limit to that, at least.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").