mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix BUG_CASEEMPT: empty 'case' list was syntax error
'case x in esac' should be syntactically correct, but was an error: $ ksh -c 'case x in esac' ksh: syntax error at line 1: `case' unmatched Inserting a newline was a workaround: $ ksh -c $'case x in\nesac' (no output) The problem was that the 'esac' reserved word was not being recognised if it immediately followed the 'in' reserved word. src/cmd/ksh93/sh/lex.c: sh_lex(): - Do not turn off recognition of reserved words after 'in' if we're in a 'case' construct; only do this for 'for' and 'select'. src/cmd/ksh93/tests/case.sh: - Add seven regression test for correct recognition of 'esac'. Only two failed on ksh93. The rest is to catch future bugs. Fixes: https://github.com/ksh93/ksh/issues/177
This commit is contained in:
parent
29b11bba3a
commit
e37aa358bf
3 changed files with 15 additions and 1 deletions
|
|
@ -1503,7 +1503,7 @@ breakloop:
|
|||
}
|
||||
else
|
||||
lp->lex.skipword = 0;
|
||||
if(c==INSYM)
|
||||
if(c==INSYM && !lp->lex.incase)
|
||||
lp->lex.reservok = 0;
|
||||
else if(c==TIMESYM)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue