From bb3af11dd8d3badf599d8004bf5a622b60bdd08f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 17 Dec 2018 17:52:11 -0800 Subject: [PATCH] Update MiniRuby assignment --- src/Language/MiniRuby/Assignment.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Language/MiniRuby/Assignment.hs b/src/Language/MiniRuby/Assignment.hs index 44a01d8cd..1e56b5882 100644 --- a/src/Language/MiniRuby/Assignment.hs +++ b/src/Language/MiniRuby/Assignment.hs @@ -39,6 +39,7 @@ import Prologue hiding (for) -- | Small version of Ruby syntax for testing the code rewriting pipeline. type Syntax = '[ Comment.Comment + , Declaration.Accessibility , Declaration.Function , Declaration.Method , Expression.Minus @@ -103,9 +104,10 @@ identifier = else pure $ makeTerm loc (Ruby.Syntax.Send Nothing (Just identTerm) [] Nothing) method :: Assignment Term -method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method [] <$> emptyTerm <*> methodSelector <*> params <*> expressions') +method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method [] <$> emptyTerm <*> accessibility <*> methodSelector <*> params <*> expressions') where params = symbol MethodParameters *> children (many parameter) <|> pure [] expressions' = makeTerm <$> location <*> many expression + accessibility = makeTerm <$> location <*> pure Declaration.Unknown methodSelector :: Assignment Term methodSelector = makeTerm <$> symbols <*> (Syntax.Identifier <$> (name <$> source))