1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Ruby case can be empty

This commit is contained in:
Timothy Clem 2017-08-02 07:39:10 -07:00
parent 473e7e34dd
commit 6f9836c103

View File

@ -279,7 +279,7 @@ for = makeTerm <$> symbol For <*> children (forStatement <*> expressions)
Statement.ForEach <$> (flip makeTerm (reverse rest) <$> location) <*> (pure x)
case' :: Assignment
case' = makeTerm <$> symbol Case <*> children (Statement.Match <$> expression <*> whens)
case' = makeTerm <$> symbol Case <*> children (Statement.Match <$> (expression <|> emptyTerm) <*> whens)
where
whens = makeTerm <$> location <*> many (when' <|> else' <|> expressions)
when' = makeTerm <$> symbol When <*> children (Statement.Pattern <$> (makeTerm <$> location <*> some pattern) <*> whens)