mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-16 10:03:08 -07:00
Fix parsing of &;; in case statements
This commit is contained in:
parent
deab146fab
commit
fd909eeca0
1 changed files with 3 additions and 0 deletions
|
@ -1281,6 +1281,8 @@ readSeparatorOp = do
|
||||||
spacing
|
spacing
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
char ';'
|
char ';'
|
||||||
|
-- In case statements we might have foo & ;;
|
||||||
|
notFollowedBy2 $ char ';'
|
||||||
parseProblemAt pos ErrorC 1045 "It's not 'foo &; bar', just 'foo & bar'."
|
parseProblemAt pos ErrorC 1045 "It's not 'foo &; bar', just 'foo & bar'."
|
||||||
return '&'
|
return '&'
|
||||||
) <|> char ';' <|> char '&'
|
) <|> char ';' <|> char '&'
|
||||||
|
@ -1653,6 +1655,7 @@ readInClause = do
|
||||||
|
|
||||||
prop_readCaseClause = isOk readCaseClause "case foo in a ) lol; cow;; b|d) fooo; esac"
|
prop_readCaseClause = isOk readCaseClause "case foo in a ) lol; cow;; b|d) fooo; esac"
|
||||||
prop_readCaseClause2 = isOk readCaseClause "case foo\n in * ) echo bar;; esac"
|
prop_readCaseClause2 = isOk readCaseClause "case foo\n in * ) echo bar;; esac"
|
||||||
|
prop_readCaseClause3 = isOk readCaseClause "case foo\n in * ) echo bar & ;; esac"
|
||||||
readCaseClause = called "case expression" $ do
|
readCaseClause = called "case expression" $ do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
g_Case
|
g_Case
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue