mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Remove ruby parsing dependence on Args syntax
This commit is contained in:
parent
437522f5e1
commit
46d3066a97
@ -31,7 +31,6 @@ termConstructor
|
|||||||
termConstructor source sourceSpan name range children
|
termConstructor source sourceSpan name range children
|
||||||
| name == "ERROR" = withDefaultInfo (S.Error children)
|
| name == "ERROR" = withDefaultInfo (S.Error children)
|
||||||
| otherwise = withDefaultInfo $ case (name, children) of
|
| otherwise = withDefaultInfo $ case (name, children) of
|
||||||
("argument_list", _) -> S.Args children
|
|
||||||
("array", _) -> S.Array children
|
("array", _) -> S.Array children
|
||||||
("assignment", [ identifier, value ]) -> S.Assignment identifier value
|
("assignment", [ identifier, value ]) -> S.Assignment identifier value
|
||||||
("assignment", _ ) -> S.Error children
|
("assignment", _ ) -> S.Error children
|
||||||
@ -43,11 +42,13 @@ termConstructor source sourceSpan name range children
|
|||||||
("conditional_assignment", _ ) -> S.Error children
|
("conditional_assignment", _ ) -> S.Error children
|
||||||
("conditional", condition : cases) -> S.Ternary condition cases
|
("conditional", condition : cases) -> S.Ternary condition cases
|
||||||
("conditional", _ ) -> S.Error children
|
("conditional", _ ) -> S.Error children
|
||||||
("function_call", _) -> case runCofree <$> children of
|
("function_call", _) -> case children of
|
||||||
[ _ :< S.MemberAccess{..}, _ :< S.Args args ] -> S.MethodCall memberId property args
|
[ member, args ] |
|
||||||
[ _ :< S.MemberAccess{..} ] -> S.MethodCall memberId property []
|
category (extract member) == MemberAccess,
|
||||||
[ function, _ :< S.Args args ] -> S.FunctionCall (cofree function) args
|
category (extract args) == Args -> case toList (unwrap member) of
|
||||||
(x:xs) -> S.FunctionCall (cofree x) (cofree <$> xs)
|
[target, method] -> S.MethodCall target method (toList (unwrap args))
|
||||||
|
_ -> S.Error children
|
||||||
|
[ function, args ] | category (extract args) == Args -> S.FunctionCall function (toList (unwrap args))
|
||||||
_ -> S.Error children
|
_ -> S.Error children
|
||||||
("hash", _) -> S.Object $ foldMap toTuple children
|
("hash", _) -> S.Object $ foldMap toTuple children
|
||||||
("if_modifier", [ lhs, condition ]) -> S.If condition [lhs]
|
("if_modifier", [ lhs, condition ]) -> S.If condition [lhs]
|
||||||
|
Loading…
Reference in New Issue
Block a user