1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

ruby: allow operators as method names too

This commit is contained in:
Charlie Somerville 2018-04-10 13:25:37 +10:00
parent a39efb51b8
commit 210ff626f1

View File

@ -313,9 +313,12 @@ methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|>
nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression
methodSelector :: Assignment methodSelector :: Assignment
methodSelector = mk Identifier <|> mk Identifier' <|> mk Constant methodSelector = makeTerm <$> symbols <*> (Syntax.Identifier <$> (name <$> source))
where where
mk s = makeTerm <$> symbol s <*> (Syntax.Identifier <$> (name <$> source)) symbols = symbol Identifier
<|> symbol Identifier'
<|> symbol Constant
<|> symbol Operator
call :: Assignment call :: Assignment
call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> term expression) <*> methodSelector <*> many expression <*> optional block) call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> term expression) <*> methodSelector <*> many expression <*> optional block)