mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Merge pull request #1729 from github/charliesome/ruby-method-calls
Add special Ruby.Syntax.Send node type
This commit is contained in:
commit
a69906aa28
@ -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
|
||||
@ -290,11 +292,21 @@ subscript = makeTerm <$> symbol ElementReference <*> children (Expression.Subscr
|
||||
pair :: Assignment
|
||||
pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression <*> (expression <|> emptyTerm))
|
||||
|
||||
args :: Assignment' [Term]
|
||||
args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> many expression
|
||||
|
||||
methodCall :: Assignment
|
||||
methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> regularCall)
|
||||
methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> send)
|
||||
where
|
||||
regularCall = inj <$> (Expression.Call <$> pure [] <*> expression <*> args <*> (block <|> emptyTerm))
|
||||
require = inj <$> (symbol Identifier *> do
|
||||
send = inj <$> ((regularCall <|> funcCall <|> scopeCall <|> dotCall) <*> optional block)
|
||||
|
||||
funcCall = Ruby.Syntax.Send Nothing <$> selector <*> args
|
||||
regularCall = symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> postContextualize heredoc expression) <*> selector) <*> args
|
||||
scopeCall = symbol ScopeResolution *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> selector) <*> args
|
||||
dotCall = symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> term expression) <*> pure Nothing <*> args)
|
||||
|
||||
selector = Just <$> term methodSelector
|
||||
require = inj <$> ((symbol Identifier <|> symbol Identifier') *> do
|
||||
s <- source
|
||||
guard (s `elem` ["require", "require_relative"])
|
||||
Ruby.Syntax.Require (s == "require_relative") <$> nameExpression)
|
||||
@ -302,14 +314,22 @@ 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 []
|
||||
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 <*> (args <|> expressions))
|
||||
methodSelector :: Assignment
|
||||
methodSelector = makeTerm <$> symbols <*> (Syntax.Identifier <$> (name <$> source))
|
||||
where
|
||||
args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expressions
|
||||
symbols = symbol Identifier
|
||||
<|> symbol Identifier'
|
||||
<|> symbol Constant
|
||||
<|> symbol Operator
|
||||
<|> symbol Super -- TODO(@charliesome): super calls are *not* method calls and need to be assigned into their own syntax terms
|
||||
|
||||
call :: Assignment
|
||||
call = makeTerm <$> symbol Call <*> children (
|
||||
(Ruby.Syntax.Send <$> (Just <$> term expression) <*> (Just <$> methodSelector) <*> pure [] <*> pure Nothing) <|>
|
||||
(Ruby.Syntax.Send <$> (Just <$> term expression) <*> pure Nothing <*> args <*> pure Nothing))
|
||||
|
||||
rescue :: Assignment
|
||||
rescue = rescue'
|
||||
@ -405,7 +425,8 @@ invert term = makeTerm <$> location <*> fmap Expression.Not term
|
||||
|
||||
-- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present.
|
||||
term :: Assignment -> Assignment
|
||||
term term = contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)
|
||||
term term = contextualize comment term <|> makeTerm1 <$> (Syntax.Context <$> some1 (comment <|> heredocEnd) <*> emptyTerm)
|
||||
where heredocEnd = makeTerm <$> symbol HeredocEnd <*> (Literal.TextElement <$> source)
|
||||
|
||||
-- | Match a series of terms or comments until a delimiter is matched.
|
||||
manyTermsTill :: Assignment.Assignment [] Grammar Term -> Assignment.Assignment [] Grammar b -> Assignment.Assignment [] Grammar [Term]
|
||||
|
@ -36,6 +36,27 @@ maybeFailNotFound name = maybeFail notFound
|
||||
cleanNameOrPath :: ByteString -> String
|
||||
cleanNameOrPath = BC.unpack . dropRelativePrefix . stripQuotes
|
||||
|
||||
data Send a = Send { sendReceiver :: Maybe a, sendSelector :: Maybe 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
|
||||
let sel = case sendSelector of
|
||||
Just sel -> subtermValue sel
|
||||
Nothing -> variable (name "call")
|
||||
|
||||
func <- case sendReceiver of
|
||||
Just recv -> do
|
||||
recvEnv <- subtermValue recv >>= scopedEnvironment
|
||||
localEnv (mappend recvEnv) sel
|
||||
Nothing -> sel -- 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)
|
||||
|
||||
|
5
test/fixtures/ruby/begin.diffA-B.txt
vendored
5
test/fixtures/ruby/begin.diffA-B.txt
vendored
@ -5,7 +5,6 @@
|
||||
(
|
||||
(Try
|
||||
{ ([])
|
||||
->(Call
|
||||
->(Send
|
||||
{+(Identifier)+}
|
||||
{+(TextElement)+}
|
||||
{+(Empty)+}) }))))
|
||||
{+(TextElement)+}) }))))
|
||||
|
5
test/fixtures/ruby/begin.diffB-A.txt
vendored
5
test/fixtures/ruby/begin.diffB-A.txt
vendored
@ -4,8 +4,7 @@
|
||||
(Identifier)
|
||||
(
|
||||
(Try
|
||||
{ (Call
|
||||
{ (Send
|
||||
{-(Identifier)-}
|
||||
{-(TextElement)-}
|
||||
{-(Empty)-})
|
||||
{-(TextElement)-})
|
||||
->([]) }))))
|
||||
|
5
test/fixtures/ruby/begin.parseB.txt
vendored
5
test/fixtures/ruby/begin.parseB.txt
vendored
@ -4,7 +4,6 @@
|
||||
(Identifier)
|
||||
(
|
||||
(Try
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(TextElement)
|
||||
(Empty))))))
|
||||
(TextElement))))))
|
||||
|
10
test/fixtures/ruby/else.diffA-B.txt
vendored
10
test/fixtures/ruby/else.diffA-B.txt
vendored
@ -1,12 +1,10 @@
|
||||
(Program
|
||||
(Try
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Send
|
||||
(Identifier))
|
||||
(Else
|
||||
(Empty)
|
||||
{ ([])
|
||||
->(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+}) }))))
|
||||
->(Send
|
||||
{+(Identifier)+}) }))))
|
||||
|
10
test/fixtures/ruby/else.diffB-A.txt
vendored
10
test/fixtures/ruby/else.diffB-A.txt
vendored
@ -1,12 +1,10 @@
|
||||
(Program
|
||||
(Try
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Send
|
||||
(Identifier))
|
||||
(Else
|
||||
(Empty)
|
||||
{ (Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})
|
||||
{ (Send
|
||||
{-(Identifier)-})
|
||||
->([]) }))))
|
||||
|
5
test/fixtures/ruby/else.parseA.txt
vendored
5
test/fixtures/ruby/else.parseA.txt
vendored
@ -1,9 +1,8 @@
|
||||
(Program
|
||||
(Try
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Send
|
||||
(Identifier))
|
||||
(Else
|
||||
(Empty)
|
||||
([])))))
|
||||
|
10
test/fixtures/ruby/else.parseB.txt
vendored
10
test/fixtures/ruby/else.parseB.txt
vendored
@ -1,11 +1,9 @@
|
||||
(Program
|
||||
(Try
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Send
|
||||
(Identifier))
|
||||
(Else
|
||||
(Empty)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))))))
|
||||
(Send
|
||||
(Identifier))))))
|
||||
|
10
test/fixtures/ruby/elsif.diffA-B.txt
vendored
10
test/fixtures/ruby/elsif.diffA-B.txt
vendored
@ -2,13 +2,11 @@
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})
|
||||
{+(Send
|
||||
{+(Identifier)+})+})
|
||||
(Empty))))
|
||||
|
10
test/fixtures/ruby/elsif.diffB-A.txt
vendored
10
test/fixtures/ruby/elsif.diffB-A.txt
vendored
@ -2,13 +2,11 @@
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(If
|
||||
(Identifier)
|
||||
([]
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})
|
||||
{-(Send
|
||||
{-(Identifier)-})-})
|
||||
(Empty))))
|
||||
|
5
test/fixtures/ruby/elsif.parseA.txt
vendored
5
test/fixtures/ruby/elsif.parseA.txt
vendored
@ -2,9 +2,8 @@
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(If
|
||||
(Identifier)
|
||||
([])
|
||||
|
10
test/fixtures/ruby/elsif.parseB.txt
vendored
10
test/fixtures/ruby/elsif.parseB.txt
vendored
@ -2,13 +2,11 @@
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(If
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
(Empty))))
|
||||
|
5
test/fixtures/ruby/for.diffA-B.txt
vendored
5
test/fixtures/ruby/for.diffA-B.txt
vendored
@ -6,10 +6,9 @@
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
{+(Call
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(Identifier)+})+})+}
|
||||
{-(ForEach
|
||||
{-(
|
||||
{-(Identifier)-})-}
|
||||
|
5
test/fixtures/ruby/for.diffB-A.txt
vendored
5
test/fixtures/ruby/for.diffB-A.txt
vendored
@ -22,10 +22,9 @@
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}
|
||||
{+(Empty)+}) }
|
||||
{ (Call
|
||||
{ (Send
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})
|
||||
{-(Identifier)-})
|
||||
->(Boolean) })
|
||||
{+(ForEach
|
||||
{+(
|
||||
|
5
test/fixtures/ruby/for.parseB.txt
vendored
5
test/fixtures/ruby/for.parseB.txt
vendored
@ -6,7 +6,6 @@
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))))
|
||||
(Identifier))))
|
||||
|
15
test/fixtures/ruby/heredoc.diffA-B.txt
vendored
15
test/fixtures/ruby/heredoc.diffA-B.txt
vendored
@ -1,12 +1,9 @@
|
||||
(Program
|
||||
{+(Call
|
||||
{+(MemberAccess
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(TextElement)+}
|
||||
{+(TextElement)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Empty)+})+}
|
||||
{+(Send
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(TextElement)+}
|
||||
{+(TextElement)+})+}
|
||||
{+(Identifier)+})+}
|
||||
{-(TextElement)-}
|
||||
{-(TextElement)-})
|
||||
|
15
test/fixtures/ruby/heredoc.diffB-A.txt
vendored
15
test/fixtures/ruby/heredoc.diffB-A.txt
vendored
@ -1,12 +1,9 @@
|
||||
(Program
|
||||
{+(TextElement)+}
|
||||
{+(TextElement)+}
|
||||
{-(Call
|
||||
{-(MemberAccess
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(TextElement)-}
|
||||
{-(TextElement)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Empty)-})-})
|
||||
{-(Send
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(TextElement)-}
|
||||
{-(TextElement)-})-}
|
||||
{-(Identifier)-})-})
|
||||
|
15
test/fixtures/ruby/heredoc.parseB.txt
vendored
15
test/fixtures/ruby/heredoc.parseB.txt
vendored
@ -1,10 +1,7 @@
|
||||
(Program
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Call
|
||||
(Identifier)
|
||||
(TextElement)
|
||||
(TextElement)
|
||||
(Empty))
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(Send
|
||||
(Send
|
||||
(Identifier)
|
||||
(TextElement)
|
||||
(TextElement))
|
||||
(Identifier)))
|
||||
|
6
test/fixtures/ruby/lambda.diffA-B.txt
vendored
6
test/fixtures/ruby/lambda.diffA-B.txt
vendored
@ -1,5 +1,5 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
@ -8,12 +8,12 @@
|
||||
->(Plus
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}) }))
|
||||
{-(Call
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Function
|
||||
{-(Empty)-}
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Call
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Function
|
||||
{-(Empty)-}
|
||||
|
6
test/fixtures/ruby/lambda.diffB-A.txt
vendored
6
test/fixtures/ruby/lambda.diffB-A.txt
vendored
@ -1,5 +1,5 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
@ -8,12 +8,12 @@
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->([]) }))
|
||||
{+(Call
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Function
|
||||
{+(Empty)+}
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Call
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Function
|
||||
{+(Empty)+}
|
||||
|
6
test/fixtures/ruby/lambda.parseA.txt
vendored
6
test/fixtures/ruby/lambda.parseA.txt
vendored
@ -1,15 +1,15 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
([])))
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
(Identifier)))
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
|
2
test/fixtures/ruby/lambda.parseB.txt
vendored
2
test/fixtures/ruby/lambda.parseB.txt
vendored
@ -1,5 +1,5 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Symbol)
|
||||
(Boolean))
|
||||
{+(KeyValue
|
||||
{+(Symbol)+}
|
||||
{+(Integer)+})+}
|
||||
(Empty)))
|
||||
{+(Integer)+})+}))
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Symbol)
|
||||
(Boolean))
|
||||
{-(KeyValue
|
||||
{-(Symbol)-}
|
||||
{-(Integer)-})-}
|
||||
(Empty)))
|
||||
{-(Integer)-})-}))
|
||||
|
@ -1,7 +1,6 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Symbol)
|
||||
(Boolean))
|
||||
(Empty)))
|
||||
(Boolean))))
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Symbol)
|
||||
(Boolean))
|
||||
(KeyValue
|
||||
(Symbol)
|
||||
(Integer))
|
||||
(Empty)))
|
||||
(Integer))))
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
{+(KeyValue
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+}
|
||||
(Empty)))
|
||||
{+(Integer)+})+}))
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
{-(KeyValue
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-}
|
||||
(Empty)))
|
||||
{-(Integer)-})-}))
|
||||
|
@ -1,7 +1,6 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
(Empty)))
|
||||
(Boolean))))
|
||||
|
@ -1,10 +1,9 @@
|
||||
(Program
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Boolean))
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Empty)))
|
||||
(Integer))))
|
||||
|
28
test/fixtures/ruby/method-calls.diffA-B.txt
vendored
28
test/fixtures/ruby/method-calls.diffA-B.txt
vendored
@ -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)-})-})-})-})
|
||||
|
26
test/fixtures/ruby/method-calls.diffB-A.txt
vendored
26
test/fixtures/ruby/method-calls.diffB-A.txt
vendored
@ -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)+})+})+})+})
|
||||
|
26
test/fixtures/ruby/method-calls.parseA.txt
vendored
26
test/fixtures/ruby/method-calls.parseA.txt
vendored
@ -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)))))
|
||||
|
5
test/fixtures/ruby/method-calls.parseB.txt
vendored
5
test/fixtures/ruby/method-calls.parseB.txt
vendored
@ -1,4 +1,3 @@
|
||||
(Program
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Send
|
||||
(Identifier)))
|
||||
|
34
test/fixtures/ruby/method-invocation.diffA-B.txt
vendored
34
test/fixtures/ruby/method-invocation.diffA-B.txt
vendored
@ -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)-})
|
||||
|
28
test/fixtures/ruby/method-invocation.diffB-A.txt
vendored
28
test/fixtures/ruby/method-invocation.diffB-A.txt
vendored
@ -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)-})-})
|
||||
|
@ -1,6 +1,6 @@
|
||||
(Program
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
|
23
test/fixtures/ruby/method-invocation.parseB.txt
vendored
23
test/fixtures/ruby/method-invocation.parseB.txt
vendored
@ -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)))
|
||||
|
@ -37,17 +37,17 @@
|
||||
{-(Identifier)-})-}
|
||||
{-(Assignment
|
||||
{-(
|
||||
{-(MemberAccess
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(MemberAccess
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-})-}
|
||||
{-(
|
||||
{-(MemberAccess
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(MemberAccess
|
||||
{-(Send
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(Assignment
|
||||
|
@ -37,17 +37,17 @@
|
||||
{+(Identifier)+})+}
|
||||
{+(Assignment
|
||||
{+(
|
||||
{+(MemberAccess
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(MemberAccess
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+})+}
|
||||
{+(
|
||||
{+(MemberAccess
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(MemberAccess
|
||||
{+(Send
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(Assignment
|
||||
|
@ -36,17 +36,17 @@
|
||||
(Identifier))
|
||||
(Assignment
|
||||
(
|
||||
(MemberAccess
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MemberAccess
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(
|
||||
(MemberAccess
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MemberAccess
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier))))
|
||||
(Assignment
|
||||
|
@ -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)-})-})
|
||||
|
@ -1,5 +1,5 @@
|
||||
(Program
|
||||
{(Comparison
|
||||
{ (Comparison
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})
|
||||
->(Equal
|
||||
@ -17,4 +17,5 @@
|
||||
{-(Identifier)-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Not{-(Identifier)-})-})- })
|
||||
{-(Not
|
||||
{-(Identifier)-})-})-})
|
||||
|
5
test/fixtures/ruby/require.diffA-B.txt
vendored
5
test/fixtures/ruby/require.diffA-B.txt
vendored
@ -2,10 +2,9 @@
|
||||
(Require
|
||||
{ (TextElement)
|
||||
->(TextElement) })
|
||||
(Call
|
||||
(Send
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Symbol)+}
|
||||
{+(TextElement)+}
|
||||
{-(Identifier)-}
|
||||
(Empty)))
|
||||
{-(Identifier)-}))
|
||||
|
5
test/fixtures/ruby/require.diffB-A.txt
vendored
5
test/fixtures/ruby/require.diffB-A.txt
vendored
@ -2,10 +2,9 @@
|
||||
(Require
|
||||
{ (TextElement)
|
||||
->(TextElement) })
|
||||
(Call
|
||||
(Send
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Identifier)+}
|
||||
{-(Symbol)-}
|
||||
{-(TextElement)-}
|
||||
(Empty)))
|
||||
{-(TextElement)-}))
|
||||
|
5
test/fixtures/ruby/require.parseA.txt
vendored
5
test/fixtures/ruby/require.parseA.txt
vendored
@ -1,7 +1,6 @@
|
||||
(Program
|
||||
(Require
|
||||
(TextElement))
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(Identifier)))
|
||||
|
5
test/fixtures/ruby/require.parseB.txt
vendored
5
test/fixtures/ruby/require.parseB.txt
vendored
@ -1,8 +1,7 @@
|
||||
(Program
|
||||
(Require
|
||||
(TextElement))
|
||||
(Call
|
||||
(Send
|
||||
(Identifier)
|
||||
(Symbol)
|
||||
(TextElement)
|
||||
(Empty)))
|
||||
(TextElement)))
|
||||
|
Loading…
Reference in New Issue
Block a user