2017-06-13 00:02:34 +0200, Jilles Tjoelker:
[...]
> I think this is supposed to be handled by rule 1 in the first (non-yacc)
> part of 2.10.2 Shell Grammar Rules, but the text is not clear to me. For
> example, rule 7b for non-initial words in a simple command says rule 1
> should be applied, but reserved words clearly should not be recognized
> in that context.

It's quite obscure to me as well. I have to admit I don't get
the point of 7a. AFAICT 7b already says that if the TOKEN
doesn't contain "=", then rule 1 applies.

Note that SUSv2 was more wordy on "rule 1", clearing some of the
confusion:
http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html#tag_001_010

There are some related bugs:

http://austingroupbugs.net/view.php?id=839
http://austingroupbugs.net/view.php?id=643


> The "lex" of "do" in "until a do b; done" is then WORD, making the
> script impossible to parse.
> 
> > AFAICT, it should be:
> 
> > Until linebreak term sequential_sep Do
> 
> > And there are similar problems with if_clause, else_part,
> > while_clause, until_clause, case_clause, brace_group, do_group
> > at least.
> 
> The sequential_sep is not required by shells in situations like
> 
> until { false; } do echo hi; break; done
> 
> until(false)do echo hi; break; done
> 
> if :; then if :; then echo hi; fi fi
> 
> { { echo hi; } }
> 
> This is handled by the part of rule 1 about contexts where WORD is not
> valid but at least one reserved word is.
[...]

You're right, I didn't think of that.

Reply via email to