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:
parent
0e34b035c6
commit
bb3af11dd8
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user