Fix parsing of &;; in case statements

This commit is contained in:
Vidar Holen 2014-05-10 11:29:30 -07:00
parent deab146fab
commit fd909eeca0
1 changed files with 3 additions and 0 deletions

View File

@ -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