On 4/10/24 8:51 PM, nbow...@draconx.ca wrote:

Bash Version: 5.2
Patch Level: 21
Release Status: release

Description:
The POSIX shell grammar specifies that a newline may optionally appear
before the in keyword of a for loop.
        [...]
However, if the exact same loop is placed within the body of a case
statement, current versions of bash exit with a syntax error:

Thanks for the report. This came in in 2017 with better support for POSIX
grammar rule 6, which is concerned with returning IN as the third word of
a case or for command. The idea is that you need to keep track of whether
or not you're returning an IN for a case command (in which case you enter
a case pattern list state and can't perform alias expansion or return
reserved words unless ESAC is the next token) or for a for command. The
state management gets fooled by the multiple newlines; the parser needs
more context.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to