mirror of
https://github.com/github/semantic.git
synced 2024-11-24 00:42:33 +03:00
Merge remote-tracking branch 'origin/master' into codegen-migration-leftovers
This commit is contained in:
commit
c3279290ae
@ -6,6 +6,7 @@
|
||||
|
||||
module Evaluation (benchmarks) where
|
||||
|
||||
import Analysis.Project
|
||||
import Control.Carrier.Parse.Simple
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Bifunctor
|
||||
@ -13,7 +14,6 @@ import Data.Blob.IO (readBlobFromPath)
|
||||
import qualified Data.Duration as Duration
|
||||
import Data.Graph.Algebraic (topologicalSort)
|
||||
import qualified Data.Language as Language
|
||||
import Data.Project
|
||||
import Data.Proxy
|
||||
import Gauge.Main
|
||||
import Parsing.Parser
|
||||
|
@ -9,7 +9,7 @@ import Control.Carrier.Reader
|
||||
import Control.Exception (throwIO)
|
||||
import Control.Monad
|
||||
import Data.Foldable
|
||||
import Data.Language (LanguageMode (..), PerLanguageModes (..))
|
||||
import Data.Language (PerLanguageModes (..), aLaCarteLanguageModes, preciseLanguageModes)
|
||||
import Gauge
|
||||
import System.FilePath.Glob
|
||||
import qualified System.Path as Path
|
||||
@ -68,28 +68,6 @@ parseSymbolsFilePath ::
|
||||
-> m ParseTreeSymbolResponse
|
||||
parseSymbolsFilePath languageModes path = readBlob (File.fromPath path) >>= runReader languageModes . parseSymbols . pure @[]
|
||||
|
||||
aLaCarteLanguageModes :: PerLanguageModes
|
||||
aLaCarteLanguageModes = PerLanguageModes
|
||||
{ pythonMode = ALaCarte
|
||||
, rubyMode = ALaCarte
|
||||
, goMode = ALaCarte
|
||||
, typescriptMode = ALaCarte
|
||||
, tsxMode = ALaCarte
|
||||
, javascriptMode = ALaCarte
|
||||
, jsxMode = ALaCarte
|
||||
}
|
||||
|
||||
preciseLanguageModes :: PerLanguageModes
|
||||
preciseLanguageModes = PerLanguageModes
|
||||
{ pythonMode = Precise
|
||||
, rubyMode = Precise
|
||||
, goMode = Precise
|
||||
, typescriptMode = Precise
|
||||
, tsxMode = Precise
|
||||
, javascriptMode = Precise
|
||||
, jsxMode = Precise
|
||||
}
|
||||
|
||||
testOptions :: Config.Options
|
||||
testOptions = defaultOptions
|
||||
{ optionsFailOnWarning = flag FailOnWarning True
|
||||
|
@ -40,6 +40,7 @@ library
|
||||
import: common
|
||||
hs-source-dirs: src
|
||||
exposed-modules:
|
||||
Analysis.Blob
|
||||
Analysis.Carrier.Env.Monovariant
|
||||
Analysis.Carrier.Env.Precise
|
||||
Analysis.Carrier.Heap.Monovariant
|
||||
@ -54,6 +55,7 @@ library
|
||||
Analysis.ImportGraph
|
||||
Analysis.Intro
|
||||
Analysis.Name
|
||||
Analysis.Project
|
||||
Analysis.Typecheck
|
||||
Control.Carrier.Fail.WithLoc
|
||||
build-depends:
|
||||
|
45
semantic-analysis/src/Analysis/Blob.hs
Normal file
45
semantic-analysis/src/Analysis/Blob.hs
Normal file
@ -0,0 +1,45 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Analysis.Blob
|
||||
( Blob (..)
|
||||
, fromSource
|
||||
, blobLanguage
|
||||
, blobPath
|
||||
, nullBlob
|
||||
) where
|
||||
|
||||
import Analysis.File
|
||||
import Data.Aeson
|
||||
import Source.Language as Language
|
||||
import Source.Source as Source
|
||||
import qualified System.Path as Path
|
||||
import qualified System.Path.PartClass as Path.PartClass
|
||||
|
||||
-- | The source, path information, and language of a file read from disk.
|
||||
data Blob = Blob
|
||||
{ blobSource :: Source -- ^ The UTF-8 encoded source text of the blob.
|
||||
, blobFile :: File Language -- ^ Path/language information for this blob.
|
||||
} deriving (Show, Eq)
|
||||
|
||||
instance FromJSON Blob where
|
||||
parseJSON = withObject "Blob" $ \b -> do
|
||||
src <- b .: "content"
|
||||
Right pth <- fmap Path.parse (b .: "path")
|
||||
lang <- b .: "language"
|
||||
let lang' = if knownLanguage lang then lang else Language.forPath pth
|
||||
pure (fromSource (pth :: Path.AbsRelFile) lang' src)
|
||||
|
||||
|
||||
-- | Create a Blob from a provided path, language, and UTF-8 source.
|
||||
-- The resulting Blob's span is taken from the 'totalSpan' of the source.
|
||||
fromSource :: Path.PartClass.AbsRel ar => Path.File ar -> Language -> Source -> Blob
|
||||
fromSource filepath language source
|
||||
= Blob source (Analysis.File.File (Path.toAbsRel filepath) (totalSpan source) language)
|
||||
|
||||
blobLanguage :: Blob -> Language
|
||||
blobLanguage = Analysis.File.fileBody . blobFile
|
||||
|
||||
blobPath :: Blob -> FilePath
|
||||
blobPath = Path.toString . Analysis.File.filePath . blobFile
|
||||
|
||||
nullBlob :: Blob -> Bool
|
||||
nullBlob = Source.null . blobSource
|
33
semantic-analysis/src/Analysis/Project.hs
Normal file
33
semantic-analysis/src/Analysis/Project.hs
Normal file
@ -0,0 +1,33 @@
|
||||
module Analysis.Project
|
||||
( Project (..)
|
||||
, projectExtensions
|
||||
, projectName
|
||||
, projectFiles
|
||||
) where
|
||||
|
||||
import Prelude hiding (readFile)
|
||||
|
||||
import Analysis.Blob
|
||||
import Analysis.File
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Source.Language
|
||||
import System.FilePath.Posix
|
||||
|
||||
-- | A 'Project' contains all the information that semantic needs
|
||||
-- to execute an analysis, diffing, or graphing pass.
|
||||
data Project = Project
|
||||
{ projectRootDir :: FilePath
|
||||
, projectBlobs :: [Blob]
|
||||
, projectLanguage :: Language
|
||||
, projectExcludeDirs :: [FilePath]
|
||||
} deriving (Eq, Show)
|
||||
|
||||
projectName :: Project -> Text
|
||||
projectName = T.pack . dropExtensions . takeFileName . projectRootDir
|
||||
|
||||
projectExtensions :: Project -> [String]
|
||||
projectExtensions = extensionsForLanguage . projectLanguage
|
||||
|
||||
projectFiles :: Project -> [File Language]
|
||||
projectFiles = fmap blobFile . projectBlobs
|
@ -23,13 +23,13 @@ module Language.Python.ScopeGraph
|
||||
|
||||
import qualified Analysis.Name as Name
|
||||
import AST.Element
|
||||
import Control.Effect.Fresh
|
||||
import Control.Effect.ScopeGraph
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Function as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Reference as Props
|
||||
import Control.Lens (set, (^.))
|
||||
import Data.Foldable
|
||||
import Data.List.NonEmpty (NonEmpty (..))
|
||||
import Data.Maybe
|
||||
import Data.Monoid
|
||||
import qualified Data.ScopeGraph as ScopeGraph
|
||||
@ -40,8 +40,8 @@ import GHC.TypeLits
|
||||
import qualified Language.Python.AST as Py
|
||||
import Language.Python.Patterns
|
||||
import Scope.Graph.Convert (Result (..), complete, todo)
|
||||
import Source.Loc
|
||||
import Source.Span (span_)
|
||||
import Source.Loc (Loc)
|
||||
import Source.Span (Span, span_)
|
||||
|
||||
-- This typeclass is internal-only, though it shares the same interface
|
||||
-- as the one defined in semantic-scope-graph. The somewhat-unconventional
|
||||
@ -49,7 +49,7 @@ import Source.Span (span_)
|
||||
-- every single Python AST type.
|
||||
class (forall a . Show a => Show (t a)) => ToScopeGraph t where
|
||||
scopeGraph ::
|
||||
( Has ScopeGraph sig m
|
||||
( ScopeGraphEff sig m
|
||||
, Monoid (m Result)
|
||||
)
|
||||
=> t Loc
|
||||
@ -61,7 +61,7 @@ instance (ToScopeGraph l, ToScopeGraph r) => ToScopeGraph (l :+: r) where
|
||||
|
||||
onField ::
|
||||
forall (field :: Symbol) syn sig m r .
|
||||
( Has ScopeGraph sig m
|
||||
( ScopeGraphEff sig m
|
||||
, HasField field (r Loc) (syn Loc)
|
||||
, ToScopeGraph syn
|
||||
, Monoid (m Result)
|
||||
@ -75,7 +75,7 @@ onField
|
||||
onChildren ::
|
||||
( Traversable t
|
||||
, ToScopeGraph syn
|
||||
, Has ScopeGraph sig m
|
||||
, ScopeGraphEff sig m
|
||||
, HasField "extraChildren" (r Loc) (t (syn Loc))
|
||||
, Monoid (m Result)
|
||||
)
|
||||
@ -86,7 +86,7 @@ onChildren
|
||||
. traverse scopeGraph
|
||||
. getField @"extraChildren"
|
||||
|
||||
scopeGraphModule :: Has ScopeGraph sig m => Py.Module Loc -> m Result
|
||||
scopeGraphModule :: ScopeGraphEff sig m => Py.Module Loc -> m Result
|
||||
scopeGraphModule = getAp . scopeGraph
|
||||
|
||||
instance ToScopeGraph Py.AssertStatement where scopeGraph = onChildren
|
||||
@ -215,8 +215,9 @@ instance ToScopeGraph Py.FutureImportStatement where scopeGraph = todo
|
||||
instance ToScopeGraph Py.GeneratorExpression where scopeGraph = todo
|
||||
|
||||
instance ToScopeGraph Py.Identifier where
|
||||
scopeGraph (Py.Identifier _ name) = do
|
||||
reference name name Props.Reference
|
||||
scopeGraph (Py.Identifier ann name) = do
|
||||
let refProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann^.span_ :: Span)
|
||||
newReference (Name.name name) refProps
|
||||
complete
|
||||
|
||||
instance ToScopeGraph Py.IfStatement where
|
||||
@ -229,14 +230,32 @@ instance ToScopeGraph Py.GlobalStatement where scopeGraph = todo
|
||||
|
||||
instance ToScopeGraph Py.Integer where scopeGraph = mempty
|
||||
|
||||
instance ToScopeGraph Py.ImportStatement where scopeGraph = todo
|
||||
instance ToScopeGraph Py.ImportStatement where
|
||||
scopeGraph (Py.ImportStatement _ ((R1 (Py.DottedName _ names@((Py.Identifier ann name) :| _))) :| [])) = do
|
||||
let toName (Py.Identifier _ name) = Name.name name
|
||||
newEdge ScopeGraph.Import (toName <$> names)
|
||||
|
||||
let referenceProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann^.span_ :: Span)
|
||||
newReference (Name.name name) referenceProps
|
||||
|
||||
let pairs = zip (toList names) (tail $ toList names)
|
||||
for_ pairs $ \pair -> do
|
||||
case pair of
|
||||
(scopeIdentifier, referenceIdentifier@(Py.Identifier ann2 _)) -> do
|
||||
withScope (toName scopeIdentifier) $ do
|
||||
let referenceProps = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (ann2^.span_ :: Span)
|
||||
newReference (toName referenceIdentifier) referenceProps
|
||||
|
||||
complete
|
||||
scopeGraph term = todo (show term)
|
||||
|
||||
instance ToScopeGraph Py.ImportFromStatement where
|
||||
scopeGraph (Py.ImportFromStatement _ [] (L1 (Py.DottedName _ names)) (Just (Py.WildcardImport _ _))) = do
|
||||
let toName (Py.Identifier _ name) = Name.name name
|
||||
complete <* insertEdge ScopeGraph.Import (toName <$> names)
|
||||
scopeGraph term = todo (show term)
|
||||
|
||||
complete <* newEdge ScopeGraph.Import (toName <$> names)
|
||||
scopeGraph impossibleTerm@(Py.ImportFromStatement _ [] (L1 (Py.DottedName _ _)) Nothing) =
|
||||
todo impossibleTerm
|
||||
scopeGraph term = todo term
|
||||
|
||||
|
||||
instance ToScopeGraph Py.Lambda where scopeGraph = todo
|
||||
|
@ -11,15 +11,14 @@ import qualified AST.Unmarshal as TS
|
||||
import Control.Algebra
|
||||
import Control.Carrier.Lift
|
||||
import Control.Carrier.Sketch.ScopeGraph
|
||||
import Control.Effect.ScopeGraph
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Function as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Reference as Props
|
||||
import Control.Monad
|
||||
import qualified Data.ByteString as ByteString
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import Data.Module (ModuleInfo (..))
|
||||
import qualified Data.ScopeGraph as ScopeGraph
|
||||
import Data.Semilattice.Lower
|
||||
import qualified Language.Python ()
|
||||
import qualified Language.Python as Py (Term)
|
||||
import qualified Language.Python.Grammar as TSP
|
||||
@ -56,9 +55,11 @@ The graph should be
|
||||
|
||||
|
||||
runScopeGraph :: ToScopeGraph t => Path.AbsRelFile -> Source.Source -> t Loc -> (ScopeGraph.ScopeGraph Name, Result)
|
||||
runScopeGraph p _src item = run . runSketch (Just p) $ scopeGraph item
|
||||
runScopeGraph p _src item = run . runSketch info $ scopeGraph item
|
||||
where
|
||||
info = ModuleInfo (Path.toString p) "Python" mempty
|
||||
|
||||
sampleGraphThing :: (Has ScopeGraph sig m) => m Result
|
||||
sampleGraphThing :: ScopeGraphEff sig m => m Result
|
||||
sampleGraphThing = do
|
||||
declare "hello" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 2 0) (Pos 2 10)))
|
||||
declare "goodbye" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 3 0) (Pos 3 12)))
|
||||
@ -76,65 +77,95 @@ assertSimpleAssignment :: HUnit.Assertion
|
||||
assertSimpleAssignment = do
|
||||
let path = "semantic-python/test/fixtures/1-04-toplevel-assignment.py"
|
||||
(result, Complete) <- graphFile path
|
||||
(expecto, Complete) <- runM $ runSketch Nothing sampleGraphThing
|
||||
(expecto, Complete) <- runM $ runSketch (ModuleInfo path "Python" mempty) sampleGraphThing
|
||||
HUnit.assertEqual "Should work for simple case" expecto result
|
||||
|
||||
expectedReference :: (Has ScopeGraph sig m) => m Result
|
||||
expectedReference = do
|
||||
declare "x" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 0 0) (Pos 0 5)))
|
||||
reference "x" "x" Props.Reference
|
||||
pure Complete
|
||||
|
||||
assertSimpleReference :: HUnit.Assertion
|
||||
assertSimpleReference = do
|
||||
let path = "semantic-python/test/fixtures/5-01-simple-reference.py"
|
||||
(result, Complete) <- graphFile path
|
||||
(expecto, Complete) <- runM $ runSketch Nothing expectedReference
|
||||
(expecto, Complete) <- runM $ runSketch (ModuleInfo path "Python" mempty) expectedReference
|
||||
|
||||
HUnit.assertEqual "Should work for simple case" expecto result
|
||||
|
||||
expectedLexicalScope :: (Has ScopeGraph sig m) => m Result
|
||||
expectedLexicalScope = do
|
||||
_ <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 24)))
|
||||
reference "foo" "foo" Props.Reference {}
|
||||
expectedReference :: ScopeGraphEff sig m => m Result
|
||||
expectedReference = do
|
||||
declare "x" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 0 0) (Pos 0 5)))
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 1 0) (Pos 1 1))
|
||||
newReference "x" refProperties
|
||||
pure Complete
|
||||
|
||||
expectedFunctionArg :: (Has ScopeGraph sig m) => m Result
|
||||
expectedFunctionArg = do
|
||||
(_, associatedScope) <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 12)))
|
||||
withScope associatedScope $ do
|
||||
declare "x" (Props.Declaration ScopeGraph.Identifier ScopeGraph.Default Nothing lowerBound)
|
||||
reference "x" "x" Props.Reference
|
||||
pure ()
|
||||
reference "foo" "foo" Props.Reference
|
||||
expectedQualifiedImport :: ScopeGraphEff sig m => m Result
|
||||
expectedQualifiedImport = do
|
||||
newEdge ScopeGraph.Import (NonEmpty.fromList ["cheese", "ints"])
|
||||
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 0 7) (Pos 0 13))
|
||||
newReference (Name.name "cheese") refProperties
|
||||
|
||||
withScope "cheese" $ do
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 0 14) (Pos 0 18))
|
||||
newReference (Name.name "ints") refProperties
|
||||
pure Complete
|
||||
|
||||
expectedImportHole :: (Has ScopeGraph sig m) => m Result
|
||||
expectedImportHole :: ScopeGraphEff sig m => m Result
|
||||
expectedImportHole = do
|
||||
insertEdge ScopeGraph.Import (NonEmpty.fromList ["cheese", "ints"])
|
||||
newEdge ScopeGraph.Import (NonEmpty.fromList ["cheese", "ints"])
|
||||
pure Complete
|
||||
|
||||
assertLexicalScope :: HUnit.Assertion
|
||||
assertLexicalScope = do
|
||||
let path = "semantic-python/test/fixtures/5-02-simple-function.py"
|
||||
let info = ModuleInfo path "Python" mempty
|
||||
(graph, _) <- graphFile path
|
||||
case run (runSketch Nothing expectedLexicalScope) of
|
||||
case run (runSketch info expectedLexicalScope) of
|
||||
(expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph
|
||||
(_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg)
|
||||
|
||||
expectedLexicalScope :: ScopeGraphEff sig m => m Result
|
||||
expectedLexicalScope = do
|
||||
_ <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 24)))
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 3 0) (Pos 3 3))
|
||||
newReference "foo" refProperties
|
||||
pure Complete
|
||||
|
||||
|
||||
assertFunctionArg :: HUnit.Assertion
|
||||
assertFunctionArg = do
|
||||
let path = "semantic-python/test/fixtures/5-03-function-argument.py"
|
||||
(graph, _) <- graphFile path
|
||||
case run (runSketch Nothing expectedFunctionArg) of
|
||||
let info = ModuleInfo path "Python" mempty
|
||||
case run (runSketch info expectedFunctionArg) of
|
||||
(expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph
|
||||
(_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg)
|
||||
|
||||
expectedFunctionArg :: ScopeGraphEff sig m => m Result
|
||||
expectedFunctionArg = do
|
||||
(_, associatedScope) <- declareFunction (Just $ Name.name "foo") (Props.Function ScopeGraph.Function (Span (Pos 0 0) (Pos 1 12)))
|
||||
withScope associatedScope $ do
|
||||
declare "x" (Props.Declaration ScopeGraph.Parameter ScopeGraph.Default Nothing (Span (Pos 0 8) (Pos 0 9)))
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 1 11) (Pos 1 12))
|
||||
newReference "x" refProperties
|
||||
pure ()
|
||||
let refProperties = Props.Reference ScopeGraph.Identifier ScopeGraph.Default (Span (Pos 3 0) (Pos 3 3))
|
||||
newReference "foo" refProperties
|
||||
pure Complete
|
||||
|
||||
|
||||
assertImportHole :: HUnit.Assertion
|
||||
assertImportHole = do
|
||||
let path = "semantic-python/test/fixtures/cheese/6-01-imports.py"
|
||||
(graph, _) <- graphFile path
|
||||
case run (runSketch Nothing expectedImportHole) of
|
||||
let info = ModuleInfo path "Python" mempty
|
||||
case run (runSketch info expectedImportHole) of
|
||||
(expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph
|
||||
(_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg)
|
||||
|
||||
assertQualifiedImport :: HUnit.Assertion
|
||||
assertQualifiedImport = do
|
||||
let path = "semantic-python/test/fixtures/cheese/6-01-qualified-imports.py"
|
||||
(graph, _) <- graphFile path
|
||||
let info = ModuleInfo path "Python" mempty
|
||||
case run (runSketch info expectedQualifiedImport) of
|
||||
(expecto, Complete) -> HUnit.assertEqual "Should work for simple case" expecto graph
|
||||
(_, Todo msg) -> HUnit.assertFailure ("Failed to complete:" <> show msg)
|
||||
|
||||
@ -159,5 +190,6 @@ main = do
|
||||
],
|
||||
Tasty.testGroup "imports" [
|
||||
HUnit.testCase "simple function argument" assertImportHole
|
||||
, HUnit.testCase "qualified imports" assertQualifiedImport
|
||||
]
|
||||
]
|
||||
|
1
semantic-python/test/fixtures/cheese/6-01-qualified-imports.py
vendored
Normal file
1
semantic-python/test/fixtures/cheese/6-01-qualified-imports.py
vendored
Normal file
@ -0,0 +1 @@
|
||||
import cheese.ints
|
@ -10,115 +10,46 @@
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# OPTIONS_GHC -fprint-expanded-synonyms #-}
|
||||
|
||||
-- | This carrier interprets the Sketch effect, keeping track of
|
||||
-- the current scope and in-progress graph internally.
|
||||
module Control.Carrier.Sketch.ScopeGraph
|
||||
( SketchC (..)
|
||||
( SketchC
|
||||
, runSketch
|
||||
, module Control.Effect.ScopeGraph
|
||||
) where
|
||||
|
||||
import Analysis.Name (Name)
|
||||
import qualified Analysis.Name as Name
|
||||
import Control.Algebra
|
||||
import Control.Carrier.Fresh.Strict
|
||||
import Control.Carrier.Reader
|
||||
import Control.Carrier.State.Strict
|
||||
import Control.Effect.ScopeGraph (ScopeGraphEff (..))
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Bifunctor
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
import Data.Module
|
||||
import Data.ScopeGraph (ScopeGraph)
|
||||
import Control.Effect.ScopeGraph
|
||||
import Data.Module (ModuleInfo)
|
||||
import qualified Data.ScopeGraph as ScopeGraph
|
||||
import Data.Semilattice.Lower
|
||||
import Source.Span
|
||||
import qualified System.Path as Path
|
||||
|
||||
-- | The state type used to keep track of the in-progress graph and
|
||||
-- positional/contextual information. The name "sketchbook" is meant
|
||||
-- to invoke an in-progress, concealed work, as well as the
|
||||
-- "sketching" of a graph.
|
||||
data Sketchbook = Sketchbook
|
||||
{ sGraph :: ScopeGraph Name
|
||||
, sCurrentScope :: Name
|
||||
} deriving (Eq, Show)
|
||||
|
||||
instance Lower Sketchbook where
|
||||
lowerBound =
|
||||
let
|
||||
initialGraph = ScopeGraph.insertScope n lowerBound lowerBound
|
||||
n = Name.nameI 0
|
||||
in
|
||||
Sketchbook initialGraph n
|
||||
|
||||
newtype SketchC address m a = SketchC (StateC Sketchbook (FreshC m) a)
|
||||
deriving (Applicative, Functor, Monad, MonadIO)
|
||||
|
||||
instance (Effect sig, Algebra sig m) => Algebra (ScopeGraphEff :+: Reader Name :+: Fresh :+: sig) (SketchC Name m) where
|
||||
alg (L (Declare n props k)) = do
|
||||
Sketchbook old current <- SketchC (get @Sketchbook)
|
||||
let Props.Declaration kind relation associatedScope span = props
|
||||
let (new, _pos) =
|
||||
ScopeGraph.declare
|
||||
(ScopeGraph.Declaration n)
|
||||
(lowerBound @ModuleInfo)
|
||||
relation
|
||||
ScopeGraph.Public
|
||||
span
|
||||
kind
|
||||
associatedScope
|
||||
current
|
||||
old
|
||||
SketchC (put (Sketchbook new current))
|
||||
k ()
|
||||
alg (L (Reference n decl _props k)) = do
|
||||
Sketchbook old current <- SketchC (get @Sketchbook)
|
||||
let new =
|
||||
ScopeGraph.reference
|
||||
(ScopeGraph.Reference (Name.name n))
|
||||
(lowerBound @ModuleInfo)
|
||||
(lowerBound @Span)
|
||||
ScopeGraph.Identifier
|
||||
(ScopeGraph.Declaration (Name.name decl))
|
||||
current
|
||||
old
|
||||
SketchC (put (Sketchbook new current))
|
||||
k ()
|
||||
alg (L (NewScope edges k)) = do
|
||||
Sketchbook old current <- SketchC get
|
||||
name <- SketchC Name.gensym
|
||||
let new = ScopeGraph.newScope name edges old
|
||||
SketchC (put (Sketchbook new current))
|
||||
k name
|
||||
alg (L (InsertEdge label address k)) = do
|
||||
Sketchbook old current <- SketchC get
|
||||
let new = ScopeGraph.addImportEdge label (NonEmpty.toList address) current old
|
||||
SketchC (put (Sketchbook new current))
|
||||
k ()
|
||||
|
||||
alg (R (L a)) = case a of
|
||||
Ask k -> SketchC (gets sCurrentScope) >>= k
|
||||
Local fn go k -> do
|
||||
initial@(Sketchbook s oldScope) <- SketchC get
|
||||
let newScope = fn oldScope
|
||||
SketchC (put (Sketchbook s newScope))
|
||||
result <- go
|
||||
SketchC (put initial)
|
||||
k result
|
||||
|
||||
alg (R (R (L a))) = send (handleCoercible a)
|
||||
alg (R (R (R a))) = send (handleCoercible a)
|
||||
type SketchC addr m
|
||||
= StateC (ScopeGraph Name)
|
||||
( StateC Name
|
||||
( ReaderC Name
|
||||
( ReaderC ModuleInfo
|
||||
( FreshC m
|
||||
))))
|
||||
|
||||
runSketch ::
|
||||
(Functor m)
|
||||
=> Maybe Path.AbsRelFile
|
||||
=> ModuleInfo
|
||||
-> SketchC Name m a
|
||||
-> m (ScopeGraph Name, a)
|
||||
runSketch _rootpath (SketchC go)
|
||||
= evalFresh 1
|
||||
. fmap (first sGraph)
|
||||
. runState lowerBound
|
||||
runSketch info go
|
||||
= evalFresh 0
|
||||
. runReader @ModuleInfo info
|
||||
. runReader @Name rootname
|
||||
. evalState @Name rootname
|
||||
. runState @(ScopeGraph Name) initialGraph
|
||||
$ go
|
||||
where
|
||||
rootname = Name.nameI 0
|
||||
initialGraph = ScopeGraph.insertScope rootname lowerBound lowerBound
|
||||
|
@ -1,8 +1,10 @@
|
||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DuplicateRecordFields #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
@ -13,11 +15,12 @@
|
||||
-- physically sketching the hierarchical outline of a graph.
|
||||
module Control.Effect.ScopeGraph
|
||||
( ScopeGraph
|
||||
, ScopeGraphEff (..)
|
||||
, ScopeGraphEff
|
||||
, declare
|
||||
-- Scope Manipulation
|
||||
, currentScope
|
||||
, insertEdge
|
||||
, newEdge
|
||||
, newReference
|
||||
, newScope
|
||||
, withScope
|
||||
, declareFunction
|
||||
@ -31,47 +34,133 @@ import qualified Analysis.Name as Name
|
||||
import Control.Algebra
|
||||
import Control.Effect.Fresh
|
||||
import Control.Effect.Reader
|
||||
import Control.Lens
|
||||
import Data.List.NonEmpty
|
||||
import Data.Map.Strict (Map)
|
||||
import qualified Data.Map.Strict as Map
|
||||
import qualified Data.Module as Module
|
||||
import qualified Data.ScopeGraph as ScopeGraph
|
||||
import Data.Semilattice.Lower
|
||||
import Data.Text (Text)
|
||||
import GHC.Generics (Generic, Generic1)
|
||||
import GHC.Records
|
||||
import qualified Scope.Reference as Reference
|
||||
import Source.Span
|
||||
|
||||
import Scope.Graph.AdjacencyList (ScopeGraph)
|
||||
import qualified Scope.Graph.AdjacencyList as AdjacencyList
|
||||
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Declaration as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Function as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Reference as Props
|
||||
import qualified Control.Effect.ScopeGraph.Properties.Reference as Props.Reference
|
||||
import Control.Effect.State
|
||||
|
||||
type ScopeGraph
|
||||
= ScopeGraphEff
|
||||
:+: Fresh
|
||||
:+: Reader Name
|
||||
-- | Extract the 'Just' of a 'Maybe' in an 'Applicative' context or, given 'Nothing', run the provided action.
|
||||
maybeM :: Applicative f => f a -> Maybe a -> f a
|
||||
maybeM f = maybe f pure
|
||||
{-# INLINE maybeM #-}
|
||||
|
||||
data ScopeGraphEff m k =
|
||||
Declare Name Props.Declaration (() -> m k)
|
||||
| Reference Text Text Props.Reference (() -> m k)
|
||||
| NewScope (Map ScopeGraph.EdgeLabel [Name]) (Name -> m k)
|
||||
| InsertEdge ScopeGraph.EdgeLabel (NonEmpty Name) (() -> m k)
|
||||
deriving (Generic, Generic1, HFunctor, Effect)
|
||||
type ScopeGraphEff sig m
|
||||
= ( Has (State (ScopeGraph Name)) sig m
|
||||
, Has (State Name) sig m
|
||||
, Has (Reader Name) sig m
|
||||
, Has (Reader Module.ModuleInfo) sig m
|
||||
, Has Fresh sig m
|
||||
)
|
||||
|
||||
currentScope :: Has (Reader Name) sig m => m Name
|
||||
graphInProgress :: ScopeGraphEff sig m => m (ScopeGraph Name)
|
||||
graphInProgress = get
|
||||
|
||||
currentScope :: ScopeGraphEff sig m => m Name
|
||||
currentScope = ask
|
||||
|
||||
declare :: forall sig m . (Has ScopeGraph sig m) => Name -> Props.Declaration -> m ()
|
||||
declare n props = send (Declare n props pure)
|
||||
withScope :: ScopeGraphEff sig m
|
||||
=> Name
|
||||
-> m a
|
||||
-> m a
|
||||
withScope scope = local (const scope)
|
||||
|
||||
|
||||
declare :: ScopeGraphEff sig m => Name -> Props.Declaration -> m ()
|
||||
declare n props = do
|
||||
current <- currentScope
|
||||
old <- graphInProgress
|
||||
info <- ask
|
||||
let Props.Declaration kind relation associatedScope span = props
|
||||
let (new, _pos) =
|
||||
ScopeGraph.declare
|
||||
(ScopeGraph.Declaration n)
|
||||
info
|
||||
relation
|
||||
ScopeGraph.Public
|
||||
span
|
||||
kind
|
||||
associatedScope
|
||||
current
|
||||
old
|
||||
put new
|
||||
|
||||
-- | Establish a reference to a prior declaration.
|
||||
reference :: forall sig m . (Has ScopeGraph sig m) => Text -> Text -> Props.Reference -> m ()
|
||||
reference n decl props = send (Reference n decl props pure)
|
||||
reference :: forall sig m . ScopeGraphEff sig m => Text -> Text -> Props.Reference -> m ()
|
||||
reference n decl props = do
|
||||
current <- currentScope
|
||||
old <- graphInProgress
|
||||
info <- ask
|
||||
let new =
|
||||
ScopeGraph.reference
|
||||
(ScopeGraph.Reference (Name.name n))
|
||||
info
|
||||
(Props.Reference.span props)
|
||||
(Props.Reference.kind props)
|
||||
(ScopeGraph.Declaration (Name.name decl))
|
||||
current
|
||||
old
|
||||
put new
|
||||
|
||||
newScope :: forall sig m . Has ScopeGraph sig m => Map ScopeGraph.EdgeLabel [Name] -> m Name
|
||||
newScope edges = send (NewScope edges pure)
|
||||
newScope :: forall sig m . ScopeGraphEff sig m => Map ScopeGraph.EdgeLabel [Name] -> m Name
|
||||
newScope edges = do
|
||||
old <- graphInProgress
|
||||
name <- Name.gensym
|
||||
let new = ScopeGraph.newScope name edges old
|
||||
name <$ put new
|
||||
|
||||
-- | Takes an edge label and a list of names and inserts an import edge to a hole.
|
||||
insertEdge :: Has ScopeGraph sig m => ScopeGraph.EdgeLabel -> NonEmpty Name -> m ()
|
||||
insertEdge label targets = send (InsertEdge label targets pure)
|
||||
newEdge :: ScopeGraphEff sig m => ScopeGraph.EdgeLabel -> NonEmpty Name -> m ()
|
||||
newEdge label address = do
|
||||
current <- currentScope
|
||||
old <- graphInProgress
|
||||
let new = ScopeGraph.addImportEdge label (toList address) current old
|
||||
put new
|
||||
|
||||
declareFunction :: forall sig m . (Has ScopeGraph sig m) => Maybe Name -> Props.Function -> m (Name, Name)
|
||||
lookupScope :: ScopeGraphEff sig m => Name -> m (ScopeGraph.Scope Name)
|
||||
lookupScope address = maybeM undefined . ScopeGraph.lookupScope address =<< get
|
||||
|
||||
-- | Inserts a reference.
|
||||
newReference :: ScopeGraphEff sig m => Name -> Props.Reference -> m ()
|
||||
newReference name props = do
|
||||
currentAddress <- currentScope
|
||||
scope <- lookupScope currentAddress
|
||||
|
||||
let refProps = Reference.ReferenceInfo (props^.span_) (Props.Reference.kind props) lowerBound
|
||||
insertRef' :: ScopeGraph.Path Name -> ScopeGraph.ScopeGraph Name -> ScopeGraph.ScopeGraph Name
|
||||
insertRef' path scopeGraph = let
|
||||
scope' = (ScopeGraph.insertReference (Reference.Reference name) lowerBound (Props.Reference.span props) (getField @"kind" props) path) scope
|
||||
in
|
||||
(ScopeGraph.insertScope currentAddress scope' scopeGraph)
|
||||
scopeGraph <- get @(ScopeGraph.ScopeGraph Name)
|
||||
case AdjacencyList.findPath (const Nothing) (ScopeGraph.Declaration name) currentAddress scopeGraph of
|
||||
-- If a path to a declaration is found, insert a reference into the current scope.
|
||||
Just path -> modify (insertRef' path)
|
||||
-- If no path is found, insert a reference with a hole into the current scope.
|
||||
Nothing ->
|
||||
modify (ScopeGraph.insertScope
|
||||
currentAddress
|
||||
(ScopeGraph.newReference
|
||||
(Reference.Reference name)
|
||||
refProps
|
||||
scope))
|
||||
|
||||
declareFunction :: forall sig m . ScopeGraphEff sig m => Maybe Name -> Props.Function -> m (Name, Name)
|
||||
declareFunction name (Props.Function kind span) = do
|
||||
currentScope' <- currentScope
|
||||
let lexicalEdges = Map.singleton ScopeGraph.Lexical [ currentScope' ]
|
||||
@ -84,7 +173,7 @@ declareFunction name (Props.Function kind span) = do
|
||||
}
|
||||
pure (name', associatedScope)
|
||||
|
||||
declareMaybeName :: Has ScopeGraph sig m
|
||||
declareMaybeName :: ScopeGraphEff sig m
|
||||
=> Maybe Name
|
||||
-> Props.Declaration
|
||||
-> m Name
|
||||
@ -94,9 +183,3 @@ declareMaybeName maybeName props = do
|
||||
_ -> do
|
||||
name <- Name.gensym
|
||||
name <$ declare name (props { Props.relation = ScopeGraph.Gensym })
|
||||
|
||||
withScope :: Has ScopeGraph sig m
|
||||
=> Name
|
||||
-> m a
|
||||
-> m a
|
||||
withScope scope = local (const scope)
|
||||
|
@ -1,3 +1,7 @@
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
-- | The 'Declaration' record type is used by the 'Control.Effect.Sketch' module to keep
|
||||
-- track of the parameters that need to be passed when establishing a new reference.
|
||||
-- It is currently unused, but will possess more fields in the future as scope graph
|
||||
@ -6,4 +10,18 @@ module Control.Effect.ScopeGraph.Properties.Reference
|
||||
( Reference (..)
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.ScopeGraph as ScopeGraph (Kind, Relation)
|
||||
import GHC.Generics (Generic)
|
||||
import Prelude hiding (span)
|
||||
import Source.Span
|
||||
|
||||
data Reference = Reference
|
||||
{ kind :: ScopeGraph.Kind
|
||||
, relation :: ScopeGraph.Relation
|
||||
, span :: Span
|
||||
} deriving (Generic, Show)
|
||||
|
||||
instance HasSpan Reference where
|
||||
span_ = lens span (\r s -> r { span = s })
|
||||
{-# INLINE span_ #-}
|
||||
|
@ -29,6 +29,8 @@ import Scope.Scope
|
||||
import Scope.Types
|
||||
import Source.Span
|
||||
|
||||
newtype CurrentScope address = CurrentScope { unCurrentScope :: address }
|
||||
|
||||
newtype ScopeGraph scope = ScopeGraph { unScopeGraph :: Map scope (Scope scope) }
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
@ -131,6 +133,12 @@ insertReference ref moduleInfo span kind path scope = scope { references = Map.a
|
||||
Nothing -> pure ([ ReferenceInfo span kind moduleInfo ], path)
|
||||
Just (refInfos, path) -> pure (ReferenceInfo span kind moduleInfo : refInfos, path)) ref (references scope) }
|
||||
|
||||
-- | Adds a reference and a Hole path to the given scope.
|
||||
newReference :: Reference -> ReferenceInfo -> Scope scopeAddress -> Scope scopeAddress
|
||||
newReference ref info scope = scope { references = Map.alter (\case
|
||||
Nothing -> pure ([ info ], Hole)
|
||||
Just (refInfos, path) -> pure (info : refInfos, path)) ref (references scope) }
|
||||
|
||||
lookupDeclaration :: Ord scopeAddress => Name -> scopeAddress -> ScopeGraph scopeAddress -> Maybe (Info scopeAddress, Position)
|
||||
lookupDeclaration name scope g = do
|
||||
dataSeq <- ddataOfScope scope g
|
||||
|
@ -20,7 +20,7 @@ import Source.Loc
|
||||
|
||||
class Typeable t => ToScopeGraph t where
|
||||
scopeGraph ::
|
||||
( Has ScopeGraph sig m
|
||||
( ScopeGraphEff sig m
|
||||
)
|
||||
=> t Loc
|
||||
-> m Result
|
||||
|
@ -160,7 +160,6 @@ library
|
||||
, Data.Language
|
||||
, Data.Map.Monoidal
|
||||
, Data.Maybe.Exts
|
||||
, Data.Project
|
||||
, Data.Quieterm
|
||||
, Data.Semigroup.App
|
||||
, Data.Scientific.Exts
|
||||
|
@ -5,15 +5,12 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
-- | Semantic-specific functionality for blob handling.
|
||||
module Data.Blob
|
||||
( Blob(..)
|
||||
, Blobs(..)
|
||||
, blobLanguage
|
||||
( Blobs(..)
|
||||
, NoLanguageForBlob (..)
|
||||
, blobPath
|
||||
, decodeBlobs
|
||||
, nullBlob
|
||||
, fromSource
|
||||
, moduleForBlob
|
||||
, noLanguageForBlob
|
||||
, BlobPair
|
||||
@ -23,10 +20,11 @@ module Data.Blob
|
||||
, languageTagForBlobPair
|
||||
, pathForBlobPair
|
||||
, pathKeyForBlobPair
|
||||
, module Analysis.Blob
|
||||
) where
|
||||
|
||||
|
||||
import Analysis.File (File (..))
|
||||
import Analysis.Blob
|
||||
import Control.Effect.Error
|
||||
import Control.Exception
|
||||
import Data.Aeson
|
||||
@ -39,44 +37,12 @@ import Data.Maybe.Exts
|
||||
import Data.Module
|
||||
import GHC.Generics (Generic)
|
||||
import Source.Language as Language
|
||||
import Source.Source (Source, totalSpan)
|
||||
import qualified Source.Source as Source
|
||||
import qualified System.FilePath as FP
|
||||
import qualified System.Path as Path
|
||||
import qualified System.Path.PartClass as Path.PartClass
|
||||
|
||||
-- | The source, path information, and language of a file read from disk.
|
||||
data Blob = Blob
|
||||
{ blobSource :: Source -- ^ The UTF-8 encoded source text of the blob.
|
||||
, blobFile :: File Language -- ^ Path/language information for this blob.
|
||||
} deriving (Show, Eq)
|
||||
|
||||
blobLanguage :: Blob -> Language
|
||||
blobLanguage = Analysis.File.fileBody . blobFile
|
||||
|
||||
blobPath :: Blob -> FilePath
|
||||
blobPath = Path.toString . Analysis.File.filePath . blobFile
|
||||
|
||||
newtype Blobs a = Blobs { blobs :: [a] }
|
||||
deriving (Generic, FromJSON)
|
||||
|
||||
instance FromJSON Blob where
|
||||
parseJSON = withObject "Blob" $ \b -> do
|
||||
src <- b .: "content"
|
||||
Right pth <- fmap Path.parse (b .: "path")
|
||||
lang <- b .: "language"
|
||||
let lang' = if knownLanguage lang then lang else Language.forPath pth
|
||||
pure (fromSource (pth :: Path.AbsRelFile) lang' src)
|
||||
|
||||
nullBlob :: Blob -> Bool
|
||||
nullBlob Blob{..} = Source.null blobSource
|
||||
|
||||
-- | Create a Blob from a provided path, language, and UTF-8 source.
|
||||
-- The resulting Blob's span is taken from the 'totalSpan' of the source.
|
||||
fromSource :: Path.PartClass.AbsRel ar => Path.File ar -> Language -> Source -> Blob
|
||||
fromSource filepath language source
|
||||
= Blob source (Analysis.File.File (Path.toAbsRel filepath) (totalSpan source) language)
|
||||
|
||||
decodeBlobs :: BL.ByteString -> Either String [Blob]
|
||||
decodeBlobs = fmap blobs <$> eitherDecode
|
||||
|
||||
|
@ -7,19 +7,49 @@ module Data.Blob.IO
|
||||
, readBlobFromPath
|
||||
, readBlobsFromDir
|
||||
, readFilePair
|
||||
, readProjectFromPaths
|
||||
) where
|
||||
|
||||
import Analysis.Blob
|
||||
import Analysis.File as File
|
||||
import Analysis.Project
|
||||
import qualified Control.Concurrent.Async as Async
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Blob
|
||||
import qualified Data.ByteString as B
|
||||
import Data.Language
|
||||
import Data.Maybe.Exts
|
||||
import Data.Semilattice.Lower
|
||||
import Semantic.IO
|
||||
import qualified Source.Source as Source
|
||||
import qualified System.Path as Path
|
||||
|
||||
-- | Deprecated: this has very weird semantics.
|
||||
readProjectFromPaths :: MonadIO m
|
||||
=> Maybe Path.AbsRelDir -- ^ An optional root directory for the project
|
||||
-> Path.AbsRelFileDir -- ^ A file or directory to parse. Passing a file path loads all files in that file's parent directory.
|
||||
-> Language
|
||||
-> [Path.AbsRelDir] -- ^ Directories to exclude.
|
||||
-> m Project
|
||||
readProjectFromPaths maybeRoot path lang excludeDirs = do
|
||||
let rootDir :: Path.AbsRelDir
|
||||
rootDir = case maybeRoot >>= Path.fromAbsRel of
|
||||
-- If we were provided a root directory, use that.
|
||||
Just root -> root
|
||||
Nothing -> case Path.fileFromFileDir path of
|
||||
-- If we weren't and the path is a file, drop its file name.
|
||||
Just fp -> Path.takeDirectory fp
|
||||
-- Otherwise, load from the path.
|
||||
Nothing -> Path.dirFromFileDir path
|
||||
|
||||
paths <- liftIO $ findFilesInDir rootDir exts excludeDirs
|
||||
blobs <- liftIO $ traverse (readBlobFromFile' . toFile) paths
|
||||
pure $ Project (Path.toString rootDir) blobs lang (fmap Path.toString excludeDirs)
|
||||
where
|
||||
toFile path = File path lowerBound lang
|
||||
exts = extensionsForLanguage lang
|
||||
|
||||
|
||||
-- | Read a utf8-encoded file to a 'Blob'.
|
||||
readBlobFromFile :: MonadIO m => File Language -> m (Maybe Blob)
|
||||
readBlobFromFile (File (Path.toString -> "/dev/null") _ _) = pure Nothing
|
||||
|
@ -3,6 +3,8 @@ module Data.Language
|
||||
, LanguageMode(..)
|
||||
, PerLanguageModes(..)
|
||||
, defaultLanguageModes
|
||||
, preciseLanguageModes
|
||||
, aLaCarteLanguageModes
|
||||
, codeNavLanguages
|
||||
, supportedExts
|
||||
) where
|
||||
@ -36,7 +38,10 @@ data PerLanguageModes = PerLanguageModes
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
defaultLanguageModes :: PerLanguageModes
|
||||
defaultLanguageModes = PerLanguageModes
|
||||
defaultLanguageModes = preciseLanguageModes
|
||||
|
||||
aLaCarteLanguageModes :: PerLanguageModes
|
||||
aLaCarteLanguageModes = PerLanguageModes
|
||||
{ pythonMode = ALaCarte
|
||||
, rubyMode = ALaCarte
|
||||
, goMode = ALaCarte
|
||||
@ -46,6 +51,17 @@ defaultLanguageModes = PerLanguageModes
|
||||
, jsxMode = ALaCarte
|
||||
}
|
||||
|
||||
preciseLanguageModes :: PerLanguageModes
|
||||
preciseLanguageModes = PerLanguageModes
|
||||
{ pythonMode = Precise
|
||||
, rubyMode = Precise
|
||||
, goMode = Precise
|
||||
, typescriptMode = Precise
|
||||
, tsxMode = Precise
|
||||
, javascriptMode = Precise
|
||||
, jsxMode = Precise
|
||||
}
|
||||
|
||||
data LanguageMode
|
||||
= ALaCarte
|
||||
| Precise
|
||||
|
@ -1,63 +0,0 @@
|
||||
module Data.Project
|
||||
( Project (..)
|
||||
, projectExtensions
|
||||
, projectName
|
||||
, projectFiles
|
||||
, readProjectFromPaths
|
||||
) where
|
||||
|
||||
import Prelude hiding (readFile)
|
||||
|
||||
import Analysis.File
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Blob
|
||||
import Data.Blob.IO
|
||||
import Data.Language
|
||||
import Data.Semilattice.Lower
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Semantic.IO
|
||||
import System.FilePath.Posix
|
||||
import qualified System.Path as Path
|
||||
|
||||
-- | A 'Project' contains all the information that semantic needs
|
||||
-- to execute an analysis, diffing, or graphing pass.
|
||||
data Project = Project
|
||||
{ projectRootDir :: FilePath
|
||||
, projectBlobs :: [Blob]
|
||||
, projectLanguage :: Language
|
||||
, projectExcludeDirs :: [FilePath]
|
||||
} deriving (Eq, Show)
|
||||
|
||||
projectName :: Project -> Text
|
||||
projectName = T.pack . dropExtensions . takeFileName . projectRootDir
|
||||
|
||||
projectExtensions :: Project -> [String]
|
||||
projectExtensions = extensionsForLanguage . projectLanguage
|
||||
|
||||
projectFiles :: Project -> [File Language]
|
||||
projectFiles = fmap blobFile . projectBlobs
|
||||
|
||||
readProjectFromPaths :: MonadIO m
|
||||
=> Maybe Path.AbsRelDir -- ^ An optional root directory for the project
|
||||
-> Path.AbsRelFileDir -- ^ A file or directory to parse. Passing a file path loads all files in that file's parent directory.
|
||||
-> Language
|
||||
-> [Path.AbsRelDir] -- ^ Directories to exclude.
|
||||
-> m Project
|
||||
readProjectFromPaths maybeRoot path lang excludeDirs = do
|
||||
let rootDir :: Path.AbsRelDir
|
||||
rootDir = case maybeRoot >>= Path.fromAbsRel of
|
||||
-- If we were provided a root directory, use that.
|
||||
Just root -> root
|
||||
Nothing -> case Path.fileFromFileDir path of
|
||||
-- If we weren't and the path is a file, drop its file name.
|
||||
Just fp -> Path.takeDirectory fp
|
||||
-- Otherwise, load from the path.
|
||||
Nothing -> Path.dirFromFileDir path
|
||||
|
||||
paths <- liftIO $ findFilesInDir rootDir exts excludeDirs
|
||||
blobs <- liftIO $ traverse (readBlobFromFile' . toFile) paths
|
||||
pure $ Project (Path.toString rootDir) blobs lang (fmap Path.toString excludeDirs)
|
||||
where
|
||||
toFile path = File path lowerBound lang
|
||||
exts = extensionsForLanguage lang
|
@ -3,6 +3,7 @@
|
||||
module Semantic.CLI (main) where
|
||||
|
||||
import qualified Analysis.File as File
|
||||
import Analysis.Project
|
||||
import qualified Control.Carrier.Parse.Measured as Parse
|
||||
import Control.Carrier.Reader
|
||||
import Control.Exception
|
||||
@ -15,7 +16,6 @@ import Data.Handle
|
||||
import qualified Data.Language as Language
|
||||
import Data.List (intercalate)
|
||||
import Data.Maybe.Exts
|
||||
import Data.Project
|
||||
import Options.Applicative hiding (style)
|
||||
import Semantic.Api hiding (File)
|
||||
import Semantic.Config
|
||||
@ -91,7 +91,6 @@ diffCommand :: Mod CommandFields (Parse.ParseC Task.TaskC Builder)
|
||||
diffCommand = command "diff" (info diffArgumentsParser (progDesc "Compute changes between paths"))
|
||||
where
|
||||
diffArgumentsParser = do
|
||||
languageModes <- languageModes
|
||||
renderer <- flag (parseDiffBuilder DiffSExpression) (parseDiffBuilder DiffSExpression) (long "sexpression" <> help "Output s-expression diff tree (default)")
|
||||
<|> flag' (parseDiffBuilder DiffJSONTree) (long "json" <> help "Output JSON diff trees")
|
||||
<|> flag' (parseDiffBuilder DiffJSONGraph) (long "json-graph" <> help "Output JSON diff trees")
|
||||
@ -99,7 +98,7 @@ diffCommand = command "diff" (info diffArgumentsParser (progDesc "Compute change
|
||||
<|> flag' (parseDiffBuilder DiffDotGraph) (long "dot" <> help "Output the diff as a DOT graph")
|
||||
<|> flag' (parseDiffBuilder DiffShow) (long "show" <> help "Output using the Show instance (debug only, format subject to change without notice)")
|
||||
filesOrStdin <- Right <$> some ((,) <$> argument filePathReader (metavar "FILE_A") <*> argument filePathReader (metavar "FILE_B")) <|> pure (Left stdin)
|
||||
pure $ Task.readBlobPairs filesOrStdin >>= runReader languageModes . renderer
|
||||
pure $ Task.readBlobPairs filesOrStdin >>= runReader Language.aLaCarteLanguageModes . renderer
|
||||
|
||||
parseCommand :: Mod CommandFields (Parse.ParseC Task.TaskC Builder)
|
||||
parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate parse trees for path(s)"))
|
||||
@ -184,7 +183,7 @@ languageModes = Language.PerLanguageModes
|
||||
= option auto ( long (shortName <> "-mode")
|
||||
<> help ("The AST representation to use for " <> fullName <> " sources")
|
||||
<> metavar "ALaCarte|Precise"
|
||||
<> value Language.ALaCarte
|
||||
<> value Language.Precise
|
||||
<> showDefault)
|
||||
|
||||
filePathReader :: ReadM (File.File Language.Language)
|
||||
|
@ -44,6 +44,7 @@ import Analysis.Abstract.Caching.FlowInsensitive
|
||||
import Analysis.Abstract.Collecting
|
||||
import Analysis.Abstract.Graph as Graph
|
||||
import Analysis.File
|
||||
import Analysis.Project
|
||||
import Control.Abstract hiding (String)
|
||||
import Control.Abstract.PythonPackage as PythonPackage
|
||||
import Control.Carrier.Fresh.Strict
|
||||
@ -73,7 +74,6 @@ import Data.Language as Language
|
||||
import Data.List (find, isPrefixOf)
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as Map
|
||||
import Data.Project
|
||||
import Data.Proxy
|
||||
import Data.Text (pack, unpack)
|
||||
import Language.Haskell.HsColour
|
||||
|
@ -20,6 +20,7 @@ module Semantic.Resolution
|
||||
) where
|
||||
|
||||
import Analysis.File as File
|
||||
import Analysis.Project
|
||||
import Control.Algebra
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Aeson
|
||||
@ -30,7 +31,6 @@ import Data.Language
|
||||
import qualified Data.Map as Map
|
||||
import Data.Map.Strict (Map)
|
||||
import Data.Maybe.Exts
|
||||
import Data.Project
|
||||
import Data.Text (Text)
|
||||
import GHC.Generics (Generic1)
|
||||
import Semantic.Task.Files
|
||||
|
@ -28,6 +28,7 @@ module Semantic.Task.Files
|
||||
) where
|
||||
|
||||
import Analysis.File
|
||||
import Analysis.Project
|
||||
import Control.Algebra
|
||||
import Control.Effect.Error
|
||||
import Control.Exception
|
||||
@ -37,7 +38,6 @@ import Data.Blob.IO
|
||||
import qualified Data.ByteString.Builder as B
|
||||
import Data.Handle
|
||||
import Data.Language
|
||||
import Data.Project
|
||||
import Prelude hiding (readFile)
|
||||
import Semantic.IO
|
||||
import qualified System.IO as IO hiding (withBinaryFile)
|
||||
|
@ -18,6 +18,7 @@ module Semantic.Util
|
||||
import Prelude hiding (readFile)
|
||||
|
||||
import Analysis.File
|
||||
import Analysis.Project
|
||||
import Control.Abstract
|
||||
import Control.Carrier.Fresh.Strict
|
||||
import Control.Carrier.Lift
|
||||
@ -40,7 +41,6 @@ import Data.Graph.Algebraic (topologicalSort)
|
||||
import qualified Data.Language as Language
|
||||
import Data.List (uncons)
|
||||
import Data.Maybe
|
||||
import Data.Project
|
||||
import Data.Semilattice.Lower
|
||||
import Data.Sum
|
||||
import Parsing.Parser
|
||||
|
@ -78,5 +78,5 @@ instance ToSExpression t => GToSExpression (Rec1 t) where
|
||||
|
||||
instance (Foldable f, GToSExpression g) => GToSExpression (f :.: g) where
|
||||
gtoSExpression (Comp1 fs) n
|
||||
| null fs = [nl n <> pad n <> "[]"]
|
||||
| otherwise = nl n <> pad n <> "[" : foldMap gtoSExpression fs (n + 1) <> ["]"]
|
||||
| null fs = mempty
|
||||
| otherwise = foldMap gtoSExpression fs n
|
||||
|
@ -18,7 +18,7 @@ import Control.Monad
|
||||
import Data.Blob
|
||||
import Data.Foldable
|
||||
import Data.Int
|
||||
import Data.Language (LanguageMode (..), PerLanguageModes (..))
|
||||
import Data.Language (LanguageMode (..), PerLanguageModes (..), aLaCarteLanguageModes, preciseLanguageModes)
|
||||
import Data.List
|
||||
import qualified Data.Text as Text
|
||||
import Data.Traversable
|
||||
@ -259,28 +259,6 @@ okALaCarteSymbol _ _ = True
|
||||
filterALaCarteSymbols :: String -> [Text.Text] -> [Text.Text]
|
||||
filterALaCarteSymbols lang = filter (okALaCarteSymbol lang)
|
||||
|
||||
aLaCarteLanguageModes :: PerLanguageModes
|
||||
aLaCarteLanguageModes = PerLanguageModes
|
||||
{ pythonMode = ALaCarte
|
||||
, rubyMode = ALaCarte
|
||||
, goMode = ALaCarte
|
||||
, typescriptMode = ALaCarte
|
||||
, tsxMode = ALaCarte
|
||||
, javascriptMode = ALaCarte
|
||||
, jsxMode = ALaCarte
|
||||
}
|
||||
|
||||
preciseLanguageModes :: PerLanguageModes
|
||||
preciseLanguageModes = PerLanguageModes
|
||||
{ pythonMode = Precise
|
||||
, rubyMode = Precise
|
||||
, goMode = Precise
|
||||
, typescriptMode = Precise
|
||||
, tsxMode = Precise
|
||||
, javascriptMode = Precise
|
||||
, jsxMode = Precise
|
||||
}
|
||||
|
||||
testOptions :: Config.Options
|
||||
testOptions = defaultOptions
|
||||
{ optionsFailOnWarning = flag FailOnWarning True
|
||||
|
@ -1,30 +1,37 @@
|
||||
{-# LANGUAGE DataKinds, FlexibleContexts, MonoLocalBinds, OverloadedStrings, TupleSections, TypeOperators #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE MonoLocalBinds #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
module Rendering.TOC.Spec (spec) where
|
||||
|
||||
import Analysis.TOCSummary
|
||||
import Control.Effect.Parse
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Aeson hiding (defaultOptions)
|
||||
import Data.Bifunctor
|
||||
import Data.Diff
|
||||
import Data.Either (isRight)
|
||||
import Data.Sum
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Diffing.Interpreter
|
||||
import Prelude
|
||||
import Analysis.TOCSummary
|
||||
import Control.Effect.Parse
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Aeson hiding (defaultOptions)
|
||||
import Data.Bifunctor
|
||||
import Data.Diff
|
||||
import Data.Either (isRight)
|
||||
import Data.Sum
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import Rendering.TOC
|
||||
import Semantic.Api (diffSummaryBuilder, summarizeTerms, summarizeTermParsers)
|
||||
import Serializing.Format as Format
|
||||
import Source.Loc
|
||||
import Source.Span
|
||||
import qualified System.Path as Path
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Diffing.Interpreter
|
||||
import Prelude
|
||||
import Rendering.TOC
|
||||
import Semantic.Api (diffSummaryBuilder, summarizeTermParsers, summarizeTerms)
|
||||
import Serializing.Format as Format
|
||||
import Source.Loc
|
||||
import Source.Span
|
||||
import System.Path ((</>))
|
||||
import qualified System.Path as Path
|
||||
|
||||
import SpecHelpers
|
||||
|
||||
don't :: Applicative m => m a -> m ()
|
||||
don't = const (pure ())
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
@ -135,22 +142,22 @@ spec = do
|
||||
describe "diff with ToCDiffRenderer'" $ do
|
||||
it "produces JSON output" $ do
|
||||
blobs <- blobsForPaths (Path.relFile "ruby/toc/methods.A.rb") (Path.relFile "ruby/toc/methods.B.rb")
|
||||
output <- runTaskOrDie (runReader defaultLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
output <- runTaskOrDie (runReader aLaCarteLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/methods.A.rb -> test/fixtures/ruby/toc/methods.B.rb\",\"language\":\"Ruby\",\"changes\":[{\"category\":\"Method\",\"term\":\"self.foo\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":2,\"column\":4}},\"changeType\":\"ADDED\"},{\"category\":\"Method\",\"term\":\"bar\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":6,\"column\":4}},\"changeType\":\"MODIFIED\"},{\"category\":\"Method\",\"term\":\"baz\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":5,\"column\":4}},\"changeType\":\"REMOVED\"}]}]}\n" :: ByteString)
|
||||
|
||||
it "produces JSON output if there are parse errors" $ do
|
||||
it "[DISABLED] produces JSON output if there are parse errors" . don't $ do
|
||||
blobs <- blobsForPaths (Path.relFile "ruby/toc/methods.A.rb") (Path.relFile "ruby/toc/methods.X.rb")
|
||||
output <- runTaskOrDie (runReader defaultLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/methods.A.rb -> test/fixtures/ruby/toc/methods.X.rb\",\"language\":\"Ruby\",\"changes\":[{\"category\":\"Method\",\"term\":\"bar\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":2,\"column\":4}},\"changeType\":\"REMOVED\"},{\"category\":\"Method\",\"term\":\"baz\",\"span\":{\"start\":{\"line\":4,\"column\":1},\"end\":{\"line\":5,\"column\":4}},\"changeType\":\"REMOVED\"}],\"errors\":[{\"error\":\"expected end of input nodes, but got ParseError\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":3,\"column\":1}}}]}]}\n" :: ByteString)
|
||||
|
||||
it "ignores anonymous functions" $ do
|
||||
blobs <- blobsForPaths (Path.relFile "ruby/toc/lambda.A.rb") (Path.relFile "ruby/toc/lambda.B.rb")
|
||||
output <- runTaskOrDie (runReader defaultLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
output <- runTaskOrDie (runReader aLaCarteLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/ruby/toc/lambda.A.rb -> test/fixtures/ruby/toc/lambda.B.rb\",\"language\":\"Ruby\"}]}\n" :: ByteString)
|
||||
|
||||
it "summarizes Markdown headings" $ do
|
||||
blobs <- blobsForPaths (Path.relFile "markdown/toc/headings.A.md") (Path.relFile "markdown/toc/headings.B.md")
|
||||
output <- runTaskOrDie (runReader defaultLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
output <- runTaskOrDie (runReader aLaCarteLanguageModes (diffSummaryBuilder Format.JSON [blobs]))
|
||||
runBuilder output `shouldBe` ("{\"files\":[{\"path\":\"test/fixtures/markdown/toc/headings.A.md -> test/fixtures/markdown/toc/headings.B.md\",\"language\":\"Markdown\",\"changes\":[{\"category\":\"Heading 1\",\"term\":\"Introduction\",\"span\":{\"start\":{\"line\":1,\"column\":1},\"end\":{\"line\":3,\"column\":16}},\"changeType\":\"REMOVED\"},{\"category\":\"Heading 2\",\"term\":\"Two\",\"span\":{\"start\":{\"line\":5,\"column\":1},\"end\":{\"line\":7,\"column\":4}},\"changeType\":\"MODIFIED\"},{\"category\":\"Heading 3\",\"term\":\"This heading is new\",\"span\":{\"start\":{\"line\":9,\"column\":1},\"end\":{\"line\":11,\"column\":10}},\"changeType\":\"ADDED\"},{\"category\":\"Heading 1\",\"term\":\"Final\",\"span\":{\"start\":{\"line\":13,\"column\":1},\"end\":{\"line\":14,\"column\":4}},\"changeType\":\"ADDED\"}]}]}\n" :: ByteString)
|
||||
|
||||
|
||||
@ -219,4 +226,4 @@ summarize
|
||||
:: (Has (Error SomeException) sig m, Has Parse sig m, Has Telemetry sig m, MonadIO m)
|
||||
=> BlobPair
|
||||
-> m [Either ErrorSummary TOCSummary]
|
||||
summarize = parsePairWith (summarizeTermParsers defaultLanguageModes) summarizeTerms
|
||||
summarize = parsePairWith (summarizeTermParsers aLaCarteLanguageModes) summarizeTerms
|
||||
|
@ -71,8 +71,8 @@ diffFixtures :: [(String, [BlobPair] -> ParseC TaskC Builder, [(File Language, F
|
||||
diffFixtures =
|
||||
[ ("json diff", parseDiffBuilder DiffJSONTree, pathMode, prefix </> Path.file "diff-tree.json")
|
||||
, ("s-expression diff", parseDiffBuilder DiffSExpression, pathMode, Path.relFile "test/fixtures/ruby/corpus/method-declaration.diffA-B.txt")
|
||||
, ("toc summaries diff", runReader defaultLanguageModes . diffSummaryBuilder Serializing.Format.JSON, pathMode, prefix </> Path.file "diff-tree.toc.json")
|
||||
, ("protobuf diff", runReader defaultLanguageModes . diffSummaryBuilder Serializing.Format.Proto, pathMode, prefix </> Path.file "diff-tree.toc.protobuf.bin")
|
||||
, ("toc summaries diff", runReader aLaCarteLanguageModes . diffSummaryBuilder Serializing.Format.JSON, pathMode, prefix </> Path.file "diff-tree.toc.json")
|
||||
, ("protobuf diff", runReader aLaCarteLanguageModes . diffSummaryBuilder Serializing.Format.Proto, pathMode, prefix </> Path.file "diff-tree.toc.protobuf.bin")
|
||||
]
|
||||
where pathMode = [(File (Path.absRel "test/fixtures/ruby/corpus/method-declaration.A.rb") lowerBound Ruby, File (Path.absRel "test/fixtures/ruby/corpus/method-declaration.B.rb") lowerBound Ruby)]
|
||||
prefix = Path.relDir "test/fixtures/cli"
|
||||
|
@ -31,4 +31,4 @@ spec = do
|
||||
|
||||
it "renders with the specified renderer" $ do
|
||||
output <- fmap runBuilder . runTaskOrDie . runReader defaultLanguageModes $ parseTermBuilder TermSExpression [methodsBlob]
|
||||
output `shouldBe` "(Statements\n (Method\n (Empty)\n (Identifier)\n (Statements)))\n"
|
||||
output `shouldBe` "(Program \n (Statement \n (Arg \n (Primary \n (Method \n (MethodName \n (Identifier \"foo\")))))))\n"
|
||||
|
@ -26,6 +26,7 @@ module SpecHelpers
|
||||
|
||||
import qualified Analysis.File as File
|
||||
import Analysis.Name as X
|
||||
import Analysis.Project as X
|
||||
import Control.Abstract
|
||||
import Control.Carrier.Fresh.Strict
|
||||
import Control.Carrier.Lift
|
||||
@ -56,7 +57,6 @@ import Data.Language as X hiding (Precise)
|
||||
import Data.List.NonEmpty as X (NonEmpty (..))
|
||||
import Data.Maybe as X
|
||||
import Data.Monoid as X (First (..), Last (..), Monoid (..))
|
||||
import Data.Project as X
|
||||
import Data.Proxy as X
|
||||
import Data.Semigroup as X (Semigroup (..))
|
||||
import Data.Semilattice.Lower as X
|
||||
|
@ -12,27 +12,27 @@ import Tags.Tagging as Tags
|
||||
spec :: Spec
|
||||
spec = do
|
||||
describe "go" $ do
|
||||
it "produces tags for functions with docs" $
|
||||
it "produces tags for functions with docs (TODO)" $
|
||||
parseTestFile [Function] (Path.relFile "test/fixtures/go/tags/simple_functions.go") `shouldReturn`
|
||||
[ Tag "TestFromBits" Function (Loc (Range 51 92) (Span (Pos 6 1) (Pos 8 2))) "func TestFromBits(t *testing.T) {" (Just "// TestFromBits ...")
|
||||
, Tag "Hi" Function (Loc (Range 94 107) (Span (Pos 10 1) (Pos 11 2))) "func Hi()" Nothing ]
|
||||
[ Tag "TestFromBits" Function (Loc (Range 51 92) (Span (Pos 6 1) (Pos 8 2))) "func TestFromBits(t *testing.T) {" Nothing
|
||||
, Tag "Hi" Function (Loc (Range 94 107) (Span (Pos 10 1) (Pos 11 2))) "func Hi() {" Nothing ]
|
||||
|
||||
it "produces tags for methods" $
|
||||
parseTestFile [Method] (Path.relFile "test/fixtures/go/tags/method.go") `shouldReturn`
|
||||
[ Tag "CheckAuth" Method (Loc (Range 19 118) (Span (Pos 3 1) (Pos 3 100))) "func (c *apiClient) CheckAuth(req *http.Request, user, repo string) (*authenticatedActor, error)" Nothing]
|
||||
[ Tag "CheckAuth" Method (Loc (Range 19 118) (Span (Pos 3 1) (Pos 3 100))) "func (c *apiClient) CheckAuth(req *http.Request, user, repo string) (*authenticatedActor, error) {}" Nothing]
|
||||
|
||||
it "produces tags for calls" $
|
||||
parseTestFile [Call] (Path.relFile "test/fixtures/go/tags/simple_functions.go") `shouldReturn`
|
||||
[ Tag "Hi" Call (Loc (Range 86 90) (Span (Pos 7 2) (Pos 7 6))) "Hi()" Nothing]
|
||||
|
||||
describe "javascript and typescript" $ do
|
||||
it "produces tags for functions with docs" $
|
||||
it "produces tags for functions with docs (TODO)" $
|
||||
parseTestFile [Function] (Path.relFile "test/fixtures/javascript/tags/simple_function_with_docs.js") `shouldReturn`
|
||||
[ Tag "myFunction" Function (Loc (Range 22 59) (Span (Pos 2 1) (Pos 4 2))) "function myFunction()" (Just "// This is myFunction") ]
|
||||
[ Tag "myFunction" Function (Loc (Range 22 59) (Span (Pos 2 1) (Pos 4 2))) "function myFunction() {" Nothing ]
|
||||
|
||||
it "produces tags for classes" $
|
||||
parseTestFile [Class] (Path.relFile "test/fixtures/typescript/tags/class.ts") `shouldReturn`
|
||||
[ Tag "FooBar" Class (Loc (Range 0 15) (Span (Pos 1 1) (Pos 1 16))) "class FooBar" Nothing ]
|
||||
[ Tag "FooBar" Class (Loc (Range 0 15) (Span (Pos 1 1) (Pos 1 16))) "class FooBar {}" Nothing ]
|
||||
|
||||
it "produces tags for modules" $
|
||||
parseTestFile [Tags.Module] (Path.relFile "test/fixtures/typescript/tags/module.ts") `shouldReturn`
|
||||
@ -72,19 +72,19 @@ spec = do
|
||||
, Tag "a" Call (Loc (Range 22 23) (Span (Pos 3 3) (Pos 3 4))) "a" Nothing
|
||||
]
|
||||
|
||||
it "produces tags for methods with docs" $
|
||||
it "produces tags for methods with docs (TODO)" $
|
||||
parseTestFile [Method] (Path.relFile "test/fixtures/ruby/tags/simple_method_with_docs.rb") `shouldReturn`
|
||||
[ Tag "foo" Method (Loc (Range 14 25) (Span (Pos 2 1) (Pos 3 4))) "def foo" (Just "# Public: foo") ]
|
||||
[ Tag "foo" Method (Loc (Range 14 25) (Span (Pos 2 1) (Pos 3 4))) "def foo" Nothing ]
|
||||
|
||||
it "correctly tags files containing multibyte UTF-8 characters" $
|
||||
it "correctly tags files containing multibyte UTF-8 characters (TODO)" $
|
||||
parseTestFile [Method] (Path.relFile "test/fixtures/ruby/tags/unicode_identifiers.rb") `shouldReturn`
|
||||
[ Tag "日本語" Method (Loc (Range 16 43) (Span (Pos 2 1) (Pos 4 4))) "def 日本語" (Just "# coding: utf-8")]
|
||||
[ Tag "日本語" Method (Loc (Range 16 43) (Span (Pos 2 1) (Pos 4 4))) "def 日本語" Nothing]
|
||||
|
||||
it "produces tags for methods and classes with docs" $
|
||||
it "produces tags for methods and classes with docs (TODO)" $
|
||||
parseTestFile [Class, Method, Tags.Module] (Path.relFile "test/fixtures/ruby/tags/class_module.rb") `shouldReturn`
|
||||
[ Tag "Foo" Tags.Module (Loc (Range 14 118) (Span (Pos 2 1 ) (Pos 12 4))) "module Foo" (Just "# Public: Foo")
|
||||
, Tag "Bar" Class (Loc (Range 44 114) (Span (Pos 5 3 ) (Pos 11 6))) "class Bar" (Just "# Public: Bar")
|
||||
, Tag "baz" Method (Loc (Range 77 108) (Span (Pos 8 5 ) (Pos 10 8))) "def baz(a)" (Just "# Public: baz")
|
||||
[ Tag "Foo" Tags.Module (Loc (Range 14 118) (Span (Pos 2 1 ) (Pos 12 4))) "module Foo" Nothing
|
||||
, Tag "Bar" Class (Loc (Range 44 114) (Span (Pos 5 3 ) (Pos 11 6))) "class Bar" Nothing
|
||||
, Tag "baz" Method (Loc (Range 77 108) (Span (Pos 8 5 ) (Pos 10 8))) "def baz(a)" Nothing
|
||||
, Tag "C" Class (Loc (Range 120 188) (Span (Pos 14 1) (Pos 20 4))) "class A::B::C" Nothing
|
||||
, Tag "foo" Method (Loc (Range 136 163) (Span (Pos 15 3) (Pos 17 6))) "def foo" Nothing
|
||||
, Tag "foo" Method (Loc (Range 166 184) (Span (Pos 18 3) (Pos 19 6))) "def self.foo" Nothing
|
||||
|
95
test/fixtures/go/corpus/array-types.parseA.txt
vendored
95
test/fixtures/go/corpus/array-types.parseA.txt
vendored
@ -1,32 +1,63 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Identifier))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Expression
|
||||
(IntLiteral "2"))))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "x")))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "b")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "3"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "5"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "float64"))))))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
95
test/fixtures/go/corpus/array-types.parseB.txt
vendored
95
test/fixtures/go/corpus/array-types.parseB.txt
vendored
@ -1,32 +1,63 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Identifier))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "1"))))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "y")))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "d")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "6"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "9"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "e")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(ArrayType
|
||||
(Expression
|
||||
(IntLiteral "3"))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "float64"))))))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,14 +1,28 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Integer))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "1")))
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "2")))
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "3"))))
|
||||
(ImplicitLengthArrayType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
(Identifier "a1")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,14 +1,28 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Integer))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "4")))
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "5")))
|
||||
(Element
|
||||
(Expression
|
||||
(IntLiteral "6"))))
|
||||
(ImplicitLengthArrayType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
(Identifier "a1")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,62 +1,133 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(AugmentedAssignment
|
||||
(Plus
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer))))
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Not
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Pointer
|
||||
(Identifier))
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(Statements
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Integer))))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "a")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(Expression
|
||||
(Identifier "c")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Expression
|
||||
(IntLiteral "3"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "d")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "3"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "e")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "g")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "h")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "i")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "j")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "k")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(VarDeclaration
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(UnaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(IntLiteral "1000"))))
|
||||
(TypeIdentifier "Point3D"))))))
|
||||
(Identifier "pointer")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point3D"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,62 +1,133 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(AugmentedAssignment
|
||||
(Plus
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer))))
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(AugmentedAssignment
|
||||
(Not
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Pointer
|
||||
(Identifier))
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(Statements
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Integer))))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "l")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "m"))
|
||||
(Expression
|
||||
(Identifier "n")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Expression
|
||||
(IntLiteral "3"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "o")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "3"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "p")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "q")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "s")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "t")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "u")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "v")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "w")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(VarDeclaration
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(UnaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(IntLiteral "1000"))))
|
||||
(TypeIdentifier "Point2D"))))))
|
||||
(Identifier "pointer")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point2D"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,70 +1,178 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Context
|
||||
(Comment)
|
||||
(Or
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(Identifier))))
|
||||
(Context
|
||||
(Comment)
|
||||
(And
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Equal
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Not
|
||||
(Equal
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(LessThanEqual
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(GreaterThan
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(GreaterThanEqual
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BOr
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Times
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(Expression
|
||||
(Identifier "b"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "c"))
|
||||
(Expression
|
||||
(Identifier "d"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "e"))
|
||||
(Expression
|
||||
(Identifier "f"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "g"))
|
||||
(Expression
|
||||
(Identifier "h"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(Identifier "j"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "k"))
|
||||
(Expression
|
||||
(Identifier "l"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "m"))
|
||||
(Expression
|
||||
(Identifier "n"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "o"))
|
||||
(Expression
|
||||
(Identifier "p"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "q"))
|
||||
(Expression
|
||||
(Identifier "r"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "s"))
|
||||
(Expression
|
||||
(Identifier "t"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "u"))
|
||||
(Expression
|
||||
(Identifier "v"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "x"))
|
||||
(Expression
|
||||
(Identifier "y"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "z"))
|
||||
(Expression
|
||||
(Identifier "aa"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "bb"))
|
||||
(Expression
|
||||
(Identifier "cc"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "dd"))
|
||||
(Expression
|
||||
(Identifier "ee"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "ff"))
|
||||
(Expression
|
||||
(Identifier "gg"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "hh"))
|
||||
(Expression
|
||||
(Identifier "ii"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "jj"))
|
||||
(Expression
|
||||
(Identifier "kk"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "ll"))
|
||||
(Expression
|
||||
(Identifier "mm")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,70 +1,178 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Context
|
||||
(Comment)
|
||||
(Or
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(Identifier))))
|
||||
(Context
|
||||
(Comment)
|
||||
(And
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Equal
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Not
|
||||
(Equal
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(LessThanEqual
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(GreaterThan
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(GreaterThanEqual
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BOr
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Times
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(Expression
|
||||
(Identifier "c"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "d"))
|
||||
(Expression
|
||||
(Identifier "c"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "f"))
|
||||
(Expression
|
||||
(Identifier "e"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "h"))
|
||||
(Expression
|
||||
(Identifier "g"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "j"))
|
||||
(Expression
|
||||
(Identifier "i"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "l"))
|
||||
(Expression
|
||||
(Identifier "k"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "n"))
|
||||
(Expression
|
||||
(Identifier "m"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "p"))
|
||||
(Expression
|
||||
(Identifier "o"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "r"))
|
||||
(Expression
|
||||
(Identifier "q"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "t"))
|
||||
(Expression
|
||||
(Identifier "s"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "v"))
|
||||
(Expression
|
||||
(Identifier "u"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "y"))
|
||||
(Expression
|
||||
(Identifier "x"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "aa"))
|
||||
(Expression
|
||||
(Identifier "z"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "cc"))
|
||||
(Expression
|
||||
(Identifier "bb"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "ee"))
|
||||
(Expression
|
||||
(Identifier "dd"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "gg"))
|
||||
(Expression
|
||||
(Identifier "ff"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "ii"))
|
||||
(Expression
|
||||
(Identifier "hh"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "kk"))
|
||||
(Expression
|
||||
(Identifier "jj"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "mm"))
|
||||
(Expression
|
||||
(Identifier "ll")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,30 +1,49 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier)))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier)))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "x"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(VariadicArgument
|
||||
(Expression
|
||||
(Identifier "c"))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "y"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(Expression
|
||||
(Identifier "c")))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "z"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(VariadicArgument
|
||||
(Expression
|
||||
(Identifier "c"))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,26 +1,42 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier)))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier)))
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(VariadicArgument
|
||||
(Expression
|
||||
(Identifier "c"))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(Expression
|
||||
(Identifier "c")))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "c"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(VariadicArgument
|
||||
(Expression
|
||||
(Identifier "c")))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,8 +1,9 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Match
|
||||
(Empty)
|
||||
(Statements))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ExpressionSwitchStatement)))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,43 +1,56 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Match
|
||||
(Statements)
|
||||
(Pattern
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Statements)))
|
||||
(Match
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Pattern
|
||||
(Statements
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Pattern
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(DefaultPattern
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ExpressionSwitchStatement
|
||||
(ExpressionCase
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "foo")))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "f1"))
|
||||
(ArgumentList))))))))
|
||||
(Statement
|
||||
(ExpressionSwitchStatement
|
||||
(Expression
|
||||
(Identifier "e"))
|
||||
(ExpressionCase
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2")))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(FallthroughStatement "fallthrough")))
|
||||
(DefaultCase
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "c"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(BreakStatement))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
101
test/fixtures/go/corpus/channel-types.parseA.txt
vendored
101
test/fixtures/go/corpus/channel-types.parseA.txt
vendored
@ -1,34 +1,67 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)
|
||||
(Statements)))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
(Identifier))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(StructType
|
||||
(FieldDeclarationList)))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c3")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c4")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c5")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(ParenthesizedType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
101
test/fixtures/go/corpus/channel-types.parseB.txt
vendored
101
test/fixtures/go/corpus/channel-types.parseB.txt
vendored
@ -1,34 +1,67 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)
|
||||
(Statements)))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
(Identifier))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c3")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(StructType
|
||||
(FieldDeclarationList)))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c4")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c4")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "c5")
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(ParenthesizedType
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
15
test/fixtures/go/corpus/comment.parseA.txt
vendored
15
test/fixtures/go/corpus/comment.parseA.txt
vendored
@ -1,8 +1,7 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
15
test/fixtures/go/corpus/comment.parseB.txt
vendored
15
test/fixtures/go/corpus/comment.parseB.txt
vendored
@ -1,8 +1,7 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,11 +1,17 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Annotation
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
(Integer))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))
|
||||
(Identifier "zero")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,14 +1,21 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Annotation
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2")))
|
||||
(Identifier "one")
|
||||
(Token)
|
||||
(Identifier "two")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "uiint64")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,8 +1,14 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))
|
||||
(Identifier "zero")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,18 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2")))
|
||||
(Identifier "one")
|
||||
(Token)
|
||||
(Identifier "two")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,15 +1,18 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "iota")))
|
||||
(Identifier "zero"))
|
||||
(ConstSpec
|
||||
(Identifier "one"))
|
||||
(ConstSpec
|
||||
(Identifier "two")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,15 +1,18 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Statements)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "iota")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(Identifier "b"))
|
||||
(ConstSpec
|
||||
(Identifier "c")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
109
test/fixtures/go/corpus/constructors.parseA.txt
vendored
109
test/fixtures/go/corpus/constructors.parseA.txt
vendored
@ -1,34 +1,75 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))
|
||||
(Expression
|
||||
(ParenthesizedExpression
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "new"))
|
||||
(Expression
|
||||
(Identifier "old")))))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))
|
||||
(Expression
|
||||
(IntLiteral "5"))
|
||||
(Expression
|
||||
(IntLiteral "10")))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "new"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
109
test/fixtures/go/corpus/constructors.parseB.txt
vendored
109
test/fixtures/go/corpus/constructors.parseB.txt
vendored
@ -1,34 +1,75 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))
|
||||
(Expression
|
||||
(ParenthesizedExpression
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "new"))
|
||||
(Expression
|
||||
(Identifier "old")))))))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "make"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))
|
||||
(Expression
|
||||
(IntLiteral "7"))
|
||||
(Expression
|
||||
(IntLiteral "11")))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "new"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,21 +1,57 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f1")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "1.5"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f2")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "1.5e100"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f3")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "1.5e+50"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f4")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "1.5e-5"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f5")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral ".5e-50")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,21 +1,57 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f1")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "2.6"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f2")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "2.6e211"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f3")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "2.6e+60"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f4")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral "2.6e-7"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "f5")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FloatLiteral ".6e-60")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
282
test/fixtures/go/corpus/for-statements.parseA.txt
vendored
282
test/fixtures/go/corpus/for-statements.parseA.txt
vendored
@ -1,104 +1,178 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
(For
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))))
|
||||
(For
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Identifier))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(For
|
||||
(Empty)
|
||||
(LessThan
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Empty)
|
||||
(Identifier)
|
||||
(Statements)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(GotoStatement
|
||||
(LabelName "loop"))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(BreakStatement
|
||||
(LabelName "loop"))))
|
||||
(ForClause
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "i")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(IntLiteral "5"))))
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(ContinueStatement
|
||||
(LabelName "loop2"))))
|
||||
(ForClause
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(IntLiteral "10"))))
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(ContinueStatement)))
|
||||
(ForClause)))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "x")))))))
|
||||
(Statement
|
||||
(BreakStatement)))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "x")))
|
||||
(Expression
|
||||
(Identifier "y")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "g"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(Identifier "s"))))))))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(Identifier "s")))
|
||||
(Expression
|
||||
(Identifier "a")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "h"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "key"))
|
||||
(Expression
|
||||
(Identifier "val"))))))))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "key"))
|
||||
(Expression
|
||||
(Identifier "val")))
|
||||
(Expression
|
||||
(Identifier "m")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block)
|
||||
(RangeClause
|
||||
(Expression
|
||||
(Identifier "ch"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
258
test/fixtures/go/corpus/for-statements.parseB.txt
vendored
258
test/fixtures/go/corpus/for-statements.parseB.txt
vendored
@ -1,99 +1,159 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
(ForEach
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Identifier))))
|
||||
(For
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Empty))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(For
|
||||
(Empty)
|
||||
(LessThan
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Empty)
|
||||
(Identifier)
|
||||
(Statements)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(GotoStatement
|
||||
(LabelName "loop"))))
|
||||
(ForClause)))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(BreakStatement
|
||||
(LabelName "loop"))))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "x")))
|
||||
(Expression
|
||||
(Identifier "y")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(ContinueStatement
|
||||
(LabelName "loop2"))))
|
||||
(ForClause)))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(ContinueStatement)))
|
||||
(ForClause
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(IntLiteral "10"))))
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "x")))))))
|
||||
(Statement
|
||||
(BreakStatement)))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "g"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(Identifier "s"))))))))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "s"))
|
||||
(Expression
|
||||
(Identifier "i")))
|
||||
(Expression
|
||||
(Identifier "b")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "h"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "k"))
|
||||
(Expression
|
||||
(Identifier "v"))))))))
|
||||
(RangeClause
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "k"))
|
||||
(Expression
|
||||
(Identifier "v")))
|
||||
(Expression
|
||||
(Identifier "m")))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "j"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(IntLiteral "2"))
|
||||
(Expression
|
||||
(IntLiteral "1"))))))
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block)
|
||||
(RangeClause
|
||||
(Expression
|
||||
(Identifier "b"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,53 +1,76 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements))
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Function
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "f1")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))
|
||||
(Identifier "f2")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "b")
|
||||
(Token)
|
||||
(Identifier "c")
|
||||
(Token)
|
||||
(Identifier "d")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(Identifier "f2")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "result")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "err")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(Identifier "f2")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))
|
||||
(Identifier "lockedOSThread")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "getcontext")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "c")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "u"))))))))))
|
||||
|
@ -1,58 +1,83 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements))
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Statements)
|
||||
(Identifier)
|
||||
(NoOp
|
||||
(Empty)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Function
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "fa")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))
|
||||
(Identifier "fb")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "b")
|
||||
(Token)
|
||||
(Identifier "c")
|
||||
(Token)
|
||||
(Identifier "d")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(Identifier "fc")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "result")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "err")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(Identifier "fd")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(EmptyStatement ";")))
|
||||
(ParameterList)
|
||||
(Identifier "fe")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))
|
||||
(Identifier "lockOSThread")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "setcontext")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "c")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "u"))))))))))
|
||||
|
@ -1,21 +1,37 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Empty)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Return
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FuncLiteral
|
||||
(Block
|
||||
(Statement
|
||||
(ReturnStatement
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "s")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))
|
||||
(Identifier "s1")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,21 +1,37 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)))
|
||||
(Empty)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Return
|
||||
(Statements
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(FuncLiteral
|
||||
(Block
|
||||
(Statement
|
||||
(ReturnStatement
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1"))
|
||||
(Expression
|
||||
(IntLiteral "2"))))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "b")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))
|
||||
(Identifier "s1")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,24 +1,44 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Identifier)))
|
||||
(Type
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(FunctionType
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "b")
|
||||
(Type
|
||||
(SimpleType
|
||||
(FunctionType
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,25 +1,47 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Identifier)))
|
||||
(Type
|
||||
(Identifier)
|
||||
(Function
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Statements
|
||||
(BidirectionalChannel
|
||||
(Identifier)))
|
||||
(Statements
|
||||
(Identifier))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "x")
|
||||
(Type
|
||||
(SimpleType
|
||||
(FunctionType
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "y")
|
||||
(Type
|
||||
(SimpleType
|
||||
(FunctionType
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(ChannelType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "x")))))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,20 +1,27 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)
|
||||
(Empty))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(DeferStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "x"))))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(GoStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "x"))))
|
||||
(ArgumentList))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,20 +1,27 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)
|
||||
(Empty))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(DeferStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "b")
|
||||
(Expression
|
||||
(Identifier "a"))))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(GoStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "d")
|
||||
(Expression
|
||||
(Identifier "c"))))
|
||||
(ArgumentList))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,13 +1,17 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(QualifiedImport
|
||||
(Identifier))
|
||||
(Import
|
||||
(TextElement))
|
||||
(QualifiedImport
|
||||
(Identifier)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ImportDeclaration
|
||||
(ImportSpecList
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral))
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral)
|
||||
(Dot "."))
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral)
|
||||
(PackageIdentifier "alias"))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,13 +1,17 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(QualifiedImport
|
||||
(Identifier))
|
||||
(Import
|
||||
(TextElement))
|
||||
(QualifiedImport
|
||||
(Identifier)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ImportDeclaration
|
||||
(ImportSpecList
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral))
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral)
|
||||
(Dot "."))
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral)
|
||||
(PackageIdentifier "alias"))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,19 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(VarDeclaration
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))
|
||||
(Identifier "zero"))
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1")))
|
||||
(Identifier "one")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,19 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(VarDeclaration
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))
|
||||
(Identifier "a"))
|
||||
(VarSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1")))
|
||||
(Identifier "b")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
202
test/fixtures/go/corpus/if-statements.parseA.txt
vendored
202
test/fixtures/go/corpus/if-statements.parseA.txt
vendored
@ -1,79 +1,123 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(If
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Empty))
|
||||
(If
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Identifier))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Empty))
|
||||
(If
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(If
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(If
|
||||
(Statements
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Context
|
||||
(Comment)
|
||||
(If
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Empty))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "a")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "d"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(Identifier "c"))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "c"))
|
||||
(ArgumentList))))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "a"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(IfStatement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "g"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "f"))
|
||||
(ArgumentList))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "e"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "num"))
|
||||
(Expression
|
||||
(IntLiteral "10")))))
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "num")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "9")))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "d"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "num"))
|
||||
(Expression
|
||||
(IntLiteral "0")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
189
test/fixtures/go/corpus/if-statements.parseB.txt
vendored
189
test/fixtures/go/corpus/if-statements.parseB.txt
vendored
@ -1,72 +1,117 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(If
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Empty))
|
||||
(If
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Identifier))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Empty))
|
||||
(If
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty)))
|
||||
(If
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Context
|
||||
(Comment)
|
||||
(If
|
||||
(Statements
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Statements)
|
||||
(Empty))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "x"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "y")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "d"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(Identifier "c"))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "c"))
|
||||
(ArgumentList))))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "b"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "z"))
|
||||
(ArgumentList)))))
|
||||
(Statement
|
||||
(IfStatement
|
||||
(IfStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "h"))
|
||||
(ArgumentList))))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "g"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "num"))
|
||||
(Expression
|
||||
(IntLiteral "100")))))
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "num")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "10")))))
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "f"))
|
||||
(ArgumentList))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "num"))
|
||||
(Expression
|
||||
(IntLiteral "0")))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,19 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Complex))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Complex)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(ImaginaryLiteral "01i")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(ImaginaryLiteral "1.e+100i")))
|
||||
(Identifier "b")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,19 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Complex))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Complex)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(ImaginaryLiteral "02i")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(ImaginaryLiteral "1.e+103i")))
|
||||
(Identifier "b")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,11 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Comment)
|
||||
(Comment)
|
||||
(QualifiedImport
|
||||
(Identifier))
|
||||
(Comment))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ImportDeclaration
|
||||
(ImportSpecList
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,12 +1,11 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Comment)
|
||||
(Comment)
|
||||
(QualifiedImport
|
||||
(Identifier))
|
||||
(Comment))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ImportDeclaration
|
||||
(ImportSpecList
|
||||
(ImportSpec
|
||||
(InterpretedStringLiteral))))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,10 +1,17 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(PostDecrement
|
||||
(Identifier)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(DecStatement
|
||||
(Expression
|
||||
(Identifier "j"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,10 +1,17 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(PostIncrement
|
||||
(Identifier)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "foo")))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "x"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
39
test/fixtures/go/corpus/int-literals.parseA.txt
vendored
39
test/fixtures/go/corpus/int-literals.parseA.txt
vendored
@ -1,15 +1,24 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "1")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "2")))
|
||||
(Identifier "b"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "3")))
|
||||
(Identifier "c")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
39
test/fixtures/go/corpus/int-literals.parseB.txt
vendored
39
test/fixtures/go/corpus/int-literals.parseB.txt
vendored
@ -1,15 +1,24 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "4")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "5")))
|
||||
(Identifier "b"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "6")))
|
||||
(Identifier "c")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
101
test/fixtures/go/corpus/interface-types.parseA.txt
vendored
101
test/fixtures/go/corpus/interface-types.parseA.txt
vendored
@ -1,42 +1,59 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(Statements))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(Statements
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MethodSignature
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)))))))
|
||||
(Context
|
||||
(Comment)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(MethodSignature
|
||||
(Empty)
|
||||
(Identifier)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "i1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList)))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "i2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(QualifiedType
|
||||
(TypeIdentifier "Reader")
|
||||
(PackageIdentifier "io")))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "i3")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(TypeIdentifier "i1")
|
||||
(QualifiedType
|
||||
(TypeIdentifier "Reader")
|
||||
(PackageIdentifier "io"))
|
||||
(MethodSpec
|
||||
(SimpleType
|
||||
(TypeIdentifier "error"))
|
||||
(FieldIdentifier "SomeMethod")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "s")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "OptionA")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(MethodSpec
|
||||
(FieldIdentifier "public")
|
||||
(ParameterList))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
101
test/fixtures/go/corpus/interface-types.parseB.txt
vendored
101
test/fixtures/go/corpus/interface-types.parseB.txt
vendored
@ -1,42 +1,59 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(Statements))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(Statements
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MethodSignature
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)))))))
|
||||
(Context
|
||||
(Comment)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Interface
|
||||
(MethodSignature
|
||||
(Empty)
|
||||
(Identifier)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "j1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList)))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "j2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(QualifiedType
|
||||
(TypeIdentifier "Reader")
|
||||
(PackageIdentifier "io")))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "j3")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(TypeIdentifier "i1")
|
||||
(QualifiedType
|
||||
(TypeIdentifier "Reader")
|
||||
(PackageIdentifier "io"))
|
||||
(MethodSpec
|
||||
(SimpleType
|
||||
(TypeIdentifier "error"))
|
||||
(FieldIdentifier "SomeMethod")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "s")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))))))))
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "OptionB")
|
||||
(Type
|
||||
(SimpleType
|
||||
(InterfaceType
|
||||
(MethodSpecList
|
||||
(MethodSpec
|
||||
(FieldIdentifier "private")
|
||||
(ParameterList))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,38 +1,57 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Label
|
||||
(Identifier)
|
||||
(NoOp
|
||||
(Empty)))
|
||||
(Context
|
||||
(Comment)
|
||||
(Label
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(For
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty)))))))
|
||||
(Label
|
||||
(Identifier)
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "L")
|
||||
(Statement
|
||||
(EmptyStatement ";"))))
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "L1")
|
||||
(Statement
|
||||
(Block
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "println"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "i")))))))
|
||||
(Statement
|
||||
(BreakStatement
|
||||
(LabelName "L1"))))
|
||||
(ForClause
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "i")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(IntLiteral "10"))))
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))))))))
|
||||
(Statement
|
||||
(Block
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "insert"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,38 +1,57 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Label
|
||||
(Identifier)
|
||||
(NoOp
|
||||
(Empty)))
|
||||
(Context
|
||||
(Comment)
|
||||
(Label
|
||||
(Identifier)
|
||||
(Context
|
||||
(Comment)
|
||||
(For
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty)))))))
|
||||
(Label
|
||||
(Identifier)
|
||||
(Empty)))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "M")
|
||||
(Statement
|
||||
(EmptyStatement ";"))))
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "M1")
|
||||
(Statement
|
||||
(Block
|
||||
(Statement
|
||||
(ForStatement
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "println"))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(Identifier "i")))))))
|
||||
(Statement
|
||||
(BreakStatement
|
||||
(LabelName "M1"))))
|
||||
(ForClause
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "i")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(IntLiteral "0")))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(Identifier "i"))
|
||||
(Expression
|
||||
(IntLiteral "10"))))
|
||||
(SimpleStatement
|
||||
(IncStatement
|
||||
(Expression
|
||||
(Identifier "i")))))))))))
|
||||
(Statement
|
||||
(Block
|
||||
(Statement
|
||||
(LabeledStatement
|
||||
(LabelName "replacement"))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
50
test/fixtures/go/corpus/map-literals.parseA.txt
vendored
50
test/fixtures/go/corpus/map-literals.parseA.txt
vendored
@ -1,18 +1,32 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(KeyValue
|
||||
(TextElement)
|
||||
(TextElement))
|
||||
(KeyValue
|
||||
(TextElement)
|
||||
(TextElement)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(Expression
|
||||
(InterpretedStringLiteral))
|
||||
(Expression
|
||||
(InterpretedStringLiteral)))
|
||||
(KeyedElement
|
||||
(Expression
|
||||
(InterpretedStringLiteral))
|
||||
(Expression
|
||||
(InterpretedStringLiteral))))
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))
|
||||
(Identifier "s")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
50
test/fixtures/go/corpus/map-literals.parseB.txt
vendored
50
test/fixtures/go/corpus/map-literals.parseB.txt
vendored
@ -1,18 +1,32 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(KeyValue
|
||||
(TextElement)
|
||||
(TextElement))
|
||||
(KeyValue
|
||||
(TextElement)
|
||||
(TextElement)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(Expression
|
||||
(InterpretedStringLiteral))
|
||||
(Expression
|
||||
(InterpretedStringLiteral)))
|
||||
(KeyedElement
|
||||
(Expression
|
||||
(InterpretedStringLiteral))
|
||||
(Expression
|
||||
(InterpretedStringLiteral))))
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))
|
||||
(Identifier "s")))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
31
test/fixtures/go/corpus/map-types.parseA.txt
vendored
31
test/fixtures/go/corpus/map-types.parseA.txt
vendored
@ -1,11 +1,20 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "m1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
31
test/fixtures/go/corpus/map-types.parseB.txt
vendored
31
test/fixtures/go/corpus/map-types.parseB.txt
vendored
@ -1,11 +1,20 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "m1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(MapType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "error")))
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,84 +1,153 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Method
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Return
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))))
|
||||
(Empty))))
|
||||
(Method
|
||||
(Statements
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)))
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "s")))))
|
||||
(FieldIdentifier "Method")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "self")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Person")))))
|
||||
(FieldIdentifier "Equals")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "other")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Person"))))))
|
||||
(MethodDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ReturnStatement
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "Sqrt")
|
||||
(Expression
|
||||
(Identifier "math"))))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p"))))
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p"))))))
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p"))))
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p")))))))))))))))
|
||||
(SimpleType
|
||||
(TypeIdentifier "float64"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "p")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point"))))))))
|
||||
(FieldIdentifier "Length")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p")))))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "factor"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p")))))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "factor")))))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "p")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point"))))))))
|
||||
(FieldIdentifier "Scale")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "factor")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "float64"))))))
|
||||
(MethodDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "f")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Field"))))))))
|
||||
(FieldIdentifier "Alive")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "x")
|
||||
(Token)
|
||||
(Identifier "y")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
|
@ -1,98 +1,173 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Method
|
||||
(Statements
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Return
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(Plus
|
||||
(Plus
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Integer))
|
||||
(Empty))
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Integer))
|
||||
(Empty)))
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Empty))))
|
||||
(Method
|
||||
(Statements
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)))
|
||||
(AugmentedAssignment
|
||||
(Times
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Method
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "s")))))
|
||||
(FieldIdentifier "Methods")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "self")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Num")))))
|
||||
(FieldIdentifier "Equals")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "other")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Num"))))))
|
||||
(MethodDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(ReturnStatement
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "Sqrt")
|
||||
(Expression
|
||||
(Identifier "math"))))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(BinaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "Pow")
|
||||
(Expression
|
||||
(Identifier "math"))))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p"))))
|
||||
(Expression
|
||||
(IntLiteral "2")))))
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p"))))))
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "Pow")
|
||||
(Expression
|
||||
(Identifier "math"))))
|
||||
(ArgumentList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p"))))
|
||||
(Expression
|
||||
(IntLiteral "2")))))))
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p")))))))))))))
|
||||
(SimpleType
|
||||
(TypeIdentifier "float64"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "p")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point"))))))))
|
||||
(FieldIdentifier "OtherLength")
|
||||
(ParameterList))
|
||||
(MethodDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "x")
|
||||
(Expression
|
||||
(Identifier "p")))))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "factor"))))))
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(AssignmentStatement
|
||||
(Token)
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(SelectorExpression
|
||||
(FieldIdentifier "y")
|
||||
(Expression
|
||||
(Identifier "p")))))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "factor")))))))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "q")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Point"))))))))
|
||||
(FieldIdentifier "Scale")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "factor")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))))
|
||||
(MethodDeclaration
|
||||
(Block)
|
||||
(SimpleType
|
||||
(TypeIdentifier "bool"))
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "f")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "Field"))))))))
|
||||
(FieldIdentifier "Alive")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "z")
|
||||
(Token)
|
||||
(Identifier "h")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
|
@ -1,14 +1,25 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(Statements
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Identifier))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "ctx")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(UnaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(FieldIdentifier "Remote")
|
||||
(Expression
|
||||
(Identifier "remote"))))
|
||||
(TypeIdentifier "uploadContext"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,19 +1,33 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(Statements
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(SimpleStatement
|
||||
(ShortVarDeclaration
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(Identifier "ctx")))
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(UnaryExpression
|
||||
(Token)
|
||||
(Expression
|
||||
(CompositeLiteral
|
||||
(LiteralValue
|
||||
(KeyedElement
|
||||
(FieldIdentifier "trackedLocksMu")
|
||||
(Expression
|
||||
(CallExpression
|
||||
(Expression
|
||||
(Identifier "new"))
|
||||
(ArgumentList
|
||||
(Type
|
||||
(SimpleType
|
||||
(QualifiedType
|
||||
(TypeIdentifier "Mutex")
|
||||
(PackageIdentifier "sync")))))))))
|
||||
(TypeIdentifier "uploadContext"))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,15 +1,21 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "foo")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "b")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))
|
||||
|
@ -1,15 +1,21 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Statements)))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "main")
|
||||
(ParameterList))
|
||||
(FunctionDeclaration
|
||||
(Block)
|
||||
(Identifier "foo")
|
||||
(ParameterList
|
||||
(ParameterDeclaration
|
||||
(Identifier "x")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string"))))
|
||||
(ParameterDeclaration
|
||||
(Identifier "y")
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "uint64")))))))
|
||||
|
43
test/fixtures/go/corpus/pointer-types.parseA.txt
vendored
43
test/fixtures/go/corpus/pointer-types.parseA.txt
vendored
@ -1,15 +1,28 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Type
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Pointer
|
||||
(Identifier)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "p1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "string")))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "p2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "p1")))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
43
test/fixtures/go/corpus/pointer-types.parseB.txt
vendored
43
test/fixtures/go/corpus/pointer-types.parseB.txt
vendored
@ -1,15 +1,28 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Type
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Pointer
|
||||
(Identifier)))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "p1")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "int")))))))
|
||||
(TypeSpec
|
||||
(TypeIdentifier "p2")
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(PointerType
|
||||
(Type
|
||||
(SimpleType
|
||||
(TypeIdentifier "p3")))))))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,11 +1,16 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "a")
|
||||
(Type
|
||||
(SimpleType
|
||||
(QualifiedType
|
||||
(TypeIdentifier "c")
|
||||
(PackageIdentifier "b"))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
@ -1,11 +1,16 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Statements
|
||||
(Type
|
||||
(Identifier)
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(FunctionDeclaration
|
||||
(Block
|
||||
(Statement
|
||||
(TypeDeclaration
|
||||
(TypeSpec
|
||||
(TypeIdentifier "x")
|
||||
(Type
|
||||
(SimpleType
|
||||
(QualifiedType
|
||||
(TypeIdentifier "z")
|
||||
(PackageIdentifier "y"))))))))
|
||||
(Identifier "main")
|
||||
(ParameterList)))
|
||||
|
56
test/fixtures/go/corpus/rune-literals.parseA.txt
vendored
56
test/fixtures/go/corpus/rune-literals.parseA.txt
vendored
@ -1,22 +1,34 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\948'")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\8984'")))
|
||||
(Identifier "b"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\8984'")))
|
||||
(Identifier "c"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\8984'")))
|
||||
(Identifier "d"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\8984'")))
|
||||
(Identifier "e"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\8984'")))
|
||||
(Identifier "f"))))
|
||||
|
56
test/fixtures/go/corpus/rune-literals.parseB.txt
vendored
56
test/fixtures/go/corpus/rune-literals.parseB.txt
vendored
@ -1,22 +1,34 @@
|
||||
(Statements
|
||||
(Package
|
||||
(Identifier))
|
||||
(Statements
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Rune))))
|
||||
(SourceFile
|
||||
(PackageClause
|
||||
(PackageIdentifier "main"))
|
||||
(ConstDeclaration
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "a"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "b"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "c"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "d"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "e"))
|
||||
(ConstSpec
|
||||
(ExpressionList
|
||||
(Expression
|
||||
(RuneLiteral "'\169'")))
|
||||
(Identifier "f"))))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user