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

Re: spurious 'case' parse error



On Sep 22,  3:11pm, Martijn Dekker wrote:
}
} case x in
} (x)echo ok ;;
} esac
} 
} Output:
} test.zsh:2: parse error near `ok'
} 
} The cause is the lack of space after the ')'; that space should be
} optional, but is mandatory in zsh.

That's almost certainly happening because

    case xecho in
    (x|y)echo)echo ok;;
    esac

is valid syntax for zsh, so (x)echo is being parsed as a pattern and then
the closing paren is found to be missing.

The space is optional when in sh emulation where grouping syntax is not
allowed in patterns:

    Src/zsh --emulate sh
    $ case x in    
    > (x|y)echo ok;;
    > esac
    echo ok
    $ 

This is probably not going to change, but we'll see what PWS has to say
when he returns from vacation.



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