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

Re: wrong error msg



On 03/03/17 08:21 AM, Bart Schaefer wrote:


It gets to be a rather deep subject Sensei, probably not right for the list, but my interest in the subject is profound, tho I come at it from the study of language in general not programming languages per se.
Well, no, that's not really it.  The trouble here is that your "natural"
parse is wrong,

I'd say that 'natural' is whatever folks would be expected to do, and I'd assert that 'my way' is what most folks would do and that any consistent rule could be used, so nothing is 'wrong' a priori, tho of course it might not be the rule actually used! (Unless of course my 'natural' parse cannot ever be consistent!)
C does not allow nesting of visually-indistinguishable tokens, so this
can't arise there.

That's an excellent point. Indeed we use quotes with the same presumed syntactic effect as {}[]() even tho, as you say, they are not visually different. So whereas *we* know what we mean, the parser has no ability to mind-read. Which makes nesting of quote marks necessarily illegal. It's merely theoretical at this point, perhaps that does defeat my view of this. Anyway, I understand what zsh is doing now which is what is relevant here.
Hmm, you could force interactive mode to syntax-check your script like
this:

   zsh -o interactivecomments +o banghist -fnis < scriptfile
   % dquote braceparam dquote> zsh: unmatched "
   % %

but you'll get a LOT of output.
Deep magic.  Too deep for an innocent like me.





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