mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
ruby: pull out some duplication in block assignment
This commit is contained in:
parent
8dfaae81e1
commit
437df993b5
@ -243,9 +243,10 @@ lambda = makeTerm <$> symbol Lambda <*> children (
|
|||||||
<*> expressions)
|
<*> expressions)
|
||||||
|
|
||||||
block :: Assignment
|
block :: Assignment
|
||||||
block = makeTerm <$> symbol DoBlock <*> children (Declaration.Function <$> pure [] <*> emptyTerm <*> params <*> expressions)
|
block = makeTerm <$> symbol DoBlock <*> blockChildren
|
||||||
<|> makeTerm <$> symbol Block <*> children (Declaration.Function <$> pure [] <*> emptyTerm <*> params <*> expressions)
|
<|> makeTerm <$> symbol Block <*> blockChildren
|
||||||
where params = symbol BlockParameters *> children (many parameter) <|> pure []
|
where blockChildren = children (Declaration.Function <$> pure [] <*> emptyTerm <*> params <*> expressions)
|
||||||
|
params = symbol BlockParameters *> children (many parameter) <|> pure []
|
||||||
|
|
||||||
comment :: Assignment
|
comment :: Assignment
|
||||||
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
|
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
|
||||||
|
Loading…
Reference in New Issue
Block a user