On 22/02/2021 13:13, Joerg Schilling via austin-group-l at The Open Group wrote:
"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.

Describing state in terms of variables is possible, but if you do, it requires including implicit variables such as program counter as part of the state.

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.

This is not being more specific, this is not "as [you] mentioned" or "as [you] mentioned before", this is the opposite of what you wrote before. You previously wrote "The problem here is that the lexer sees the '(' as a separate token and thus it is seen as pattern." You did get it right this time though: because of the code that you are quoting now, the '(' is not seen as a pattern.

              • ... Geoff Clare via austin-group-l at The Open Group
              • ... Chet Ramey via austin-group-l at The Open Group
              • ... Robert Elz via austin-group-l at The Open Group
          • ... Robert Elz via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Harald van Dijk via austin-group-l at The Open Group
            • ... Robert Elz via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
            • ... Chet Ramey via austin-group-l at The Open Group
            • ... Robert Elz via austin-group-l at The Open Group
              • ... Chet Ramey via austin-group-l at The Open Group
            • ... Joerg Schilling via austin-group-l at The Open Group
            • ... Robert Elz via austin-group-l at The Open Group
          • ... Robert Elz via austin-group-l at The Open Group
  • Re: [1003.1(... shwaresyst via austin-group-l at The Open Group
  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to