1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Merge branch 'master' into polyadic-lambda

This commit is contained in:
Rob Rix 2018-08-03 09:51:31 -04:00 committed by GitHub
commit 5088216b33
155 changed files with 2448 additions and 37 deletions

View File

@ -1,6 +1,7 @@
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, LambdaCase #-}
{-# LANGUAGE DeriveAnyClass, DeriveGeneric, KindSignatures, LambdaCase #-}
module Data.Language
( Language (..)
, SLanguage (..)
, ensureLanguage
, extensionsForLanguage
, knownLanguage
@ -34,6 +35,46 @@ data Language
| PHP
deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Named, Enum, MessageField)
class SLanguage (lang :: Language) where
reflect :: proxy lang -> Language
instance SLanguage 'Unknown where
reflect _ = Unknown
instance SLanguage 'Go where
reflect _ = Go
instance SLanguage 'Haskell where
reflect _ = Haskell
instance SLanguage 'Java where
reflect _ = Java
instance SLanguage 'JavaScript where
reflect _ = JavaScript
instance SLanguage 'JSON where
reflect _ = JSON
instance SLanguage 'JSX where
reflect _ = JSX
instance SLanguage 'Markdown where
reflect _ = Markdown
instance SLanguage 'Python where
reflect _ = Python
instance SLanguage 'Ruby where
reflect _ = Ruby
instance SLanguage 'TypeScript where
reflect _ = TypeScript
instance SLanguage 'PHP where
reflect _ = PHP
-- This ensures that the protobuf file is generated with ALL_CAPS_NAMES.
instance Finite Language where
enumerate _ = fmap go [Unknown ..] where

View File

@ -96,33 +96,33 @@ checking
. runAddressError
. runTypes
evalGoProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Go) goParser Language.Go
evalRubyProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Ruby) rubyParser Language.Ruby
evalPHPProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.PHP) phpParser Language.PHP
evalPythonProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Python) pythonParser Language.Python
evalJavaScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.JavaScript) typescriptParser Language.JavaScript
evalTypeScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.TypeScript) typescriptParser Language.TypeScript
evalGoProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Go) goParser
evalRubyProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Ruby) rubyParser
evalPHPProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.PHP) phpParser
evalPythonProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.Python) pythonParser
evalJavaScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.JavaScript) typescriptParser
evalTypeScriptProject = justEvaluating <=< evaluateProject (Proxy :: Proxy 'Language.TypeScript) typescriptParser
typecheckGoFile = checking <=< evaluateProjectWithCaching (Proxy :: Proxy 'Language.Go) goParser Language.Go
typecheckGoFile = checking <=< evaluateProjectWithCaching (Proxy :: Proxy 'Language.Go) goParser
callGraphProject parser proxy lang opts paths = runTaskWithOptions opts $ do
blobs <- catMaybes <$> traverse readFile (flip File lang <$> paths)
package <- parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs lang [])
callGraphProject parser proxy opts paths = runTaskWithOptions opts $ do
blobs <- catMaybes <$> traverse readFile (flip File (Language.reflect proxy) <$> paths)
package <- parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs (Language.reflect proxy) [])
modules <- topologicalSort <$> runImportGraphToModules proxy package
x <- runCallGraph proxy False modules package
pure (x, (() <$) <$> modules)
callGraphRubyProject = callGraphProject rubyParser (Proxy @'Language.Ruby) Language.Ruby debugOptions
callGraphRubyProject = callGraphProject rubyParser (Proxy @'Language.Ruby) debugOptions
-- Evaluate a project consisting of the listed paths.
evaluateProject proxy parser lang paths = withOptions debugOptions $ \ config logger statter ->
evaluateProject' (TaskConfig config logger statter) proxy parser lang paths
evaluateProject proxy parser paths = withOptions debugOptions $ \ config logger statter ->
evaluateProject' (TaskConfig config logger statter) proxy parser paths
data TaskConfig = TaskConfig Config LogQueue StatQueue
evaluateProject' (TaskConfig config logger statter) proxy parser lang paths = either (die . displayException) pure <=< runTaskWithConfig config logger statter $ do
blobs <- catMaybes <$> traverse readFile (flip File lang <$> paths)
package <- fmap quieterm <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs lang [])
evaluateProject' (TaskConfig config logger statter) proxy parser paths = either (die . displayException) pure <=< runTaskWithConfig config logger statter $ do
blobs <- catMaybes <$> traverse readFile (flip File (Language.reflect proxy) <$> paths)
package <- fmap quieterm <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs (Language.reflect proxy) [])
modules <- topologicalSort <$> runImportGraphToModules proxy package
trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules)
pure (runTermEvaluator @_ @_ @(Value Precise (UtilEff Precise))
@ -133,8 +133,8 @@ evaluateProject' (TaskConfig config logger statter) proxy parser lang paths = ei
(evaluate proxy id withTermSpans (Concrete.runFunction coerce coerce) modules))))))
evaluateProjectWithCaching proxy parser lang path = runTaskWithOptions debugOptions $ do
project <- readProject Nothing path lang []
evaluateProjectWithCaching proxy parser path = runTaskWithOptions debugOptions $ do
project <- readProject Nothing path (Language.reflect proxy) []
package <- fmap quieterm <$> parsePackage parser project
modules <- topologicalSort <$> runImportGraphToModules proxy package
pure (runReader (packageInfo package)

View File

@ -30,4 +30,4 @@ spec config = parallel $ do
where
fixtures = "test/fixtures/go/analysis/"
evaluate = evalGoProject . map (fixtures <>)
evalGoProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Go) goParser Language.Go
evalGoProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Go) goParser

View File

@ -42,4 +42,4 @@ spec config = parallel $ do
where
fixtures = "test/fixtures/php/analysis/"
evaluate = evalPHPProject . map (fixtures <>)
evalPHPProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.PHP) phpParser Language.PHP
evalPHPProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.PHP) phpParser

View File

@ -60,4 +60,4 @@ spec config = parallel $ do
ns n = Just . Latest . Last . Just . Namespace n
fixtures = "test/fixtures/python/analysis/"
evaluate = evalPythonProject . map (fixtures <>)
evalPythonProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Python) pythonParser Language.Python
evalPythonProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Python) pythonParser

View File

@ -104,4 +104,4 @@ spec config = parallel $ do
ns n = Just . Latest . Last . Just . Namespace n
fixtures = "test/fixtures/ruby/analysis/"
evaluate = evalRubyProject . map (fixtures <>)
evalRubyProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Ruby) rubyParser Language.Ruby
evalRubyProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Ruby) rubyParser

View File

@ -49,4 +49,4 @@ spec config = parallel $ do
where
fixtures = "test/fixtures/typescript/analysis/"
evaluate = evalTypeScriptProject . map (fixtures <>)
evalTypeScriptProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.TypeScript) typescriptParser Language.TypeScript
evalTypeScriptProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.TypeScript) typescriptParser

View File

@ -0,0 +1,5 @@
class Dino {
public static void normalError() {
Class<String> c = String.class;
}
}

View File

@ -0,0 +1,24 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
{+(AccessibilityModifier)+}
{+(AccessibilityModifier)+}
(Empty)
(Identifier)
(Statements
{+(GreaterThan
{+(LessThan
{+(Identifier)+}
{+(Identifier)+})+}
{+(Assignment
{+(Identifier)+}
{+(ClassLiteral
{+(Identifier)+})+})+})+}
{-(Call
{-(Identifier)-}
{-(ClassLiteral
{-(Identifier)-})-}
{-(Empty)-})-})))))

View File

@ -0,0 +1,24 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
{-(AccessibilityModifier)-}
{-(AccessibilityModifier)-}
(Empty)
(Identifier)
(Statements
{+(Call
{+(Identifier)+}
{+(ClassLiteral
{+(Identifier)+})+}
{+(Empty)+})+}
{-(GreaterThan
{-(LessThan
{-(Identifier)-}
{-(Identifier)-})-}
{-(Assignment
{-(Identifier)-}
{-(ClassLiteral
{-(Identifier)-})-})-})-})))))

View File

@ -0,0 +1,14 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Call
(Identifier)
(ClassLiteral
(Identifier))
(Empty)))))))

View File

@ -0,0 +1,19 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Statements
(GreaterThan
(LessThan
(Identifier)
(Identifier))
(Assignment
(Identifier)
(ClassLiteral
(Identifier)))))))))

View File

@ -0,0 +1,7 @@
class Test {
public static void main(String[] args) {
if (i > 4 && i < 9) {
continue;
}
}
}

View File

@ -0,0 +1,30 @@
(Statements
(Class
{-(AccessibilityModifier)-}
(Identifier)
(Statements
{+(Method
{+(Void)+}
{+(AccessibilityModifier)+}
{+(AccessibilityModifier)+}
{+(Empty)+}
{+(Identifier)+}
{+(Annotation
{+(Identifier)+}
{+(Array
{+(Empty)+}
{+(Identifier)+})+})+}
{+(Statements
{+(If
{+(And
{+(GreaterThan
{+(Identifier)+}
{+(Integer)+})+}
{+(LessThan
{+(Identifier)+}
{+(Integer)+})+})+}
{+(Statements
{+(Continue
{+(Empty)+})+})+}
{+(Empty)+})+})+})+}
{-(Error)-})))

View File

@ -0,0 +1,30 @@
(Statements
(Class
{+(AccessibilityModifier)+}
(Identifier)
(Statements
{+(Error)+}
{-(Method
{-(Void)-}
{-(AccessibilityModifier)-}
{-(AccessibilityModifier)-}
{-(Empty)-}
{-(Identifier)-}
{-(Annotation
{-(Identifier)-}
{-(Array
{-(Empty)-}
{-(Identifier)-})-})-}
{-(Statements
{-(If
{-(And
{-(GreaterThan
{-(Identifier)-}
{-(Integer)-})-}
{-(LessThan
{-(Identifier)-}
{-(Integer)-})-})-}
{-(Statements
{-(Continue
{-(Empty)-})-})-}
{-(Empty)-})-})-})-})))

View File

@ -0,0 +1,6 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Error))))

View File

@ -0,0 +1,28 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
(If
(And
(GreaterThan
(Identifier)
(Integer))
(LessThan
(Identifier)
(Integer)))
(Statements
(Continue
(Empty)))
(Empty)))))))

View File

@ -0,0 +1,14 @@
public class Test {
public static void main(String args[]) {
int [] numbers = {10, 20, 30, 40, 50};
for(int x : numbers ) {
if( x == 30 ) {
continue;
}
System.out.print( x );
System.out.print("\n");
}
}
}

View File

@ -0,0 +1,14 @@
public class Test {
public static void main(String args[]) {
int [] numbers = {10, 20, 30, 40, 50};
for(int x : numbers ) {
if( x == 30 ) {
continue;
}
System.out.print( x );
System.out.print("\n");
}
}
}

1
test/fixtures/java/corpus/Dims.A.java vendored Normal file
View File

@ -0,0 +1 @@
class ForDemo { int[] metrics; }

View File

@ -0,0 +1,20 @@
(Statements
(Class
(Identifier)
(Statements
{+(Method
{+(Void)+}
{+(Empty)+}
{+(Identifier)+}
{+(Annotation
{+(Identifier)+}
{+(Array
{+(Empty)+}
{+(Identifier)+})+})+}
{+(Statements)+})+}
{-(Statements
{-(Variable
{-(Array
{-(Empty)-}
{-(Int)-})-}
{-(Identifier)-})-})-})))

View File

@ -0,0 +1,20 @@
(Statements
(Class
(Identifier)
(Statements
{+(Statements
{+(Variable
{+(Array
{+(Empty)+}
{+(Int)+})+}
{+(Identifier)+})+})+}
{-(Method
{-(Void)-}
{-(Empty)-}
{-(Identifier)-}
{-(Annotation
{-(Identifier)-}
{-(Array
{-(Empty)-}
{-(Identifier)-})-})-}
{-(Statements)-})-})))

View File

@ -0,0 +1,10 @@
(Statements
(Class
(Identifier)
(Statements
(Statements
(Variable
(Array
(Empty)
(Int))
(Identifier))))))

View File

@ -0,0 +1,14 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements)))))

View File

@ -0,0 +1,9 @@
class WhileDemo {
public static void main(String[] args) {
int i = 5;
do {
System.out.println(i);
i++;
} while (i <= 10);
}
}

View File

@ -0,0 +1,51 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
{+(Statements
{+(Assignment
{+(Variable
{+(Int)+}
{+(Identifier)+})+}
{+(Integer)+})+})+}
(DoWhile
{ (Not
{-(Call
{-(MemberAccess
{-(TextElement)-})-}
{-(Identifier)-}
{-(Empty)-})-})
->(LessThanEqual
{+(Identifier)+}
{+(Integer)+}) }
(Statements
(Call
{ (MemberAccess
{-(MemberAccess
{-(Identifier)-})-})
->(MemberAccess
{+(MemberAccess
{+(Identifier)+})+}) }
{+(Identifier)+}
{-(TextElement)-}
(Empty))
{+(PostIncrement
{+(Identifier)+})+}
{-(Assignment
{-(Identifier)-}
{-(Call
{-(MemberAccess
{-(Identifier)-})-}
{-(Empty)-})-})-})))))))

View File

@ -0,0 +1,55 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
{+(DoWhile
{+(Not
{+(Call
{+(MemberAccess
{+(TextElement)+})+}
{+(Identifier)+}
{+(Empty)+})+})+}
{+(Statements
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(TextElement)+}
{+(Empty)+})+}
{+(Assignment
{+(Identifier)+}
{+(Call
{+(MemberAccess
{+(Identifier)+})+}
{+(Empty)+})+})+})+})+}
{-(Statements
{-(Assignment
{-(Variable
{-(Int)-}
{-(Identifier)-})-}
{-(Integer)-})-})-}
{-(DoWhile
{-(LessThanEqual
{-(Identifier)-}
{-(Integer)-})-}
{-(Statements
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Identifier)-}
{-(Empty)-})-}
{-(PostIncrement
{-(Identifier)-})-})-})-})))))

View File

@ -0,0 +1,36 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
(DoWhile
(Not
(Call
(MemberAccess
(TextElement))
(Identifier)
(Empty)))
(Statements
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(TextElement)
(Empty))
(Assignment
(Identifier)
(Call
(MemberAccess
(Identifier))
(Empty))))))))))

View File

@ -0,0 +1,35 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
(Statements
(Assignment
(Variable
(Int)
(Identifier))
(Integer)))
(DoWhile
(LessThanEqual
(Identifier)
(Integer))
(Statements
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Identifier)
(Empty))
(PostIncrement
(Identifier)))))))))

View File

@ -0,0 +1,3 @@
public enum Colour {
}

View File

@ -0,0 +1,4 @@
enum Colour
{
RED, GREEN, BLUE;
}

View File

@ -0,0 +1,7 @@
(Statements
(EnumDeclaration
{-(AccessibilityModifier)-}
(Identifier)
{+(Identifier)+}
{+(Identifier)+}
{+(Identifier)+}))

View File

@ -0,0 +1,7 @@
(Statements
(EnumDeclaration
{+(AccessibilityModifier)+}
(Identifier)
{-(Identifier)-}
{-(Identifier)-}
{-(Identifier)-}))

View File

@ -0,0 +1,4 @@
(Statements
(EnumDeclaration
(AccessibilityModifier)
(Identifier)))

View File

@ -0,0 +1,6 @@
(Statements
(EnumDeclaration
(Identifier)
(Identifier)
(Identifier)
(Identifier)))

View File

@ -0,0 +1,5 @@
class Grouped {
Flowable(K key) {
System.out.println(favorite().mountain);
}
}

View File

@ -0,0 +1,23 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(Annotation
(Identifier)
(Identifier))
(Statements
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(MemberAccess
{+(Call
{+(Identifier)+}
{+(Empty)+})+})+}
{+(Empty)+})+}
{-(Assignment
{-(MemberAccess
{-(This)-})-}
{-(Identifier)-})-})))))

View File

@ -0,0 +1,23 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(Annotation
(Identifier)
(Identifier))
(Statements
{+(Assignment
{+(MemberAccess
{+(This)+})+}
{+(Identifier)+})+}
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(MemberAccess
{-(Call
{-(Identifier)-}
{-(Empty)-})-})-}
{-(Empty)-})-})))))

View File

@ -0,0 +1,14 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(Annotation
(Identifier)
(Identifier))
(Statements
(Assignment
(MemberAccess
(This))
(Identifier)))))))

View File

@ -0,0 +1,19 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(Annotation
(Identifier)
(Identifier))
(Statements
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(MemberAccess
(Call
(Identifier)
(Empty)))
(Empty)))))))

View File

@ -0,0 +1,7 @@
public class Point {
void dinosaur() {
Float x = 10.0;
Float y = 20.0;
System.out.print(x + y);
}
}

View File

@ -0,0 +1,30 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Float)))
{+(Statements
{+(Assignment
{+(Variable
{+(Identifier)+}
{+(Identifier)+})+}
{+(Float)+})+})+}
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(Plus
{+(Identifier)+}
{+(Identifier)+})+}
{+(Empty)+})+})))))

View File

@ -0,0 +1,30 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Float)))
{-(Statements
{-(Assignment
{-(Variable
{-(Identifier)-}
{-(Identifier)-})-}
{-(Float)-})-})-}
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Plus
{-(Identifier)-}
{-(Identifier)-})-}
{-(Empty)-})-})))))

View File

@ -0,0 +1,16 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Float))))))))

View File

@ -0,0 +1,30 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Float)))
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Float)))
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Plus
(Identifier)
(Identifier))
(Empty)))))))

7
test/fixtures/java/corpus/For.B.java vendored Normal file
View File

@ -0,0 +1,7 @@
class ForDemo {
public static void main(String[] args){
for(int i: list){
System.out.println("Count is: " + i);
}
}
}

View File

@ -0,0 +1,52 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
{+(ForEach
{+(Variable
{+(Int)+}
{+(Identifier)+})+}
{+(Identifier)+}
{+(Statements
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(Plus
{+(TextElement)+}
{+(Identifier)+})+}
{+(Empty)+})+})+})+}
{-(For
{-(Statements
{-(Assignment
{-(Variable
{-(Int)-}
{-(Identifier)-})-}
{-(Integer)-})-})-}
{-(LessThan
{-(Identifier)-}
{-(Integer)-})-}
{-(Statements
{-(PostIncrement
{-(Identifier)-})-})-}
{-(Statements
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Plus
{-(TextElement)-}
{-(Identifier)-})-}
{-(Empty)-})-})-})-})))))

View File

@ -0,0 +1,52 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
{+(For
{+(Statements
{+(Assignment
{+(Variable
{+(Int)+}
{+(Identifier)+})+}
{+(Integer)+})+})+}
{+(LessThan
{+(Identifier)+}
{+(Integer)+})+}
{+(Statements
{+(PostIncrement
{+(Identifier)+})+})+}
{+(Statements
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(Plus
{+(TextElement)+}
{+(Identifier)+})+}
{+(Empty)+})+})+})+}
{-(ForEach
{-(Variable
{-(Int)-}
{-(Identifier)-})-}
{-(Identifier)-}
{-(Statements
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Plus
{-(TextElement)-}
{-(Identifier)-})-}
{-(Empty)-})-})-})-})))))

View File

@ -0,0 +1,38 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
(For
(Statements
(Assignment
(Variable
(Int)
(Identifier))
(Integer)))
(LessThan
(Identifier)
(Integer))
(Statements
(PostIncrement
(Identifier)))
(Statements
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Plus
(TextElement)
(Identifier))
(Empty)))))))))

View File

@ -0,0 +1,30 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(AccessibilityModifier)
(AccessibilityModifier)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Array
(Empty)
(Identifier)))
(Statements
(ForEach
(Variable
(Int)
(Identifier))
(Identifier)
(Statements
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Plus
(TextElement)
(Identifier))
(Empty)))))))))

2
test/fixtures/java/corpus/If.B.java vendored Normal file
View File

@ -0,0 +1,2 @@
if (x=1)
System.out.print(x);

View File

@ -0,0 +1,14 @@
(Statements
(If
{ (Identifier)
->(Assignment
{+(Identifier)+}
{+(Integer)+}) }
{ (Identifier)
->(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(Identifier)+}
{+(Empty)+}) }
(Empty)))

View File

@ -0,0 +1,14 @@
(Statements
(If
{ (Assignment
{-(Identifier)-}
{-(Integer)-})
->(Identifier) }
{ (Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Identifier)-}
{-(Empty)-})
->(Identifier) }
(Empty)))

View File

@ -0,0 +1,5 @@
(Statements
(If
(Identifier)
(Identifier)
(Empty)))

12
test/fixtures/java/corpus/If.parseB.txt vendored Normal file
View File

@ -0,0 +1,12 @@
(Statements
(If
(Assignment
(Identifier)
(Integer))
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Identifier)
(Empty))
(Empty)))

View File

@ -0,0 +1 @@
import java.until.*;

View File

@ -0,0 +1,8 @@
(Statements
(Import
{+(Identifier)+}
{+(Identifier)+}
{+(Asterisk)+}
{-(Identifier)-}
{-(Identifier)-}
{-(Identifier)-}))

View File

@ -0,0 +1,8 @@
(Statements
(Import
{+(Identifier)+}
{ (Identifier)
->(Identifier) }
{ (Identifier)
->(Identifier) }
{-(Asterisk)-}))

View File

@ -0,0 +1,5 @@
(Statements
(Import
(Identifier)
(Identifier)
(Identifier)))

View File

@ -0,0 +1,5 @@
(Statements
(Import
(Identifier)
(Identifier)
(Asterisk)))

7
test/fixtures/java/corpus/Int.B.java vendored Normal file
View File

@ -0,0 +1,7 @@
public class Point {
void dinosaur() {
Int A = 123;
Int B = 10;
System.out.print(A + B);
}
}

View File

@ -0,0 +1,32 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
{ (Identifier)
->(Identifier) })
{ (Integer)
->(Integer) }))
{+(Statements
{+(Assignment
{+(Variable
{+(Identifier)+}
{+(Identifier)+})+}
{+(Integer)+})+})+}
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(Plus
{+(Identifier)+}
{+(Identifier)+})+}
{+(Empty)+})+})))))

View File

@ -0,0 +1,32 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
{ (Identifier)
->(Identifier) })
{ (Integer)
->(Integer) }))
{-(Statements
{-(Assignment
{-(Variable
{-(Identifier)-}
{-(Identifier)-})-}
{-(Integer)-})-})-}
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(Plus
{-(Identifier)-}
{-(Identifier)-})-}
{-(Empty)-})-})))))

View File

@ -0,0 +1,16 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Integer))))))))

View File

@ -0,0 +1,30 @@
(Statements
(Class
(AccessibilityModifier)
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Integer)))
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Integer)))
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(Plus
(Identifier)
(Identifier))
(Empty)))))))

View File

@ -0,0 +1,3 @@
interface Top {
}
// normal declaration

View File

@ -1,3 +1,4 @@
@interface TerminationHandle {
Bar foo = 1;
}
// annotation type declaration

View File

@ -0,0 +1,15 @@
(Statements
(InterfaceDeclaration
{ (Identifier)
->(Identifier) }
(Statements
{+(Statements
{+(Assignment
{+(Variable
{+(Identifier)+}
{+(Identifier)+})+}
{+(Integer)+})+})+}))
(Context
{ (Comment)
->(Comment) }
(Empty)))

View File

@ -0,0 +1,15 @@
(Statements
(InterfaceDeclaration
{ (Identifier)
->(Identifier) }
(Statements
{-(Statements
{-(Assignment
{-(Variable
{-(Identifier)-}
{-(Identifier)-})-}
{-(Integer)-})-})-}))
(Context
{ (Comment)
->(Comment) }
(Empty)))

View File

@ -0,0 +1,7 @@
(Statements
(InterfaceDeclaration
(Identifier)
(Statements))
(Context
(Comment)
(Empty)))

View File

@ -0,0 +1,13 @@
(Statements
(InterfaceDeclaration
(Identifier)
(Statements
(Statements
(Assignment
(Variable
(Identifier)
(Identifier))
(Integer)))))
(Context
(Comment)
(Empty)))

View File

@ -0,0 +1,5 @@
class LambdaTest {
void singleton() {
stateOwner.add(x -> System.out.println("State changed"));
}
}

View File

@ -0,0 +1,26 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
{+(Call
{+(MemberAccess
{+(Identifier)+})+}
{+(Lambda
{+(Identifier)+}
{+(LambdaBody
{+(Call
{+(MemberAccess
{+(MemberAccess
{+(Identifier)+})+})+}
{+(TextElement)+}
{+(Empty)+})+})+})+}
{+(Empty)+})+}
{-(Lambda
{-(Identifier)-}
{-(LambdaBody
{-(Identifier)-})-})-})))))

View File

@ -0,0 +1,26 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
{+(Lambda
{+(Identifier)+}
{+(LambdaBody
{+(Identifier)+})+})+}
{-(Call
{-(MemberAccess
{-(Identifier)-})-}
{-(Lambda
{-(Identifier)-}
{-(LambdaBody
{-(Call
{-(MemberAccess
{-(MemberAccess
{-(Identifier)-})-})-}
{-(TextElement)-}
{-(Empty)-})-})-})-}
{-(Empty)-})-})))))

View File

@ -0,0 +1,13 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Lambda
(Identifier)
(LambdaBody
(Identifier))))))))

View File

@ -0,0 +1,22 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Void)
(Empty)
(Identifier)
(Statements
(Call
(MemberAccess
(Identifier))
(Lambda
(Identifier)
(LambdaBody
(Call
(MemberAccess
(MemberAccess
(Identifier)))
(TextElement)
(Empty))))
(Empty)))))))

View File

@ -0,0 +1,25 @@
(Statements
(Class
{+(AccessibilityModifier)+}
{+(AccessibilityModifier)+}
{ (Identifier)
->(Identifier) }
{+(MemberAccess
{+(Identifier)+})+}
(Statements
{-(Method
{-(Int)-}
{-(Empty)-}
{-(Identifier)-}
{-(Annotation
{-(Identifier)-}
{-(Identifier)-})-}
{-(Annotation
{-(Identifier)-}
{-(Identifier)-})-}
{-(Statements
{-(Call
{-(MemberAccess
{-(Identifier)-})-}
{-(Identifier)-}
{-(Empty)-})-})-})-})))

View File

@ -0,0 +1,25 @@
(Statements
(Class
{-(AccessibilityModifier)-}
{-(AccessibilityModifier)-}
{ (Identifier)
->(Identifier) }
{-(MemberAccess
{-(Identifier)-})-}
(Statements
{+(Method
{+(Int)+}
{+(Empty)+}
{+(Identifier)+}
{+(Annotation
{+(Identifier)+}
{+(Identifier)+})+}
{+(Annotation
{+(Identifier)+}
{+(Identifier)+})+}
{+(Statements
{+(Call
{+(MemberAccess
{+(Identifier)+})+}
{+(Identifier)+}
{+(Empty)+})+})+})+})))

View File

@ -0,0 +1,20 @@
(Statements
(Class
(Identifier)
(Statements
(Method
(Int)
(Empty)
(Identifier)
(Annotation
(Identifier)
(Identifier))
(Annotation
(Identifier)
(Identifier))
(Statements
(Call
(MemberAccess
(Identifier))
(Identifier)
(Empty)))))))

View File

@ -0,0 +1,8 @@
(Statements
(Class
(AccessibilityModifier)
(AccessibilityModifier)
(Identifier)
(MemberAccess
(Identifier))
(Statements)))

View File

@ -0,0 +1,4 @@
class Dinosaur {
Disposable(int ...resources) {
}
}

View File

@ -0,0 +1,12 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(SpreadParameter
(Variable
{ (Identifier)
->(Int) }
(Identifier)))
(Statements)))))

View File

@ -0,0 +1,12 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(SpreadParameter
(Variable
{ (Int)
->(Identifier) }
(Identifier)))
(Statements)))))

View File

@ -0,0 +1,11 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(SpreadParameter
(Variable
(Identifier)
(Identifier)))
(Statements)))))

View File

@ -0,0 +1,11 @@
(Statements
(Class
(Identifier)
(Statements
(Constructor
(Identifier)
(SpreadParameter
(Variable
(Int)
(Identifier)))
(Statements)))))

Some files were not shown because too many files have changed in this diff Show More