Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-3.1.4 bug, parsing case ... esac



> } Actually, the shell grammar allows this, this is really a zsh bug.
> 
> Obviously, this is a surprise to me.  Can you point me at "the shell
> grammar" that specifies this?  The informal one in the man pages/info
> sure doesn't.

You can look at the Single Unix Specification -> Commands & Utilities
-> Shell Command Language -> Shell Grammar Rules:

if_clause        : If compound_list Then compound_list else_part Fi
                 | If compound_list Then compound_list           Fi
                 ;

compound_list    :              term
                 | newline_list term
                 |              term separator
                 | newline_list term separator
                 ;

term             : term separator and_or
                 |                and_or
                 ;

and_or           :                         pipeline
                 | and_or AND_IF linebreak pipeline
                 | and_or OR_IF  linebreak pipeline
                 ;


pipeline         :      pipe_sequence
                 | Bang pipe_sequence
                 ;

pipe_sequence    :                             command
                 | pipe_sequence '|' linebreak command
                 ;

command          : simple_command
                 | compound_command
                 | compound_command redirect_list
                 | function_definition
                 ;

compound_command : brace_group
                 | subshell
                 | for_clause
                 | case_clause
                 | if_clause
                 | while_clause
                 | until_clause
                 ;

case_clause      : Case WORD linebreak in linebreak case_list Esac
                 | Case WORD linebreak in linebreak           Esac
                 ;

There is more, but as you see, there is no required separator.
Obviously the manual and info pages are not that accurate.  People are
already complaining aboud the complicated and hard to understand
manual, a formal grammar description would be even more difficult to
read.

Zoli



Messages sorted by: Reverse Date, Date, Thread, Author