diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index d4c2ae4d8..f406d8da2 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -53,8 +53,7 @@ declaration :: Assignment (Node Grammar) (Term Syntax Location) declaration = comment <|> class' <|> method class' :: Assignment (Node Grammar) (Term Syntax Location) -class' = term <* symbol Class - <*> children (Declaration.Class <$> (constant <|> scopeResolution) <*> (superclass <|> pure []) <*> many declaration) +class' = symbol Class *> term <*> children (Declaration.Class <$> (constant <|> scopeResolution) <*> (superclass <|> pure []) <*> many declaration) where superclass = pure <$ symbol Superclass <*> children constant scopeResolution = symbol ScopeResolution *> children (constant <|> identifier) @@ -65,8 +64,7 @@ identifier :: Assignment (Node Grammar) (Term Syntax Location) identifier = leaf Identifier Syntax.Identifier method :: Assignment (Node Grammar) (Term Syntax Location) -method = term <* symbol Method - <*> children (Declaration.Method <$> identifier <*> pure [] <*> (term <*> many statement)) +method = symbol Method *> term <*> children (Declaration.Method <$> identifier <*> pure [] <*> (term <*> many statement)) statement :: Assignment (Node Grammar) (Term Syntax Location) statement = exit Statement.Return Return @@ -78,23 +76,23 @@ statement = exit Statement.Return Return <|> unless <|> unlessModifier <|> literal - where exit construct sym = term <*> (construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children statement))) + where exit construct sym = symbol sym *> term <*> (children (construct <$> optional (symbol ArgumentList *> children statement))) comment :: Assignment (Node Grammar) (Term Syntax Location) comment = leaf Comment Comment.Comment if' :: Assignment (Node Grammar) (Term Syntax Location) if' = go If - where go s = term <* symbol s <*> children (Statement.If <$> statement <*> (term <*> many statement) <*> optional (go Elsif <|> term <* symbol Else <*> children (many statement))) + where go s = symbol s *> term <*> children (Statement.If <$> statement <*> (term <*> many statement) <*> optional (go Elsif <|> symbol Else *> term <*> children (many statement))) ifModifier :: Assignment (Node Grammar) (Term Syntax Location) -ifModifier = term <* symbol IfModifier <*> children (flip Statement.If <$> statement <*> statement <*> (term <*> pure Syntax.Empty)) +ifModifier = symbol IfModifier *> term <*> children (flip Statement.If <$> statement <*> statement <*> (term <*> pure Syntax.Empty)) unless :: Assignment (Node Grammar) (Term Syntax Location) -unless = term <* symbol Unless <*> children (Statement.If <$> (term <*> (Expression.Not <$> statement)) <*> (term <*> many statement) <*> optional (term <* symbol Else <*> children (many statement))) +unless = symbol Unless *> term <*> children (Statement.If <$> (term <*> (Expression.Not <$> statement)) <*> (term <*> many statement) <*> optional (symbol Else *> term <*> children (many statement))) unlessModifier :: Assignment (Node Grammar) (Term Syntax Location) -unlessModifier = term <* symbol UnlessModifier <*> children (flip Statement.If <$> statement <*> (term <*> (Expression.Not <$> statement)) <*> (term <*> pure Syntax.Empty)) +unlessModifier = symbol UnlessModifier *> term <*> children (flip Statement.If <$> statement <*> (term <*> (Expression.Not <$> statement)) <*> (term <*> pure Syntax.Empty)) literal :: Assignment (Node Grammar) (Term Syntax Location) literal = leaf Language.Ruby.Syntax.True (const Literal.true)