On 19/02/2021 15:04, Geoff Clare via austin-group-l at The Open Group wrote:
Harald van Dijk wrote, on 19 Feb 2021:

On 19/02/2021 09:59, Geoff Clare via austin-group-l at The Open Group wrote:
How about changing that problem sentence in 2.10.1 to:

      When a TOKEN is seen where one of those annotated productions could
      be used to reduce the symbol, the applicable rule shall be applied to
      convert the token identifier type of the TOKEN to:

      * The token identifier of the recognized reserved word, for rule 1.
      * A token identifier acceptable at that point in the grammar, for
        all other rules.

This change would allow

   case esac in
   (esac) echo match
   esac

which is currently invalid and rejected by bash, and when invoked in POSIX
mode, also rejected by yash and zsh. Should that become valid, or should
that remain an error?

It's currently valid and the above change wouldn't affect that (since
the change only affects when rule 1 can be applied, and this example
does not involve rule 1 except for the initial "case").

It's currently invalid. The grammar reads:

  case_item        :     pattern ')' linebreak     DSEMI linebreak
                   |     pattern ')' compound_list DSEMI linebreak
                   | '(' pattern ')' linebreak     DSEMI linebreak
                   | '(' pattern ')' compound_list DSEMI linebreak
                   ;
  pattern          :             WORD         /* Apply rule 4 */
                   | pattern '|' WORD         /* Do not apply rule 4 */

Observe that rule 4 is applied for the first word in a pattern even if that pattern follows an opening parenthesis. Because of that, in my example, the esac in parentheses is interpreted as the esac keyword token, not a regular WORD token that makes for a valid pattern.

Your change would make it so that since the esac keyword is not acceptable at that point in the grammar, it would not be interpreted as the esac keyword, unless I am misreading your change.

Cheers,
Harald van Dijk

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

Reply via email to