diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs index f61f08d3b..89e94f623 100644 --- a/src/Language/Ruby/Assignment.hs +++ b/src/Language/Ruby/Assignment.hs @@ -74,6 +74,7 @@ type Syntax = '[ , Syntax.Identifier , Syntax.Paren , Syntax.Program + , Ruby.Syntax.Send , Ruby.Syntax.Class , Ruby.Syntax.Load , Ruby.Syntax.LowPrecedenceBoolean @@ -83,7 +84,8 @@ type Syntax = '[ ] type Term = Term.Term (Union Syntax) (Record Location) -type Assignment = HasCallStack => Assignment.Assignment [] Grammar Term +type Assignment' a = HasCallStack => Assignment.Assignment [] Grammar a +type Assignment = Assignment' Term -- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax. assignment :: Assignment @@ -291,9 +293,12 @@ pair :: Assignment pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression <*> (expression <|> emptyTerm)) methodCall :: Assignment -methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> regularCall) +methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> funcCall <|> regularCall) where - regularCall = inj <$> (Expression.Call <$> pure [] <*> expression <*> args <*> (block <|> emptyTerm)) + funcCall = inj <$> (Ruby.Syntax.Send Nothing <$> methodSelector <*> args <*> optional block) + + regularCall = inj <$> (symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector) <*> args <*> optional block) + require = inj <$> (symbol Identifier *> do s <- source guard (s `elem` ["require", "require_relative"]) @@ -302,14 +307,17 @@ methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> s <- source guard (s == "load") Ruby.Syntax.Load <$> loadArgs) - args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> pure [] + args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> many expression loadArgs = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (some expression) nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression -call :: Assignment -call = makeTerm <$> symbol Call <*> children (Expression.MemberAccess <$> expression <*> (expressions <|> args)) +methodSelector :: Assignment +methodSelector = mk Identifier <|> mk Identifier' where - args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expressions + mk s = makeTerm <$> symbol s <*> (Syntax.Identifier <$> (name <$> source)) + +call :: Assignment +call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector <*> pure [] <*> optional block) rescue :: Assignment rescue = rescue' diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index f69a1cf74..47977d954 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -36,6 +36,22 @@ maybeFailNotFound name = maybeFail notFound cleanNameOrPath :: ByteString -> String cleanNameOrPath = BC.unpack . dropRelativePrefix . stripQuotes +data Send a = Send { sendReceiver :: Maybe a, sendSelector :: a, sendArgs :: [a], sendBlock :: Maybe a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1) + +instance Eq1 Send where liftEq = genericLiftEq +instance Ord1 Send where liftCompare = genericLiftCompare +instance Show1 Send where liftShowsPrec = genericLiftShowsPrec + +instance Evaluatable Send where + eval Send{..} = do + func <- case sendReceiver of + Just recv -> do + recvEnv <- subtermValue recv >>= scopedEnvironment + localEnv (mappend recvEnv) (subtermValue sendSelector) + Nothing -> subtermValue sendSelector -- TODO Does this require `localize` so we don't leak terms when resolving `sendSelector`? + call func (map subtermValue sendArgs) -- TODO pass through sendBlock + data Require a = Require { requireRelative :: Bool, requirePath :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1) diff --git a/test/fixtures/ruby/begin.diffA-B.txt b/test/fixtures/ruby/begin.diffA-B.txt index c4981ea41..1bec5bc39 100644 --- a/test/fixtures/ruby/begin.diffA-B.txt +++ b/test/fixtures/ruby/begin.diffA-B.txt @@ -5,7 +5,6 @@ ( (Try { ([]) - ->(Call + ->(Send {+(Identifier)+} - {+(TextElement)+} - {+(Empty)+}) })))) + {+(TextElement)+}) })))) diff --git a/test/fixtures/ruby/begin.diffB-A.txt b/test/fixtures/ruby/begin.diffB-A.txt index cddc43dcb..49fcd5397 100644 --- a/test/fixtures/ruby/begin.diffB-A.txt +++ b/test/fixtures/ruby/begin.diffB-A.txt @@ -4,8 +4,7 @@ (Identifier) ( (Try - { (Call + { (Send {-(Identifier)-} - {-(TextElement)-} - {-(Empty)-}) + {-(TextElement)-}) ->([]) })))) diff --git a/test/fixtures/ruby/begin.parseB.txt b/test/fixtures/ruby/begin.parseB.txt index 20e4c291d..b59119d4d 100644 --- a/test/fixtures/ruby/begin.parseB.txt +++ b/test/fixtures/ruby/begin.parseB.txt @@ -4,7 +4,6 @@ (Identifier) ( (Try - (Call + (Send (Identifier) - (TextElement) - (Empty)))))) + (TextElement)))))) diff --git a/test/fixtures/ruby/else.diffA-B.txt b/test/fixtures/ruby/else.diffA-B.txt index fdcd7ca3f..5749e4f84 100644 --- a/test/fixtures/ruby/else.diffA-B.txt +++ b/test/fixtures/ruby/else.diffA-B.txt @@ -1,12 +1,10 @@ (Program (Try ( - (Call - (Identifier) - (Empty)) + (Send + (Identifier)) (Else (Empty) { ([]) - ->(Call - {+(Identifier)+} - {+(Empty)+}) })))) + ->(Send + {+(Identifier)+}) })))) diff --git a/test/fixtures/ruby/else.diffB-A.txt b/test/fixtures/ruby/else.diffB-A.txt index 008d4b5f5..147cfbfbd 100644 --- a/test/fixtures/ruby/else.diffB-A.txt +++ b/test/fixtures/ruby/else.diffB-A.txt @@ -1,12 +1,10 @@ (Program (Try ( - (Call - (Identifier) - (Empty)) + (Send + (Identifier)) (Else (Empty) - { (Call - {-(Identifier)-} - {-(Empty)-}) + { (Send + {-(Identifier)-}) ->([]) })))) diff --git a/test/fixtures/ruby/else.parseA.txt b/test/fixtures/ruby/else.parseA.txt index 48a2a4275..edf25207d 100644 --- a/test/fixtures/ruby/else.parseA.txt +++ b/test/fixtures/ruby/else.parseA.txt @@ -1,9 +1,8 @@ (Program (Try ( - (Call - (Identifier) - (Empty)) + (Send + (Identifier)) (Else (Empty) ([]))))) diff --git a/test/fixtures/ruby/else.parseB.txt b/test/fixtures/ruby/else.parseB.txt index adec3bef8..28eaf190d 100644 --- a/test/fixtures/ruby/else.parseB.txt +++ b/test/fixtures/ruby/else.parseB.txt @@ -1,11 +1,9 @@ (Program (Try ( - (Call - (Identifier) - (Empty)) + (Send + (Identifier)) (Else (Empty) - (Call - (Identifier) - (Empty)))))) + (Send + (Identifier)))))) diff --git a/test/fixtures/ruby/elsif.diffA-B.txt b/test/fixtures/ruby/elsif.diffA-B.txt index 335081649..209340fd7 100644 --- a/test/fixtures/ruby/elsif.diffA-B.txt +++ b/test/fixtures/ruby/elsif.diffA-B.txt @@ -2,13 +2,11 @@ (If (Identifier) ( - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) (If (Identifier) ( - {+(Call - {+(Identifier)+} - {+(Empty)+})+}) + {+(Send + {+(Identifier)+})+}) (Empty)))) diff --git a/test/fixtures/ruby/elsif.diffB-A.txt b/test/fixtures/ruby/elsif.diffB-A.txt index 888a02a12..0d5cf800a 100644 --- a/test/fixtures/ruby/elsif.diffB-A.txt +++ b/test/fixtures/ruby/elsif.diffB-A.txt @@ -2,13 +2,11 @@ (If (Identifier) ( - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) (If (Identifier) ([] - {-(Call - {-(Identifier)-} - {-(Empty)-})-}) + {-(Send + {-(Identifier)-})-}) (Empty)))) diff --git a/test/fixtures/ruby/elsif.parseA.txt b/test/fixtures/ruby/elsif.parseA.txt index 10cd3a0d8..5e0b329d4 100644 --- a/test/fixtures/ruby/elsif.parseA.txt +++ b/test/fixtures/ruby/elsif.parseA.txt @@ -2,9 +2,8 @@ (If (Identifier) ( - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) (If (Identifier) ([]) diff --git a/test/fixtures/ruby/elsif.parseB.txt b/test/fixtures/ruby/elsif.parseB.txt index 6b06523ca..a823c51eb 100644 --- a/test/fixtures/ruby/elsif.parseB.txt +++ b/test/fixtures/ruby/elsif.parseB.txt @@ -2,13 +2,11 @@ (If (Identifier) ( - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) (If (Identifier) ( - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) (Empty)))) diff --git a/test/fixtures/ruby/for.diffA-B.txt b/test/fixtures/ruby/for.diffA-B.txt index 56a898a61..a65b6c3b9 100644 --- a/test/fixtures/ruby/for.diffA-B.txt +++ b/test/fixtures/ruby/for.diffA-B.txt @@ -6,10 +6,9 @@ {+(Integer)+} {+(Integer)+} {+(Integer)+})+} - {+(Call + {+(Send {+(Identifier)+} - {+(Identifier)+} - {+(Empty)+})+})+} + {+(Identifier)+})+})+} {-(ForEach {-( {-(Identifier)-})-} diff --git a/test/fixtures/ruby/for.diffB-A.txt b/test/fixtures/ruby/for.diffB-A.txt index 396c9dcf2..02167c97b 100644 --- a/test/fixtures/ruby/for.diffB-A.txt +++ b/test/fixtures/ruby/for.diffB-A.txt @@ -22,10 +22,9 @@ {+(Integer)+} {+(Integer)+} {+(Empty)+}) } - { (Call + { (Send {-(Identifier)-} - {-(Identifier)-} - {-(Empty)-}) + {-(Identifier)-}) ->(Boolean) }) {+(ForEach {+( diff --git a/test/fixtures/ruby/for.parseB.txt b/test/fixtures/ruby/for.parseB.txt index fad56b5a4..a0c763c04 100644 --- a/test/fixtures/ruby/for.parseB.txt +++ b/test/fixtures/ruby/for.parseB.txt @@ -6,7 +6,6 @@ (Integer) (Integer) (Integer)) - (Call + (Send (Identifier) - (Identifier) - (Empty)))) + (Identifier)))) diff --git a/test/fixtures/ruby/heredoc.diffA-B.txt b/test/fixtures/ruby/heredoc.diffA-B.txt index 982163b39..c95f20db7 100644 --- a/test/fixtures/ruby/heredoc.diffA-B.txt +++ b/test/fixtures/ruby/heredoc.diffA-B.txt @@ -1,12 +1,9 @@ (Program -{+(Call - {+(MemberAccess - {+(Call - {+(Identifier)+} - {+(TextElement)+} - {+(TextElement)+} - {+(Empty)+})+} - {+(Identifier)+})+} - {+(Empty)+})+} +{+(Send + {+(Send + {+(Identifier)+} + {+(TextElement)+} + {+(TextElement)+})+} + {+(Identifier)+})+} {-(TextElement)-} {-(TextElement)-}) diff --git a/test/fixtures/ruby/heredoc.diffB-A.txt b/test/fixtures/ruby/heredoc.diffB-A.txt index 33636b938..0e4948ace 100644 --- a/test/fixtures/ruby/heredoc.diffB-A.txt +++ b/test/fixtures/ruby/heredoc.diffB-A.txt @@ -1,12 +1,9 @@ (Program {+(TextElement)+} {+(TextElement)+} -{-(Call - {-(MemberAccess - {-(Call - {-(Identifier)-} - {-(TextElement)-} - {-(TextElement)-} - {-(Empty)-})-} - {-(Identifier)-})-} - {-(Empty)-})-}) +{-(Send + {-(Send + {-(Identifier)-} + {-(TextElement)-} + {-(TextElement)-})-} + {-(Identifier)-})-}) diff --git a/test/fixtures/ruby/heredoc.parseB.txt b/test/fixtures/ruby/heredoc.parseB.txt index 538a5f692..b21f0d865 100644 --- a/test/fixtures/ruby/heredoc.parseB.txt +++ b/test/fixtures/ruby/heredoc.parseB.txt @@ -1,10 +1,7 @@ (Program - (Call - (MemberAccess - (Call - (Identifier) - (TextElement) - (TextElement) - (Empty)) - (Identifier)) - (Empty))) + (Send + (Send + (Identifier) + (TextElement) + (TextElement)) + (Identifier))) diff --git a/test/fixtures/ruby/lambda.diffA-B.txt b/test/fixtures/ruby/lambda.diffA-B.txt index e54c73a89..39a195bf4 100644 --- a/test/fixtures/ruby/lambda.diffA-B.txt +++ b/test/fixtures/ruby/lambda.diffA-B.txt @@ -1,9 +1,8 @@ (Program -{-(Call +{-(Send {-(Identifier)-} - {-(Hash)-} - {-(Empty)-})-} - (Call + {-(Hash)-})-} + (Send (Identifier) (Function (Empty) @@ -12,7 +11,7 @@ ->(Plus {+(Identifier)+} {+(Integer)+}) })) -{-(Call +{-(Send {-(Identifier)-} {-(Function {-(Empty)-} diff --git a/test/fixtures/ruby/lambda.diffB-A.txt b/test/fixtures/ruby/lambda.diffB-A.txt index cca253910..45ba77da6 100644 --- a/test/fixtures/ruby/lambda.diffB-A.txt +++ b/test/fixtures/ruby/lambda.diffB-A.txt @@ -1,9 +1,8 @@ (Program -{+(Call +{+(Send {+(Identifier)+} - {+(Hash)+} - {+(Empty)+})+} - (Call + {+(Hash)+})+} + (Send (Identifier) (Function (Empty) @@ -12,7 +11,7 @@ {-(Identifier)-} {-(Integer)-}) ->(Identifier) })) -{+(Call +{+(Send {+(Identifier)+} {+(Function {+(Empty)+} diff --git a/test/fixtures/ruby/lambda.parseA.txt b/test/fixtures/ruby/lambda.parseA.txt index 2d8da24f0..d70c65aeb 100644 --- a/test/fixtures/ruby/lambda.parseA.txt +++ b/test/fixtures/ruby/lambda.parseA.txt @@ -1,14 +1,13 @@ (Program - (Call + (Send (Identifier) - (Hash) - (Empty)) - (Call + (Hash)) + (Send (Identifier) (Function (Empty) (Identifier))) - (Call + (Send (Identifier) (Function (Empty) diff --git a/test/fixtures/ruby/lambda.parseB.txt b/test/fixtures/ruby/lambda.parseB.txt index becaeb20c..23f3795f0 100644 --- a/test/fixtures/ruby/lambda.parseB.txt +++ b/test/fixtures/ruby/lambda.parseB.txt @@ -1,5 +1,5 @@ (Program - (Call + (Send (Identifier) (Function (Empty) diff --git a/test/fixtures/ruby/method-calls-hash-args.diffA-B.txt b/test/fixtures/ruby/method-calls-hash-args.diffA-B.txt index 85fbeada0..36b32e871 100644 --- a/test/fixtures/ruby/method-calls-hash-args.diffA-B.txt +++ b/test/fixtures/ruby/method-calls-hash-args.diffA-B.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Symbol) (Boolean)) {+(KeyValue {+(Symbol)+} - {+(Integer)+})+} - (Empty))) + {+(Integer)+})+})) diff --git a/test/fixtures/ruby/method-calls-hash-args.diffB-A.txt b/test/fixtures/ruby/method-calls-hash-args.diffB-A.txt index 0e6d75399..7348a10ea 100644 --- a/test/fixtures/ruby/method-calls-hash-args.diffB-A.txt +++ b/test/fixtures/ruby/method-calls-hash-args.diffB-A.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Symbol) (Boolean)) {-(KeyValue {-(Symbol)-} - {-(Integer)-})-} - (Empty))) + {-(Integer)-})-})) diff --git a/test/fixtures/ruby/method-calls-hash-args.parseA.txt b/test/fixtures/ruby/method-calls-hash-args.parseA.txt index a9a7064e7..4a1b85927 100644 --- a/test/fixtures/ruby/method-calls-hash-args.parseA.txt +++ b/test/fixtures/ruby/method-calls-hash-args.parseA.txt @@ -1,7 +1,6 @@ (Program - (Call + (Send (Identifier) (KeyValue (Symbol) - (Boolean)) - (Empty))) + (Boolean)))) diff --git a/test/fixtures/ruby/method-calls-hash-args.parseB.txt b/test/fixtures/ruby/method-calls-hash-args.parseB.txt index 331effe26..082424e40 100644 --- a/test/fixtures/ruby/method-calls-hash-args.parseB.txt +++ b/test/fixtures/ruby/method-calls-hash-args.parseB.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Symbol) (Boolean)) (KeyValue (Symbol) - (Integer)) - (Empty))) + (Integer)))) diff --git a/test/fixtures/ruby/method-calls-keyword-args.diffA-B.txt b/test/fixtures/ruby/method-calls-keyword-args.diffA-B.txt index 7b4c1affd..29d015331 100644 --- a/test/fixtures/ruby/method-calls-keyword-args.diffA-B.txt +++ b/test/fixtures/ruby/method-calls-keyword-args.diffA-B.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Identifier) (Boolean)) {+(KeyValue {+(Identifier)+} - {+(Integer)+})+} - (Empty))) + {+(Integer)+})+})) diff --git a/test/fixtures/ruby/method-calls-keyword-args.diffB-A.txt b/test/fixtures/ruby/method-calls-keyword-args.diffB-A.txt index 3db88f4f7..d997a17bc 100644 --- a/test/fixtures/ruby/method-calls-keyword-args.diffB-A.txt +++ b/test/fixtures/ruby/method-calls-keyword-args.diffB-A.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Identifier) (Boolean)) {-(KeyValue {-(Identifier)-} - {-(Integer)-})-} - (Empty))) + {-(Integer)-})-})) diff --git a/test/fixtures/ruby/method-calls-keyword-args.parseA.txt b/test/fixtures/ruby/method-calls-keyword-args.parseA.txt index 56cfdc9d0..44ef36306 100644 --- a/test/fixtures/ruby/method-calls-keyword-args.parseA.txt +++ b/test/fixtures/ruby/method-calls-keyword-args.parseA.txt @@ -1,7 +1,6 @@ (Program - (Call + (Send (Identifier) (KeyValue (Identifier) - (Boolean)) - (Empty))) + (Boolean)))) diff --git a/test/fixtures/ruby/method-calls-keyword-args.parseB.txt b/test/fixtures/ruby/method-calls-keyword-args.parseB.txt index 2d1be75a7..2c25ecd29 100644 --- a/test/fixtures/ruby/method-calls-keyword-args.parseB.txt +++ b/test/fixtures/ruby/method-calls-keyword-args.parseB.txt @@ -1,10 +1,9 @@ (Program - (Call + (Send (Identifier) (KeyValue (Identifier) (Boolean)) (KeyValue (Identifier) - (Integer)) - (Empty))) + (Integer)))) diff --git a/test/fixtures/ruby/method-calls.diffA-B.txt b/test/fixtures/ruby/method-calls.diffA-B.txt index c79b1ddb2..3c46d8c5c 100644 --- a/test/fixtures/ruby/method-calls.diffA-B.txt +++ b/test/fixtures/ruby/method-calls.diffA-B.txt @@ -1,11 +1,9 @@ (Program - (Call - { (MemberAccess - {-(Identifier)-} - {-(Identifier)-}) - ->(Identifier) } - (Empty)) -{-(Call + (Send + {-(Identifier)-} + { (Identifier) + ->(Identifier) }) +{-(Send {-(Identifier)-} {-(Identifier)-} {-(Identifier)-} @@ -14,16 +12,13 @@ {-(Integer)-})-} {-(KeyValue {-(Identifier)-} - {-(Integer)-})-} - {-(Empty)-})-} -{-(Call + {-(Integer)-})-})-} +{-(Send {-(Identifier)-} - {-(Call + {-(Send {-(Identifier)-} - {-(Identifier)-} - {-(Empty)-})-} - {-(Empty)-})-} -{-(Call + {-(Identifier)-})-})-} +{-(Send {-(Identifier)-} {-(KeyValue {-(Array)-} @@ -35,5 +30,4 @@ {-(Identifier)-} {-(Function {-(Empty)-} - {-(Integer)-})-})-} - {-(Empty)-})-}) + {-(Integer)-})-})-})-}) diff --git a/test/fixtures/ruby/method-calls.diffB-A.txt b/test/fixtures/ruby/method-calls.diffB-A.txt index 83ccfe9eb..c028170a1 100644 --- a/test/fixtures/ruby/method-calls.diffB-A.txt +++ b/test/fixtures/ruby/method-calls.diffB-A.txt @@ -1,11 +1,9 @@ (Program - (Call + (Send + {+(Identifier)+} { (Identifier) - ->(MemberAccess - {+(Identifier)+} - {+(Identifier)+}) } - (Empty)) -{+(Call + ->(Identifier) }) +{+(Send {+(Identifier)+} {+(Identifier)+} {+(Identifier)+} @@ -14,16 +12,13 @@ {+(Integer)+})+} {+(KeyValue {+(Identifier)+} - {+(Integer)+})+} - {+(Empty)+})+} -{+(Call + {+(Integer)+})+})+} +{+(Send {+(Identifier)+} - {+(Call + {+(Send {+(Identifier)+} - {+(Identifier)+} - {+(Empty)+})+} - {+(Empty)+})+} -{+(Call + {+(Identifier)+})+})+} +{+(Send {+(Identifier)+} {+(KeyValue {+(Array)+} @@ -35,5 +30,4 @@ {+(Identifier)+} {+(Function {+(Empty)+} - {+(Integer)+})+})+} - {+(Empty)+})+}) + {+(Integer)+})+})+})+}) diff --git a/test/fixtures/ruby/method-calls.parseA.txt b/test/fixtures/ruby/method-calls.parseA.txt index f7d64b9db..0bc76963f 100644 --- a/test/fixtures/ruby/method-calls.parseA.txt +++ b/test/fixtures/ruby/method-calls.parseA.txt @@ -1,10 +1,8 @@ (Program - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Call + (Send + (Identifier) + (Identifier)) + (Send (Identifier) (Identifier) (Identifier) @@ -13,16 +11,13 @@ (Integer)) (KeyValue (Identifier) - (Integer)) - (Empty)) - (Call + (Integer))) + (Send (Identifier) - (Call + (Send (Identifier) - (Identifier) - (Empty)) - (Empty)) - (Call + (Identifier))) + (Send (Identifier) (KeyValue (Array) @@ -34,5 +29,4 @@ (Identifier) (Function (Empty) - (Integer))) - (Empty))) + (Integer))))) diff --git a/test/fixtures/ruby/method-calls.parseB.txt b/test/fixtures/ruby/method-calls.parseB.txt index 63ef21d34..28fc4d141 100644 --- a/test/fixtures/ruby/method-calls.parseB.txt +++ b/test/fixtures/ruby/method-calls.parseB.txt @@ -1,4 +1,3 @@ (Program - (Call - (Identifier) - (Empty))) + (Send + (Identifier))) diff --git a/test/fixtures/ruby/method-invocation.diffA-B.txt b/test/fixtures/ruby/method-invocation.diffA-B.txt index c4de741c2..8804f3a1f 100644 --- a/test/fixtures/ruby/method-invocation.diffA-B.txt +++ b/test/fixtures/ruby/method-invocation.diffA-B.txt @@ -1,25 +1,17 @@ (Program -{+(Call +{+(Send {+(Identifier)+} - {+(TextElement)+} - {+(Empty)+})+} -{+(Call - {+(MemberAccess - {+(Identifier)+} - {+(Identifier)+})+} - {+(Empty)+})+} -{+(Call - {+(Identifier)+} - {+(Integer)+} - {+(Integer)+} - {+(Empty)+})+} -{+(Call - {+(Identifier)+} - {+(Integer)+} - {+(Integer)+} - {+(Empty)+})+} + {+(TextElement)+})+} {-(Identifier)-} -{-(MemberAccess - {-(Identifier)-} - {-(Identifier)-})-} + (Send + (Identifier) + (Identifier)) +{+(Send + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+})+} +{+(Send + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+})+} {-(Identifier)-}) diff --git a/test/fixtures/ruby/method-invocation.diffB-A.txt b/test/fixtures/ruby/method-invocation.diffB-A.txt index 1de44f821..d736631e1 100644 --- a/test/fixtures/ruby/method-invocation.diffB-A.txt +++ b/test/fixtures/ruby/method-invocation.diffB-A.txt @@ -1,25 +1,17 @@ (Program {+(Identifier)+} -{+(MemberAccess - {+(Identifier)+} - {+(Identifier)+})+} +{-(Send + {-(Identifier)-} + {-(TextElement)-})-} + (Send + (Identifier) + (Identifier)) {+(Identifier)+} -{-(Call - {-(Identifier)-} - {-(TextElement)-} - {-(Empty)-})-} -{-(Call - {-(MemberAccess - {-(Identifier)-} - {-(Identifier)-})-} - {-(Empty)-})-} -{-(Call +{-(Send {-(Identifier)-} {-(Integer)-} - {-(Integer)-} - {-(Empty)-})-} -{-(Call + {-(Integer)-})-} +{-(Send {-(Identifier)-} {-(Integer)-} - {-(Integer)-} - {-(Empty)-})-}) + {-(Integer)-})-}) diff --git a/test/fixtures/ruby/method-invocation.parseA.txt b/test/fixtures/ruby/method-invocation.parseA.txt index 2c64d0064..5d1ce8893 100644 --- a/test/fixtures/ruby/method-invocation.parseA.txt +++ b/test/fixtures/ruby/method-invocation.parseA.txt @@ -1,6 +1,6 @@ (Program (Identifier) - (MemberAccess + (Send (Identifier) (Identifier)) (Identifier)) diff --git a/test/fixtures/ruby/method-invocation.parseB.txt b/test/fixtures/ruby/method-invocation.parseB.txt index c2fb2427a..de9b0825b 100644 --- a/test/fixtures/ruby/method-invocation.parseB.txt +++ b/test/fixtures/ruby/method-invocation.parseB.txt @@ -1,20 +1,15 @@ (Program - (Call + (Send (Identifier) - (TextElement) - (Empty)) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Empty)) - (Call + (TextElement)) + (Send + (Identifier) + (Identifier)) + (Send (Identifier) (Integer) - (Integer) - (Empty)) - (Call + (Integer)) + (Send (Identifier) (Integer) - (Integer) - (Empty))) + (Integer))) diff --git a/test/fixtures/ruby/multiple-assignments.diffA-B.txt b/test/fixtures/ruby/multiple-assignments.diffA-B.txt index 8645f3aef..b60fbedae 100644 --- a/test/fixtures/ruby/multiple-assignments.diffA-B.txt +++ b/test/fixtures/ruby/multiple-assignments.diffA-B.txt @@ -37,17 +37,17 @@ {-(Identifier)-})-} {-(Assignment {-( - {-(MemberAccess + {-(Send {-(Identifier)-} {-(Identifier)-})-} - {-(MemberAccess + {-(Send {-(Identifier)-} {-(Identifier)-})-})-} {-( - {-(MemberAccess + {-(Send {-(Identifier)-} {-(Identifier)-})-} - {-(MemberAccess + {-(Send {-(Identifier)-} {-(Identifier)-})-})-})-} {-(Assignment diff --git a/test/fixtures/ruby/multiple-assignments.diffB-A.txt b/test/fixtures/ruby/multiple-assignments.diffB-A.txt index 9ed61e0d3..9072ef138 100644 --- a/test/fixtures/ruby/multiple-assignments.diffB-A.txt +++ b/test/fixtures/ruby/multiple-assignments.diffB-A.txt @@ -37,17 +37,17 @@ {+(Identifier)+})+} {+(Assignment {+( - {+(MemberAccess + {+(Send {+(Identifier)+} {+(Identifier)+})+} - {+(MemberAccess + {+(Send {+(Identifier)+} {+(Identifier)+})+})+} {+( - {+(MemberAccess + {+(Send {+(Identifier)+} {+(Identifier)+})+} - {+(MemberAccess + {+(Send {+(Identifier)+} {+(Identifier)+})+})+})+} {+(Assignment diff --git a/test/fixtures/ruby/multiple-assignments.parseA.txt b/test/fixtures/ruby/multiple-assignments.parseA.txt index ccd753227..917c016f8 100644 --- a/test/fixtures/ruby/multiple-assignments.parseA.txt +++ b/test/fixtures/ruby/multiple-assignments.parseA.txt @@ -36,17 +36,17 @@ (Identifier)) (Assignment ( - (MemberAccess + (Send (Identifier) (Identifier)) - (MemberAccess + (Send (Identifier) (Identifier))) ( - (MemberAccess + (Send (Identifier) (Identifier)) - (MemberAccess + (Send (Identifier) (Identifier)))) (Assignment diff --git a/test/fixtures/ruby/relational-operator.diffA-B.txt b/test/fixtures/ruby/relational-operator.diffA-B.txt index a49ea9971..573104fbf 100644 --- a/test/fixtures/ruby/relational-operator.diffA-B.txt +++ b/test/fixtures/ruby/relational-operator.diffA-B.txt @@ -1,5 +1,5 @@ (Program -{(Equal +{ (Equal {-(Identifier)-} {-(Identifier)-}) ->(Comparison @@ -10,11 +10,12 @@ {+(Identifier)+})+} {+(Assignment {+(Identifier)+} - {+(Not{+(Identifier)+})+})+} + {+(Not + {+(Identifier)+})+})+} {-(Not {-(Equal {-(Identifier)-} {-(Identifier)-})-})-} {-(Equal {-(Identifier)-} - {-(Identifier)-})- }) + {-(Identifier)-})-}) diff --git a/test/fixtures/ruby/relational-operator.diffB-A.txt b/test/fixtures/ruby/relational-operator.diffB-A.txt index 9e9a702a3..6c5ab4bab 100644 --- a/test/fixtures/ruby/relational-operator.diffB-A.txt +++ b/test/fixtures/ruby/relational-operator.diffB-A.txt @@ -1,5 +1,5 @@ (Program -{(Comparison +{ (Comparison {-(Identifier)-} {-(Identifier)-}) ->(Equal @@ -17,4 +17,5 @@ {-(Identifier)-})-} {-(Assignment {-(Identifier)-} - {-(Not{-(Identifier)-})-})- }) + {-(Not + {-(Identifier)-})-})-}) diff --git a/test/fixtures/ruby/require.diffA-B.txt b/test/fixtures/ruby/require.diffA-B.txt index ec63bdae0..a5dbacab3 100644 --- a/test/fixtures/ruby/require.diffA-B.txt +++ b/test/fixtures/ruby/require.diffA-B.txt @@ -2,10 +2,9 @@ (Require { (TextElement) ->(TextElement) }) - (Call + (Send { (Identifier) ->(Identifier) } {+(Symbol)+} {+(TextElement)+} - {-(Identifier)-} - (Empty))) + {-(Identifier)-})) diff --git a/test/fixtures/ruby/require.diffB-A.txt b/test/fixtures/ruby/require.diffB-A.txt index 890c906af..9097a9f15 100644 --- a/test/fixtures/ruby/require.diffB-A.txt +++ b/test/fixtures/ruby/require.diffB-A.txt @@ -2,10 +2,9 @@ (Require { (TextElement) ->(TextElement) }) - (Call + (Send { (Identifier) ->(Identifier) } {+(Identifier)+} {-(Symbol)-} - {-(TextElement)-} - (Empty))) + {-(TextElement)-})) diff --git a/test/fixtures/ruby/require.parseA.txt b/test/fixtures/ruby/require.parseA.txt index f33f28750..3537988d3 100644 --- a/test/fixtures/ruby/require.parseA.txt +++ b/test/fixtures/ruby/require.parseA.txt @@ -1,7 +1,6 @@ (Program (Require (TextElement)) - (Call + (Send (Identifier) - (Identifier) - (Empty))) + (Identifier))) diff --git a/test/fixtures/ruby/require.parseB.txt b/test/fixtures/ruby/require.parseB.txt index 638ed1768..25ff2f139 100644 --- a/test/fixtures/ruby/require.parseB.txt +++ b/test/fixtures/ruby/require.parseB.txt @@ -1,8 +1,7 @@ (Program (Require (TextElement)) - (Call + (Send (Identifier) (Symbol) - (TextElement) - (Empty))) + (TextElement)))