diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index 4b0474e5d..2b09c80cd 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -71,7 +71,8 @@ comment :: Assignment Grammar (Program a) comment = wrapU . Comment.Comment <$ rule Comment <*> content if' :: Assignment Grammar (Program a) -if' = wrapU <$ rule If <*> children (Statement.If <$> statement <*> (wrapU <$> many statement) <*> (wrapU <$ rule Else <*> children (many statement))) +if' = go If + where go symbol = wrapU <$ rule symbol <*> children (Statement.If <$> statement <*> (wrapU <$> many statement) <*> (go Elsif <|> wrapU <$ rule Else <*> children (many statement))) expr :: Assignment Grammar (Program a) expr = if' <|> literal