From 1d2c924088e3fa3b34d56c97210377e4cfa54279 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 19 Apr 2017 16:28:51 -0400 Subject: [PATCH] :fire: expr. --- src/Language/Ruby/Syntax.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index 8434c2b56..adb5d1b3b 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -78,8 +78,8 @@ statement = exit Statement.Return Return <|> if' <|> ifModifier <|> unless - <|> expr - where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children expr)) + <|> literal + where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children statement)) comment :: Assignment Grammar (Term Syntax ()) comment = term . Comment.Comment <$ symbol Comment <*> source @@ -89,14 +89,11 @@ if' = go If where go s = term <$ symbol s <*> children (Statement.If <$> statement <*> (term <$> many statement) <*> (go Elsif <|> term <$ symbol Else <*> children (many statement))) ifModifier :: Assignment Grammar (Term Syntax ()) -ifModifier = term <$ symbol IfModifier <*> children (flip Statement.If <$> statement <*> expr <*> pure (term Syntax.Empty)) +ifModifier = term <$ symbol IfModifier <*> children (flip Statement.If <$> statement <*> statement <*> pure (term Syntax.Empty)) unless :: Assignment Grammar (Term Syntax ()) unless = term <$ symbol Unless <*> children (Statement.If <$> (term . Expression.Not <$> statement) <*> (term <$> many statement) <*> (term <$ symbol Else <*> children (many statement))) -expr :: Assignment Grammar (Term Syntax ()) -expr = literal - literal :: Assignment Grammar (Term Syntax ()) literal = term Literal.true <$ symbol Language.Ruby.Syntax.True <* source <|> term Literal.false <$ symbol Language.Ruby.Syntax.False <* source