mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Merge remote-tracking branch 'origin/master' into charliesome/ruby-method-calls
This commit is contained in:
commit
7e1330c5e8
@ -74,7 +74,6 @@ type Syntax = '[
|
|||||||
, Syntax.Identifier
|
, Syntax.Identifier
|
||||||
, Syntax.Paren
|
, Syntax.Paren
|
||||||
, Syntax.Program
|
, Syntax.Program
|
||||||
, Ruby.Syntax.Send
|
|
||||||
, Ruby.Syntax.Class
|
, Ruby.Syntax.Class
|
||||||
, Ruby.Syntax.Load
|
, Ruby.Syntax.Load
|
||||||
, Ruby.Syntax.LowPrecedenceBoolean
|
, Ruby.Syntax.LowPrecedenceBoolean
|
||||||
@ -84,8 +83,7 @@ type Syntax = '[
|
|||||||
]
|
]
|
||||||
|
|
||||||
type Term = Term.Term (Union Syntax) (Record Location)
|
type Term = Term.Term (Union Syntax) (Record Location)
|
||||||
type Assignment' a = HasCallStack => Assignment.Assignment [] Grammar a
|
type Assignment = HasCallStack => Assignment.Assignment [] Grammar Term
|
||||||
type Assignment = Assignment' Term
|
|
||||||
|
|
||||||
-- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax.
|
-- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax.
|
||||||
assignment :: Assignment
|
assignment :: Assignment
|
||||||
@ -293,12 +291,9 @@ pair :: Assignment
|
|||||||
pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression <*> (expression <|> emptyTerm))
|
pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression <*> (expression <|> emptyTerm))
|
||||||
|
|
||||||
methodCall :: Assignment
|
methodCall :: Assignment
|
||||||
methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> funcCall <|> regularCall)
|
methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> regularCall)
|
||||||
where
|
where
|
||||||
funcCall = inj <$> (Ruby.Syntax.Send Nothing <$> methodSelector <*> args <*> optional block)
|
regularCall = inj <$> (Expression.Call <$> pure [] <*> expression <*> args <*> (block <|> emptyTerm))
|
||||||
|
|
||||||
regularCall = inj <$> (symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector) <*> args <*> optional block)
|
|
||||||
|
|
||||||
require = inj <$> (symbol Identifier *> do
|
require = inj <$> (symbol Identifier *> do
|
||||||
s <- source
|
s <- source
|
||||||
guard (s `elem` ["require", "require_relative"])
|
guard (s `elem` ["require", "require_relative"])
|
||||||
@ -307,17 +302,14 @@ methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|>
|
|||||||
s <- source
|
s <- source
|
||||||
guard (s == "load")
|
guard (s == "load")
|
||||||
Ruby.Syntax.Load <$> loadArgs)
|
Ruby.Syntax.Load <$> loadArgs)
|
||||||
args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> many expression
|
args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (many expression) <|> pure []
|
||||||
loadArgs = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (some expression)
|
loadArgs = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children (some expression)
|
||||||
nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression
|
nameExpression = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expression
|
||||||
|
|
||||||
methodSelector :: Assignment
|
|
||||||
methodSelector = mk Identifier <|> mk Identifier'
|
|
||||||
where
|
|
||||||
mk s = makeTerm <$> symbol s <*> (Syntax.Identifier <$> (name <$> source))
|
|
||||||
|
|
||||||
call :: Assignment
|
call :: Assignment
|
||||||
call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector <*> pure [] <*> optional block)
|
call = makeTerm <$> symbol Call <*> children (Expression.MemberAccess <$> expression <*> (expressions <|> args))
|
||||||
|
where
|
||||||
|
args = (symbol ArgumentList <|> symbol ArgumentListWithParens) *> children expressions
|
||||||
|
|
||||||
rescue :: Assignment
|
rescue :: Assignment
|
||||||
rescue = rescue'
|
rescue = rescue'
|
||||||
|
@ -36,22 +36,6 @@ maybeFailNotFound name = maybeFail notFound
|
|||||||
cleanNameOrPath :: ByteString -> String
|
cleanNameOrPath :: ByteString -> String
|
||||||
cleanNameOrPath = BC.unpack . dropRelativePrefix . stripQuotes
|
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 }
|
data Require a = Require { requireRelative :: Bool, requirePath :: !a }
|
||||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
|
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,6 +5,7 @@
|
|||||||
(
|
(
|
||||||
(Try
|
(Try
|
||||||
{ ([])
|
{ ([])
|
||||||
->(Send
|
->(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(TextElement)+}) }))))
|
{+(TextElement)+}
|
||||||
|
{+(Empty)+}) }))))
|
||||||
|
5
test/fixtures/ruby/begin.diffB-A.txt
vendored
5
test/fixtures/ruby/begin.diffB-A.txt
vendored
@ -4,7 +4,8 @@
|
|||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Try
|
(Try
|
||||||
{ (Send
|
{ (Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(TextElement)-})
|
{-(TextElement)-}
|
||||||
|
{-(Empty)-})
|
||||||
->([]) }))))
|
->([]) }))))
|
||||||
|
5
test/fixtures/ruby/begin.parseB.txt
vendored
5
test/fixtures/ruby/begin.parseB.txt
vendored
@ -4,6 +4,7 @@
|
|||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Try
|
(Try
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(TextElement))))))
|
(TextElement)
|
||||||
|
(Empty))))))
|
||||||
|
10
test/fixtures/ruby/else.diffA-B.txt
vendored
10
test/fixtures/ruby/else.diffA-B.txt
vendored
@ -1,10 +1,12 @@
|
|||||||
(Program
|
(Program
|
||||||
(Try
|
(Try
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier))
|
(Identifier)
|
||||||
|
(Empty))
|
||||||
(Else
|
(Else
|
||||||
(Empty)
|
(Empty)
|
||||||
{ ([])
|
{ ([])
|
||||||
->(Send
|
->(Call
|
||||||
{+(Identifier)+}) }))))
|
{+(Identifier)+}
|
||||||
|
{+(Empty)+}) }))))
|
||||||
|
10
test/fixtures/ruby/else.diffB-A.txt
vendored
10
test/fixtures/ruby/else.diffB-A.txt
vendored
@ -1,10 +1,12 @@
|
|||||||
(Program
|
(Program
|
||||||
(Try
|
(Try
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier))
|
(Identifier)
|
||||||
|
(Empty))
|
||||||
(Else
|
(Else
|
||||||
(Empty)
|
(Empty)
|
||||||
{ (Send
|
{ (Call
|
||||||
{-(Identifier)-})
|
{-(Identifier)-}
|
||||||
|
{-(Empty)-})
|
||||||
->([]) }))))
|
->([]) }))))
|
||||||
|
5
test/fixtures/ruby/else.parseA.txt
vendored
5
test/fixtures/ruby/else.parseA.txt
vendored
@ -1,8 +1,9 @@
|
|||||||
(Program
|
(Program
|
||||||
(Try
|
(Try
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier))
|
(Identifier)
|
||||||
|
(Empty))
|
||||||
(Else
|
(Else
|
||||||
(Empty)
|
(Empty)
|
||||||
([])))))
|
([])))))
|
||||||
|
10
test/fixtures/ruby/else.parseB.txt
vendored
10
test/fixtures/ruby/else.parseB.txt
vendored
@ -1,9 +1,11 @@
|
|||||||
(Program
|
(Program
|
||||||
(Try
|
(Try
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier))
|
(Identifier)
|
||||||
|
(Empty))
|
||||||
(Else
|
(Else
|
||||||
(Empty)
|
(Empty)
|
||||||
(Send
|
(Call
|
||||||
(Identifier))))))
|
(Identifier)
|
||||||
|
(Empty))))))
|
||||||
|
10
test/fixtures/ruby/elsif.diffA-B.txt
vendored
10
test/fixtures/ruby/elsif.diffA-B.txt
vendored
@ -2,11 +2,13 @@
|
|||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+})+})
|
{+(Identifier)+}
|
||||||
|
{+(Empty)+})+})
|
||||||
(Empty))))
|
(Empty))))
|
||||||
|
10
test/fixtures/ruby/elsif.diffB-A.txt
vendored
10
test/fixtures/ruby/elsif.diffB-A.txt
vendored
@ -2,11 +2,13 @@
|
|||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
([]
|
([]
|
||||||
{-(Send
|
{-(Call
|
||||||
{-(Identifier)-})-})
|
{-(Identifier)-}
|
||||||
|
{-(Empty)-})-})
|
||||||
(Empty))))
|
(Empty))))
|
||||||
|
5
test/fixtures/ruby/elsif.parseA.txt
vendored
5
test/fixtures/ruby/elsif.parseA.txt
vendored
@ -2,8 +2,9 @@
|
|||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
([])
|
([])
|
||||||
|
10
test/fixtures/ruby/elsif.parseB.txt
vendored
10
test/fixtures/ruby/elsif.parseB.txt
vendored
@ -2,11 +2,13 @@
|
|||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
(If
|
(If
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(
|
(
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
(Empty))))
|
(Empty))))
|
||||||
|
5
test/fixtures/ruby/for.diffA-B.txt
vendored
5
test/fixtures/ruby/for.diffA-B.txt
vendored
@ -6,9 +6,10 @@
|
|||||||
{+(Integer)+}
|
{+(Integer)+}
|
||||||
{+(Integer)+}
|
{+(Integer)+}
|
||||||
{+(Integer)+})+}
|
{+(Integer)+})+}
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+})+}
|
{+(Identifier)+}
|
||||||
|
{+(Empty)+})+})+}
|
||||||
{-(ForEach
|
{-(ForEach
|
||||||
{-(
|
{-(
|
||||||
{-(Identifier)-})-}
|
{-(Identifier)-})-}
|
||||||
|
5
test/fixtures/ruby/for.diffB-A.txt
vendored
5
test/fixtures/ruby/for.diffB-A.txt
vendored
@ -22,9 +22,10 @@
|
|||||||
{+(Integer)+}
|
{+(Integer)+}
|
||||||
{+(Integer)+}
|
{+(Integer)+}
|
||||||
{+(Empty)+}) }
|
{+(Empty)+}) }
|
||||||
{ (Send
|
{ (Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})
|
{-(Identifier)-}
|
||||||
|
{-(Empty)-})
|
||||||
->(Boolean) })
|
->(Boolean) })
|
||||||
{+(ForEach
|
{+(ForEach
|
||||||
{+(
|
{+(
|
||||||
|
5
test/fixtures/ruby/for.parseB.txt
vendored
5
test/fixtures/ruby/for.parseB.txt
vendored
@ -6,6 +6,7 @@
|
|||||||
(Integer)
|
(Integer)
|
||||||
(Integer)
|
(Integer)
|
||||||
(Integer))
|
(Integer))
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier))))
|
(Identifier)
|
||||||
|
(Empty))))
|
||||||
|
15
test/fixtures/ruby/heredoc.diffA-B.txt
vendored
15
test/fixtures/ruby/heredoc.diffA-B.txt
vendored
@ -1,9 +1,12 @@
|
|||||||
(Program
|
(Program
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Send
|
{+(MemberAccess
|
||||||
{+(Identifier)+}
|
{+(Call
|
||||||
{+(TextElement)+}
|
{+(Identifier)+}
|
||||||
{+(TextElement)+})+}
|
{+(TextElement)+}
|
||||||
{+(Identifier)+})+}
|
{+(TextElement)+}
|
||||||
|
{+(Empty)+})+}
|
||||||
|
{+(Identifier)+})+}
|
||||||
|
{+(Empty)+})+}
|
||||||
{-(TextElement)-}
|
{-(TextElement)-}
|
||||||
{-(TextElement)-})
|
{-(TextElement)-})
|
||||||
|
15
test/fixtures/ruby/heredoc.diffB-A.txt
vendored
15
test/fixtures/ruby/heredoc.diffB-A.txt
vendored
@ -1,9 +1,12 @@
|
|||||||
(Program
|
(Program
|
||||||
{+(TextElement)+}
|
{+(TextElement)+}
|
||||||
{+(TextElement)+}
|
{+(TextElement)+}
|
||||||
{-(Send
|
{-(Call
|
||||||
{-(Send
|
{-(MemberAccess
|
||||||
{-(Identifier)-}
|
{-(Call
|
||||||
{-(TextElement)-}
|
{-(Identifier)-}
|
||||||
{-(TextElement)-})-}
|
{-(TextElement)-}
|
||||||
{-(Identifier)-})-})
|
{-(TextElement)-}
|
||||||
|
{-(Empty)-})-}
|
||||||
|
{-(Identifier)-})-}
|
||||||
|
{-(Empty)-})-})
|
||||||
|
15
test/fixtures/ruby/heredoc.parseB.txt
vendored
15
test/fixtures/ruby/heredoc.parseB.txt
vendored
@ -1,7 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Call
|
||||||
(TextElement)
|
(Identifier)
|
||||||
(TextElement))
|
(TextElement)
|
||||||
(Identifier)))
|
(TextElement)
|
||||||
|
(Empty))
|
||||||
|
(Identifier))
|
||||||
|
(Empty)))
|
||||||
|
9
test/fixtures/ruby/lambda.diffA-B.txt
vendored
9
test/fixtures/ruby/lambda.diffA-B.txt
vendored
@ -1,8 +1,9 @@
|
|||||||
(Program
|
(Program
|
||||||
{-(Send
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Hash)-})-}
|
{-(Hash)-}
|
||||||
(Send
|
{-(Empty)-})-}
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
@ -11,7 +12,7 @@
|
|||||||
->(Plus
|
->(Plus
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Integer)+}) }))
|
{+(Integer)+}) }))
|
||||||
{-(Send
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Function
|
{-(Function
|
||||||
{-(Empty)-}
|
{-(Empty)-}
|
||||||
|
9
test/fixtures/ruby/lambda.diffB-A.txt
vendored
9
test/fixtures/ruby/lambda.diffB-A.txt
vendored
@ -1,8 +1,9 @@
|
|||||||
(Program
|
(Program
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Hash)+})+}
|
{+(Hash)+}
|
||||||
(Send
|
{+(Empty)+})+}
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
@ -11,7 +12,7 @@
|
|||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Integer)-})
|
{-(Integer)-})
|
||||||
->(Identifier) }))
|
->(Identifier) }))
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Function
|
{+(Function
|
||||||
{+(Empty)+}
|
{+(Empty)+}
|
||||||
|
9
test/fixtures/ruby/lambda.parseA.txt
vendored
9
test/fixtures/ruby/lambda.parseA.txt
vendored
@ -1,13 +1,14 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Hash))
|
(Hash)
|
||||||
(Send
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
(Identifier)))
|
(Identifier)))
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
|
2
test/fixtures/ruby/lambda.parseB.txt
vendored
2
test/fixtures/ruby/lambda.parseB.txt
vendored
@ -1,5 +1,5 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
{+(KeyValue
|
{+(KeyValue
|
||||||
{+(Symbol)+}
|
{+(Symbol)+}
|
||||||
{+(Integer)+})+}))
|
{+(Integer)+})+}
|
||||||
|
(Empty)))
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
{-(KeyValue
|
{-(KeyValue
|
||||||
{-(Symbol)-}
|
{-(Symbol)-}
|
||||||
{-(Integer)-})-}))
|
{-(Integer)-})-}
|
||||||
|
(Empty)))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(Boolean))))
|
(Boolean))
|
||||||
|
(Empty)))
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(Integer))))
|
(Integer))
|
||||||
|
(Empty)))
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
{+(KeyValue
|
{+(KeyValue
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Integer)+})+}))
|
{+(Integer)+})+}
|
||||||
|
(Empty)))
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
{-(KeyValue
|
{-(KeyValue
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Integer)-})-}))
|
{-(Integer)-})-}
|
||||||
|
(Empty)))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Boolean))))
|
(Boolean))
|
||||||
|
(Empty)))
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Boolean))
|
(Boolean))
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Integer))))
|
(Integer))
|
||||||
|
(Empty)))
|
||||||
|
28
test/fixtures/ruby/method-calls.diffA-B.txt
vendored
28
test/fixtures/ruby/method-calls.diffA-B.txt
vendored
@ -1,9 +1,11 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
{-(Identifier)-}
|
{ (MemberAccess
|
||||||
{ (Identifier)
|
{-(Identifier)-}
|
||||||
->(Identifier) })
|
{-(Identifier)-})
|
||||||
{-(Send
|
->(Identifier) }
|
||||||
|
(Empty))
|
||||||
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
@ -12,13 +14,16 @@
|
|||||||
{-(Integer)-})-}
|
{-(Integer)-})-}
|
||||||
{-(KeyValue
|
{-(KeyValue
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Integer)-})-})-}
|
{-(Integer)-})-}
|
||||||
{-(Send
|
{-(Empty)-})-}
|
||||||
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Send
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-})-}
|
{-(Identifier)-}
|
||||||
{-(Send
|
{-(Empty)-})-}
|
||||||
|
{-(Empty)-})-}
|
||||||
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(KeyValue
|
{-(KeyValue
|
||||||
{-(Array)-}
|
{-(Array)-}
|
||||||
@ -30,4 +35,5 @@
|
|||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Function
|
{-(Function
|
||||||
{-(Empty)-}
|
{-(Empty)-}
|
||||||
{-(Integer)-})-})-})-})
|
{-(Integer)-})-})-}
|
||||||
|
{-(Empty)-})-})
|
||||||
|
26
test/fixtures/ruby/method-calls.diffB-A.txt
vendored
26
test/fixtures/ruby/method-calls.diffB-A.txt
vendored
@ -1,9 +1,11 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
{+(Identifier)+}
|
|
||||||
{ (Identifier)
|
{ (Identifier)
|
||||||
->(Identifier) })
|
->(MemberAccess
|
||||||
{+(Send
|
{+(Identifier)+}
|
||||||
|
{+(Identifier)+}) }
|
||||||
|
(Empty))
|
||||||
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
@ -12,13 +14,16 @@
|
|||||||
{+(Integer)+})+}
|
{+(Integer)+})+}
|
||||||
{+(KeyValue
|
{+(KeyValue
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Integer)+})+})+}
|
{+(Integer)+})+}
|
||||||
{+(Send
|
{+(Empty)+})+}
|
||||||
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+})+}
|
{+(Identifier)+}
|
||||||
{+(Send
|
{+(Empty)+})+}
|
||||||
|
{+(Empty)+})+}
|
||||||
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(KeyValue
|
{+(KeyValue
|
||||||
{+(Array)+}
|
{+(Array)+}
|
||||||
@ -30,4 +35,5 @@
|
|||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Function
|
{+(Function
|
||||||
{+(Empty)+}
|
{+(Empty)+}
|
||||||
{+(Integer)+})+})+})+})
|
{+(Integer)+})+})+}
|
||||||
|
{+(Empty)+})+})
|
||||||
|
26
test/fixtures/ruby/method-calls.parseA.txt
vendored
26
test/fixtures/ruby/method-calls.parseA.txt
vendored
@ -1,8 +1,10 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(MemberAccess
|
||||||
(Identifier))
|
(Identifier)
|
||||||
(Send
|
(Identifier))
|
||||||
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier)
|
(Identifier)
|
||||||
@ -11,13 +13,16 @@
|
|||||||
(Integer))
|
(Integer))
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Integer)))
|
(Integer))
|
||||||
(Send
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
(Send
|
(Empty))
|
||||||
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(KeyValue
|
(KeyValue
|
||||||
(Array)
|
(Array)
|
||||||
@ -29,4 +34,5 @@
|
|||||||
(Identifier)
|
(Identifier)
|
||||||
(Function
|
(Function
|
||||||
(Empty)
|
(Empty)
|
||||||
(Integer)))))
|
(Integer)))
|
||||||
|
(Empty)))
|
||||||
|
5
test/fixtures/ruby/method-calls.parseB.txt
vendored
5
test/fixtures/ruby/method-calls.parseB.txt
vendored
@ -1,3 +1,4 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
|
34
test/fixtures/ruby/method-invocation.diffA-B.txt
vendored
34
test/fixtures/ruby/method-invocation.diffA-B.txt
vendored
@ -1,17 +1,25 @@
|
|||||||
(Program
|
(Program
|
||||||
{+(Send
|
{+(Call
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(TextElement)+})+}
|
{+(TextElement)+}
|
||||||
|
{+(Empty)+})+}
|
||||||
|
{+(Call
|
||||||
|
{+(MemberAccess
|
||||||
|
{+(Identifier)+}
|
||||||
|
{+(Identifier)+})+}
|
||||||
|
{+(Empty)+})+}
|
||||||
|
{+(Call
|
||||||
|
{+(Identifier)+}
|
||||||
|
{+(Integer)+}
|
||||||
|
{+(Integer)+}
|
||||||
|
{+(Empty)+})+}
|
||||||
|
{+(Call
|
||||||
|
{+(Identifier)+}
|
||||||
|
{+(Integer)+}
|
||||||
|
{+(Integer)+}
|
||||||
|
{+(Empty)+})+}
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
(Send
|
{-(MemberAccess
|
||||||
(Identifier)
|
{-(Identifier)-}
|
||||||
(Identifier))
|
{-(Identifier)-})-}
|
||||||
{+(Send
|
|
||||||
{+(Identifier)+}
|
|
||||||
{+(Integer)+}
|
|
||||||
{+(Integer)+})+}
|
|
||||||
{+(Send
|
|
||||||
{+(Identifier)+}
|
|
||||||
{+(Integer)+}
|
|
||||||
{+(Integer)+})+}
|
|
||||||
{-(Identifier)-})
|
{-(Identifier)-})
|
||||||
|
28
test/fixtures/ruby/method-invocation.diffB-A.txt
vendored
28
test/fixtures/ruby/method-invocation.diffB-A.txt
vendored
@ -1,17 +1,25 @@
|
|||||||
(Program
|
(Program
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{-(Send
|
{+(MemberAccess
|
||||||
{-(Identifier)-}
|
{+(Identifier)+}
|
||||||
{-(TextElement)-})-}
|
{+(Identifier)+})+}
|
||||||
(Send
|
|
||||||
(Identifier)
|
|
||||||
(Identifier))
|
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{-(Send
|
{-(Call
|
||||||
|
{-(Identifier)-}
|
||||||
|
{-(TextElement)-}
|
||||||
|
{-(Empty)-})-}
|
||||||
|
{-(Call
|
||||||
|
{-(MemberAccess
|
||||||
|
{-(Identifier)-}
|
||||||
|
{-(Identifier)-})-}
|
||||||
|
{-(Empty)-})-}
|
||||||
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Integer)-}
|
{-(Integer)-}
|
||||||
{-(Integer)-})-}
|
{-(Integer)-}
|
||||||
{-(Send
|
{-(Empty)-})-}
|
||||||
|
{-(Call
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Integer)-}
|
{-(Integer)-}
|
||||||
{-(Integer)-})-})
|
{-(Integer)-}
|
||||||
|
{-(Empty)-})-})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
(Program
|
(Program
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier))
|
(Identifier))
|
||||||
(Identifier))
|
(Identifier))
|
||||||
|
23
test/fixtures/ruby/method-invocation.parseB.txt
vendored
23
test/fixtures/ruby/method-invocation.parseB.txt
vendored
@ -1,15 +1,20 @@
|
|||||||
(Program
|
(Program
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(TextElement))
|
(TextElement)
|
||||||
(Send
|
(Empty))
|
||||||
(Identifier)
|
(Call
|
||||||
(Identifier))
|
(MemberAccess
|
||||||
(Send
|
(Identifier)
|
||||||
|
(Identifier))
|
||||||
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Integer)
|
(Integer)
|
||||||
(Integer))
|
(Integer)
|
||||||
(Send
|
(Empty))
|
||||||
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Integer)
|
(Integer)
|
||||||
(Integer)))
|
(Integer)
|
||||||
|
(Empty)))
|
||||||
|
@ -37,17 +37,17 @@
|
|||||||
{-(Identifier)-})-}
|
{-(Identifier)-})-}
|
||||||
{-(Assignment
|
{-(Assignment
|
||||||
{-(
|
{-(
|
||||||
{-(Send
|
{-(MemberAccess
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-}
|
{-(Identifier)-})-}
|
||||||
{-(Send
|
{-(MemberAccess
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-})-}
|
{-(Identifier)-})-})-}
|
||||||
{-(
|
{-(
|
||||||
{-(Send
|
{-(MemberAccess
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-}
|
{-(Identifier)-})-}
|
||||||
{-(Send
|
{-(MemberAccess
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-})-})-}
|
{-(Identifier)-})-})-})-}
|
||||||
{-(Assignment
|
{-(Assignment
|
||||||
|
@ -37,17 +37,17 @@
|
|||||||
{+(Identifier)+})+}
|
{+(Identifier)+})+}
|
||||||
{+(Assignment
|
{+(Assignment
|
||||||
{+(
|
{+(
|
||||||
{+(Send
|
{+(MemberAccess
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+}
|
{+(Identifier)+})+}
|
||||||
{+(Send
|
{+(MemberAccess
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+})+}
|
{+(Identifier)+})+})+}
|
||||||
{+(
|
{+(
|
||||||
{+(Send
|
{+(MemberAccess
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+}
|
{+(Identifier)+})+}
|
||||||
{+(Send
|
{+(MemberAccess
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Identifier)+})+})+})+}
|
{+(Identifier)+})+})+})+}
|
||||||
{+(Assignment
|
{+(Assignment
|
||||||
|
@ -36,17 +36,17 @@
|
|||||||
(Identifier))
|
(Identifier))
|
||||||
(Assignment
|
(Assignment
|
||||||
(
|
(
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier))
|
(Identifier))
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier)))
|
(Identifier)))
|
||||||
(
|
(
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier))
|
(Identifier))
|
||||||
(Send
|
(MemberAccess
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier))))
|
(Identifier))))
|
||||||
(Assignment
|
(Assignment
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
(Program
|
(Program
|
||||||
{ (Equal
|
{(Equal
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})
|
{-(Identifier)-})
|
||||||
->(Comparison
|
->(Comparison
|
||||||
@ -10,12 +10,11 @@
|
|||||||
{+(Identifier)+})+}
|
{+(Identifier)+})+}
|
||||||
{+(Assignment
|
{+(Assignment
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{+(Not
|
{+(Not{+(Identifier)+})+})+}
|
||||||
{+(Identifier)+})+})+}
|
|
||||||
{-(Not
|
{-(Not
|
||||||
{-(Equal
|
{-(Equal
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-})-}
|
{-(Identifier)-})-})-}
|
||||||
{-(Equal
|
{-(Equal
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})-})
|
{-(Identifier)-})- })
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
(Program
|
(Program
|
||||||
{ (Comparison
|
{(Comparison
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Identifier)-})
|
{-(Identifier)-})
|
||||||
->(Equal
|
->(Equal
|
||||||
@ -17,5 +17,4 @@
|
|||||||
{-(Identifier)-})-}
|
{-(Identifier)-})-}
|
||||||
{-(Assignment
|
{-(Assignment
|
||||||
{-(Identifier)-}
|
{-(Identifier)-}
|
||||||
{-(Not
|
{-(Not{-(Identifier)-})-})- })
|
||||||
{-(Identifier)-})-})-})
|
|
||||||
|
5
test/fixtures/ruby/require.diffA-B.txt
vendored
5
test/fixtures/ruby/require.diffA-B.txt
vendored
@ -2,9 +2,10 @@
|
|||||||
(Require
|
(Require
|
||||||
{ (TextElement)
|
{ (TextElement)
|
||||||
->(TextElement) })
|
->(TextElement) })
|
||||||
(Send
|
(Call
|
||||||
{ (Identifier)
|
{ (Identifier)
|
||||||
->(Identifier) }
|
->(Identifier) }
|
||||||
{+(Symbol)+}
|
{+(Symbol)+}
|
||||||
{+(TextElement)+}
|
{+(TextElement)+}
|
||||||
{-(Identifier)-}))
|
{-(Identifier)-}
|
||||||
|
(Empty)))
|
||||||
|
5
test/fixtures/ruby/require.diffB-A.txt
vendored
5
test/fixtures/ruby/require.diffB-A.txt
vendored
@ -2,9 +2,10 @@
|
|||||||
(Require
|
(Require
|
||||||
{ (TextElement)
|
{ (TextElement)
|
||||||
->(TextElement) })
|
->(TextElement) })
|
||||||
(Send
|
(Call
|
||||||
{ (Identifier)
|
{ (Identifier)
|
||||||
->(Identifier) }
|
->(Identifier) }
|
||||||
{+(Identifier)+}
|
{+(Identifier)+}
|
||||||
{-(Symbol)-}
|
{-(Symbol)-}
|
||||||
{-(TextElement)-}))
|
{-(TextElement)-}
|
||||||
|
(Empty)))
|
||||||
|
5
test/fixtures/ruby/require.parseA.txt
vendored
5
test/fixtures/ruby/require.parseA.txt
vendored
@ -1,6 +1,7 @@
|
|||||||
(Program
|
(Program
|
||||||
(Require
|
(Require
|
||||||
(TextElement))
|
(TextElement))
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Identifier)))
|
(Identifier)
|
||||||
|
(Empty)))
|
||||||
|
5
test/fixtures/ruby/require.parseB.txt
vendored
5
test/fixtures/ruby/require.parseB.txt
vendored
@ -1,7 +1,8 @@
|
|||||||
(Program
|
(Program
|
||||||
(Require
|
(Require
|
||||||
(TextElement))
|
(TextElement))
|
||||||
(Send
|
(Call
|
||||||
(Identifier)
|
(Identifier)
|
||||||
(Symbol)
|
(Symbol)
|
||||||
(TextElement)))
|
(TextElement)
|
||||||
|
(Empty)))
|
||||||
|
Loading…
Reference in New Issue
Block a user