"Harald van Dijk via austin-group-l at The Open Group" <austin-group-l@opengroup.org> wrote:
> >> $ bosh -c 'case x in ( (x) echo match ;; esac' > >> bosh: syntax error at line 1: `(' unexpected > > > > It may be that you are missinterpreting the results. > > I'm not. You say there's no state change that happens as a result of the > first opening parenthesis. However, before the first opening > parenthesis, an opening parenthesis is accepted, while after the first > opening parenthesis, an opening parenthesis is not accepted. Since the > two states differ in what they accept, they cannot be the same state. > Therefore, the opening parenthesis did cause a state change. Given that only "(" is thrown away without modifying internal variables, there is no state change. > > The problem here is that the lexer sees the '(' as a separate token and > > thus it > > is seen as pattern. The next token is the "x" and since "x" is neither ')', > > nor '|', this syntax is not accepted. > > The error message in both bosh and ksh is "`(' unexpected". This error > message means the shell rejected the '(' token, not whatever follows. Of > course it did: a pattern cannot be any arbitrary token, it has to be > what the standard calls a "word", which '(' is not. Well, I should have been a bit more specific. The code is: if (wdval || (word() != ')' && wdval != '|')) synbad(); and wdval is the return value from the previous word() call. Wdval is == 0 in case that the parsed word is recognized as a string. As I mentioned, '(' is not recognized as a string as I mentioned before. Jörg -- EMail:jo...@schily.net Jörg Schilling D-13353 Berlin Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/