1
1
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:
Charlie Somerville 2018-03-26 16:41:05 +11:00
parent 8dfaae81e1
commit 437df993b5

View File

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