1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 21:31:48 +03:00

Update MiniRuby assignment

This commit is contained in:
Rick Winfrey 2018-12-17 17:52:11 -08:00
parent 0e34b035c6
commit bb3af11dd8

View File

@ -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))