mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Merge branch 'master' into musical-modules
This commit is contained in:
commit
cbd02eab7b
@ -64,7 +64,10 @@ library
|
||||
, Language.Markdown.Assignment
|
||||
, Language.Markdown.Syntax
|
||||
, Language.Go
|
||||
, Language.Go.Grammar
|
||||
, Language.Go.Assignment
|
||||
, Language.Go.Syntax
|
||||
, Language.Go.Type
|
||||
, Language.JSON.Grammar
|
||||
, Language.JSON.Assignment
|
||||
, Language.Ruby.Grammar
|
||||
|
@ -10,7 +10,7 @@ import Data.Algebra
|
||||
import Data.Blob
|
||||
import Data.Error (Error(..), showExpectation)
|
||||
import Data.Foldable (toList)
|
||||
import Data.Language
|
||||
import Data.Language as Language
|
||||
import Data.List.NonEmpty (nonEmpty)
|
||||
import Data.Proxy (Proxy(..))
|
||||
import Data.Range
|
||||
@ -101,9 +101,12 @@ instance CustomHasDeclaration Declaration.Function where
|
||||
|
||||
-- | Produce a 'MethodDeclaration' for 'Declaration.Method' nodes. If the method’s receiver is non-empty (defined as having a non-empty 'byteRange'), the 'declarationIdentifier' will be formatted as 'receiver.method_name'; otherwise it will be simply 'method_name'.
|
||||
instance CustomHasDeclaration Declaration.Method where
|
||||
customToDeclaration blob@Blob{..} ann decl@(Declaration.Method _ (Term (In receiverAnn _), _) (Term (In identifierAnn _), _) _ _)
|
||||
customToDeclaration blob@Blob{..} ann decl@(Declaration.Method _ (Term (In receiverAnn receiverF), _) (Term (In identifierAnn _), _) _ _)
|
||||
-- Methods without a receiver
|
||||
| isEmpty receiverAnn = Just $ MethodDeclaration (getSource identifierAnn) (getMethodSource blob (In ann decl)) blobLanguage Nothing
|
||||
-- Methods with a receiver type and an identifier (e.g. (a *Type) in Go).
|
||||
| blobLanguage == Just Language.Go
|
||||
, [ _, Term (In receiverType _) ] <- toList receiverF = Just $ MethodDeclaration (getSource identifierAnn) (getMethodSource blob (In ann decl)) blobLanguage (Just (getSource receiverType))
|
||||
-- Methods with a receiver (class methods) are formatted like `receiver.method_name`
|
||||
| otherwise = Just $ MethodDeclaration (getSource identifierAnn) (getMethodSource blob (In ann decl)) blobLanguage (Just (getSource receiverAnn))
|
||||
where getSource = toText . flip Source.slice blobSource . byteRange
|
||||
|
@ -149,7 +149,7 @@ tracing f = case getCallStack callStack of
|
||||
|
||||
-- | Zero-width production of the current location.
|
||||
--
|
||||
-- If assigning at the end of input or at the end of a list of children, the loccation will be returned as an empty Range and Span at the current offset. Otherwise, it will be the Range and Span of the current node.
|
||||
-- If assigning at the end of input or at the end of a list of children, the location will be returned as an empty Range and Span at the current offset. Otherwise, it will be the Range and Span of the current node.
|
||||
location :: HasCallStack => Assignment ast grammar (Record Location)
|
||||
location = tracing Location `Then` return
|
||||
|
||||
|
@ -31,6 +31,14 @@ instance Eq1 Method where liftEq = genericLiftEq
|
||||
instance Ord1 Method where liftCompare = genericLiftCompare
|
||||
instance Show1 Method where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A method signature in TypeScript or a method spec in Go.
|
||||
data MethodSignature a = MethodSignature { _methodSignatureContext :: ![a], _methodSignatureName :: !a, _methodSignatureParameters :: ![a] }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 MethodSignature where liftEq = genericLiftEq
|
||||
instance Ord1 MethodSignature where liftCompare = genericLiftCompare
|
||||
instance Show1 MethodSignature where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data RequiredParameter a = RequiredParameter { requiredParameter :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
@ -99,7 +107,6 @@ instance Eq1 Module where liftEq = genericLiftEq
|
||||
instance Ord1 Module where liftCompare = genericLiftCompare
|
||||
instance Show1 Module where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- | A decorator in Python
|
||||
data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
@ -144,10 +151,18 @@ instance Eq1 Import where liftEq = genericLiftEq
|
||||
instance Ord1 Import where liftCompare = genericLiftCompare
|
||||
instance Show1 Import where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Type alias declarations in Javascript/Haskell, etc.
|
||||
data TypeAliasDeclaration a = TypeAliasDeclaration { typeAliasDeclarationContext :: ![a], typeAliasDeclarationIdentifier :: !a, typeAliasDeclarationType :: !a }
|
||||
-- | A declared type (e.g. `a []int` in Go).
|
||||
data Type a = Type { typeName :: !a, typeKind :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeAliasDeclaration where liftEq = genericLiftEq
|
||||
instance Ord1 TypeAliasDeclaration where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeAliasDeclaration where liftShowsPrec = genericLiftShowsPrec
|
||||
instance Eq1 Type where liftEq = genericLiftEq
|
||||
instance Ord1 Type where liftCompare = genericLiftCompare
|
||||
instance Show1 Type where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Type alias declarations in Javascript/Haskell, etc.
|
||||
data TypeAlias a = TypeAlias { typeAliasContext :: ![a], typeAliasIdentifier :: !a, typeAliasKind :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeAlias where liftEq = genericLiftEq
|
||||
instance Ord1 TypeAlias where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeAlias where liftShowsPrec = genericLiftShowsPrec
|
||||
|
@ -159,5 +159,24 @@ instance Eq1 Set where liftEq = genericLiftEq
|
||||
instance Ord1 Set where liftCompare = genericLiftCompare
|
||||
instance Show1 Set where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- Pointers
|
||||
|
||||
-- | A declared pointer (e.g. var pointer *int in Go)
|
||||
newtype Pointer a = Pointer a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Pointer where liftEq = genericLiftEq
|
||||
instance Ord1 Pointer where liftCompare = genericLiftCompare
|
||||
instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A reference to a pointer's address (e.g. &pointer in Go)
|
||||
newtype Reference a = Reference a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Reference where liftEq = genericLiftEq
|
||||
instance Ord1 Reference where liftCompare = genericLiftCompare
|
||||
instance Show1 Reference where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- TODO: Object literals as distinct from hash literals? Or coalesce object/hash literals into “key-value literals”?
|
||||
-- TODO: Function literals (lambdas, procs, anonymous functions, what have you).
|
||||
|
@ -25,6 +25,14 @@ instance Eq1 Else where liftEq = genericLiftEq
|
||||
instance Ord1 Else where liftCompare = genericLiftCompare
|
||||
instance Show1 Else where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Goto statement (e.g. `goto a` in Go).
|
||||
newtype Goto a = Goto { gotoLocation :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Goto where liftEq = genericLiftEq
|
||||
instance Ord1 Goto where liftCompare = genericLiftCompare
|
||||
instance Show1 Goto where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- TODO: Alternative definition would flatten if/else if/else chains: data If a = If ![(a, a)] !(Maybe a)
|
||||
|
||||
-- | A pattern-matching or computed jump control-flow statement, like 'switch' in C or JavaScript, or 'case' in Ruby or Haskell.
|
||||
@ -62,6 +70,22 @@ instance Eq1 Assignment where liftEq = genericLiftEq
|
||||
instance Ord1 Assignment where liftCompare = genericLiftCompare
|
||||
instance Show1 Assignment where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Post increment operator (e.g. 1++ in Go, or i++ in C).
|
||||
newtype PostIncrement a = PostIncrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 PostIncrement where liftEq = genericLiftEq
|
||||
instance Ord1 PostIncrement where liftCompare = genericLiftCompare
|
||||
instance Show1 PostIncrement where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Post decrement operator (e.g. 1-- in Go, or i-- in C).
|
||||
newtype PostDecrement a = PostDecrement a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 PostDecrement where liftEq = genericLiftEq
|
||||
instance Ord1 PostDecrement where liftCompare = genericLiftCompare
|
||||
instance Show1 PostDecrement where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- Returns
|
||||
|
||||
@ -170,6 +194,8 @@ instance Ord1 Finally where liftCompare = genericLiftCompare
|
||||
instance Show1 Finally where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- Scoping
|
||||
|
||||
-- | ScopeEntry (e.g. `BEGIN {}` block in Ruby or Perl).
|
||||
newtype ScopeEntry a = ScopeEntry [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
@ -178,7 +204,6 @@ instance Eq1 ScopeEntry where liftEq = genericLiftEq
|
||||
instance Ord1 ScopeEntry where liftCompare = genericLiftCompare
|
||||
instance Show1 ScopeEntry where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- | ScopeExit (e.g. `END {}` block in Ruby or Perl).
|
||||
newtype ScopeExit a = ScopeExit [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
@ -9,6 +9,13 @@ import Data.Functor.Classes.Show.Generic
|
||||
import Data.Mergeable
|
||||
import GHC.Generics
|
||||
|
||||
data Array a = Array { arraySize :: Maybe a, arrayElementType :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Array where liftEq = genericLiftEq
|
||||
instance Ord1 Array where liftCompare = genericLiftCompare
|
||||
instance Show1 Array where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Annotation a = Annotation { annotationSubject :: !a, annotationType :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
@ -16,23 +23,65 @@ instance Eq1 Annotation where liftEq = genericLiftEq
|
||||
instance Ord1 Annotation where liftCompare = genericLiftCompare
|
||||
instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Product a = Product { productElements :: [a] }
|
||||
data Function a = Function { functionParameters :: [a], functionReturn :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Function where liftEq = genericLiftEq
|
||||
instance Ord1 Function where liftCompare = genericLiftCompare
|
||||
instance Show1 Function where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Interface a = Interface [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Interface where liftEq = genericLiftEq
|
||||
instance Ord1 Interface where liftCompare = genericLiftCompare
|
||||
instance Show1 Interface where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Map a = Map { mapKeyType :: a, mapElementType :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Map where liftEq = genericLiftEq
|
||||
instance Ord1 Map where liftCompare = genericLiftCompare
|
||||
instance Show1 Map where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Parenthesized a = Parenthesized a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Parenthesized where liftEq = genericLiftEq
|
||||
instance Ord1 Parenthesized where liftCompare = genericLiftCompare
|
||||
instance Show1 Parenthesized where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Pointer a = Pointer a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Pointer where liftEq = genericLiftEq
|
||||
instance Ord1 Pointer where liftCompare = genericLiftCompare
|
||||
instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Product a = Product [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Product where liftEq = genericLiftEq
|
||||
instance Ord1 Product where liftCompare = genericLiftCompare
|
||||
instance Show1 Product where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data TypeParameters a = TypeParameters { typeParameters :: ![a] }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeParameters where liftEq = genericLiftEq
|
||||
instance Ord1 TypeParameters where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeParameters where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data Readonly a = Readonly
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Readonly where liftEq = genericLiftEq
|
||||
instance Ord1 Readonly where liftCompare = genericLiftCompare
|
||||
instance Show1 Readonly where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Slice a = Slice a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Slice where liftEq = genericLiftEq
|
||||
instance Ord1 Slice where liftCompare = genericLiftCompare
|
||||
instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data TypeParameters a = TypeParameters [a]
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeParameters where liftEq = genericLiftEq
|
||||
instance Ord1 TypeParameters where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeParameters where liftShowsPrec = genericLiftShowsPrec
|
||||
|
590
src/Language/Go/Assignment.hs
Normal file
590
src/Language/Go/Assignment.hs
Normal file
@ -0,0 +1,590 @@
|
||||
{-# LANGUAGE DataKinds, DeriveAnyClass, RankNTypes, TupleSections, TypeOperators #-}
|
||||
module Language.Go.Assignment
|
||||
( assignment
|
||||
, Syntax
|
||||
, Grammar
|
||||
, Term
|
||||
) where
|
||||
|
||||
import Assigning.Assignment hiding (Assignment, Error)
|
||||
import qualified Assigning.Assignment as Assignment
|
||||
import Data.Functor (void)
|
||||
import Data.List.NonEmpty (some1)
|
||||
import Data.Record
|
||||
import Data.Syntax (contextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm1)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Expression as Expression
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import qualified Data.Term as Term
|
||||
import Data.Union
|
||||
import GHC.Stack
|
||||
import Language.Go.Grammar as Grammar
|
||||
import Language.Go.Syntax as Go.Syntax
|
||||
import Language.Go.Type as Go.Type
|
||||
|
||||
type Syntax =
|
||||
'[ Comment.Comment
|
||||
, Declaration.Constructor
|
||||
, Declaration.Function
|
||||
, Declaration.Import
|
||||
, Declaration.Method
|
||||
, Declaration.MethodSignature
|
||||
, Declaration.Module
|
||||
, Declaration.Type
|
||||
, Declaration.TypeAlias
|
||||
, Expression.Arithmetic
|
||||
, Expression.Bitwise
|
||||
, Expression.Boolean
|
||||
, Expression.Call
|
||||
, Expression.Comparison
|
||||
, Expression.Subscript
|
||||
, Statement.PostDecrement
|
||||
, Statement.PostIncrement
|
||||
, Expression.MemberAccess
|
||||
, Go.Syntax.Composite
|
||||
, Go.Syntax.DefaultPattern
|
||||
, Go.Syntax.Defer
|
||||
, Go.Syntax.Field
|
||||
, Go.Syntax.Go
|
||||
, Go.Syntax.Label
|
||||
, Go.Syntax.Receive
|
||||
, Go.Syntax.ReceiveOperator
|
||||
, Go.Syntax.Rune
|
||||
, Go.Syntax.Select
|
||||
, Go.Syntax.Send
|
||||
, Go.Syntax.Slice
|
||||
, Go.Syntax.TypeAssertion
|
||||
, Go.Syntax.TypeConversion
|
||||
, Go.Syntax.TypeSwitch
|
||||
, Go.Syntax.TypeSwitchGuard
|
||||
, Go.Syntax.Variadic
|
||||
, Go.Type.BidirectionalChannel
|
||||
, Go.Type.ReceiveChannel
|
||||
, Go.Type.SendChannel
|
||||
, Literal.Array
|
||||
, Literal.Complex
|
||||
, Literal.Float
|
||||
, Literal.Hash
|
||||
, Literal.Integer
|
||||
, Literal.KeyValue
|
||||
, Literal.Pointer
|
||||
, Literal.Reference
|
||||
, Literal.TextElement
|
||||
, Statement.Assignment
|
||||
, Statement.Break
|
||||
, Statement.Continue
|
||||
, Statement.For
|
||||
, Statement.ForEach
|
||||
, Statement.Goto
|
||||
, Statement.If
|
||||
, Statement.Match
|
||||
, Statement.NoOp
|
||||
, Statement.Pattern
|
||||
, Statement.Return
|
||||
, Syntax.Context
|
||||
, Syntax.Error
|
||||
, Syntax.Empty
|
||||
, Syntax.Identifier
|
||||
, Syntax.Program
|
||||
, Type.Annotation
|
||||
, Type.Array
|
||||
, Type.Function
|
||||
, Type.Interface
|
||||
, Type.Map
|
||||
, Type.Parenthesized
|
||||
, Type.Pointer
|
||||
, Type.Slice
|
||||
, []
|
||||
]
|
||||
|
||||
type Term = Term.Term (Union Syntax) (Record Location)
|
||||
type Assignment = HasCallStack => Assignment.Assignment [] Grammar Term
|
||||
|
||||
|
||||
-- | Assignment from AST in Go's grammar onto a program in Go's syntax.
|
||||
assignment :: Assignment
|
||||
assignment = handleError program <|> parseError
|
||||
|
||||
program :: Assignment
|
||||
program = makeTerm <$> symbol SourceFile <*> children (Syntax.Program <$> manyTerm expression)
|
||||
|
||||
expression :: Assignment
|
||||
expression = term (handleError (choice expressionChoices))
|
||||
|
||||
expressionChoices :: [Assignment.Assignment [] Grammar Term]
|
||||
expressionChoices =
|
||||
[ assignment'
|
||||
, binaryExpression
|
||||
, block
|
||||
, breakStatement
|
||||
, callExpression
|
||||
, communicationClause
|
||||
, compositeLiteral
|
||||
, continueStatement
|
||||
, varDeclaration
|
||||
, varSpecification
|
||||
, decStatement
|
||||
, defaultCase
|
||||
, deferStatement
|
||||
, element
|
||||
, elseClause
|
||||
, emptyStatement
|
||||
, expressionCaseClause
|
||||
, expressionList
|
||||
, expressionSwitchStatement
|
||||
, fallThroughStatement
|
||||
, fieldDeclaration
|
||||
, fieldIdentifier
|
||||
, floatLiteral
|
||||
, forStatement
|
||||
, functionDeclaration
|
||||
, goStatement
|
||||
, gotoStatement
|
||||
, ifInitializer
|
||||
, ifStatement
|
||||
, imaginaryLiteral
|
||||
, incStatement
|
||||
, identifier
|
||||
, importDeclaration
|
||||
, importSpec
|
||||
, indexExpression
|
||||
, interpretedStringLiteral
|
||||
, intLiteral
|
||||
, keyedElement
|
||||
, labelName
|
||||
, labeledStatement
|
||||
, literalValue
|
||||
, methodDeclaration
|
||||
, methodSpec
|
||||
, packageClause
|
||||
, packageIdentifier
|
||||
, parameterDeclaration
|
||||
, parameters
|
||||
, parenthesizedExpression
|
||||
, rawStringLiteral
|
||||
, receiveStatement
|
||||
, returnStatement
|
||||
, runeLiteral
|
||||
, selectStatement
|
||||
, selectorExpression
|
||||
, sendStatement
|
||||
, shortVarDeclaration
|
||||
, sliceExpression
|
||||
, unaryExpression
|
||||
, variadicArgument
|
||||
, variadicParameterDeclaration
|
||||
, types
|
||||
]
|
||||
|
||||
types :: Assignment
|
||||
types =
|
||||
choice [ arrayType
|
||||
, channelType
|
||||
, functionType
|
||||
, implicitLengthArrayType
|
||||
, interfaceType
|
||||
, mapType
|
||||
, parenthesizedType
|
||||
, pointerType
|
||||
, qualifiedType
|
||||
, sliceType
|
||||
, structType
|
||||
, typeAssertion
|
||||
, typeConversion
|
||||
, typeDeclaration
|
||||
, typeIdentifier
|
||||
, typeCase
|
||||
, typeCaseClause
|
||||
, typeSwitchGuard
|
||||
, typeSwitchStatement
|
||||
]
|
||||
|
||||
identifiers :: Assignment
|
||||
identifiers = mk <$> location <*> manyTerm identifier
|
||||
where
|
||||
mk _ [a] = a
|
||||
mk loc children = makeTerm loc children
|
||||
|
||||
expressions :: Assignment
|
||||
expressions = mk <$> location <*> manyTerm expression
|
||||
where
|
||||
mk _ [a] = a
|
||||
mk loc children = makeTerm loc children
|
||||
|
||||
|
||||
-- Literals
|
||||
|
||||
comment :: Assignment
|
||||
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
|
||||
|
||||
compositeLiteral :: Assignment
|
||||
compositeLiteral = makeTerm <$> symbol CompositeLiteral <*> children (Go.Syntax.Composite <$> expression <*> expression)
|
||||
|
||||
element :: Assignment
|
||||
element = symbol Element *> children expression
|
||||
|
||||
fieldIdentifier :: Assignment
|
||||
fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier <$> source)
|
||||
|
||||
floatLiteral :: Assignment
|
||||
floatLiteral = makeTerm <$> symbol FloatLiteral <*> (Literal.Float <$> source)
|
||||
|
||||
identifier :: Assignment
|
||||
identifier = makeTerm <$> (symbol Identifier <|> symbol Identifier') <*> (Syntax.Identifier <$> source)
|
||||
|
||||
imaginaryLiteral :: Assignment
|
||||
imaginaryLiteral = makeTerm <$> symbol ImaginaryLiteral <*> (Literal.Complex <$> source)
|
||||
|
||||
interpretedStringLiteral :: Assignment
|
||||
interpretedStringLiteral = makeTerm <$> symbol InterpretedStringLiteral <*> (Literal.TextElement <$> source)
|
||||
|
||||
intLiteral :: Assignment
|
||||
intLiteral = makeTerm <$> symbol IntLiteral <*> (Literal.Integer <$> source)
|
||||
|
||||
literalValue :: Assignment
|
||||
literalValue = makeTerm <$> symbol LiteralValue <*> children (manyTerm expression)
|
||||
|
||||
packageIdentifier :: Assignment
|
||||
packageIdentifier = makeTerm <$> symbol PackageIdentifier <*> (Syntax.Identifier <$> source)
|
||||
|
||||
parenthesizedType :: Assignment
|
||||
parenthesizedType = makeTerm <$> symbol Grammar.ParenthesizedType <*> children (Type.Parenthesized <$> expression)
|
||||
|
||||
rawStringLiteral :: Assignment
|
||||
rawStringLiteral = makeTerm <$> symbol RawStringLiteral <*> (Literal.TextElement <$> source)
|
||||
|
||||
runeLiteral :: Assignment
|
||||
runeLiteral = makeTerm <$> symbol Grammar.RuneLiteral <*> (Go.Syntax.Rune <$> source)
|
||||
|
||||
typeIdentifier :: Assignment
|
||||
typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier <$> source)
|
||||
|
||||
|
||||
-- Primitive Types
|
||||
|
||||
arrayType :: Assignment
|
||||
arrayType = makeTerm <$> symbol ArrayType <*> children (Type.Array . Just <$> expression <*> expression)
|
||||
|
||||
channelType :: Assignment
|
||||
channelType = makeTerm' <$> symbol ChannelType <*> children (mkChannelType <$> optional (token AnonLAngleMinus) <* token AnonChan <*> optional (token AnonLAngleMinus) <*> expression)
|
||||
where
|
||||
mkChannelType :: Maybe a -> Maybe a -> b -> Union Syntax b
|
||||
mkChannelType receive send | Just _ <- receive = inj . Go.Type.ReceiveChannel
|
||||
| Just _ <- send = inj . Go.Type.SendChannel
|
||||
| otherwise = inj . Go.Type.BidirectionalChannel
|
||||
|
||||
fieldDeclaration :: Assignment
|
||||
fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> (manyTermsTill expression (void (symbol TypeIdentifier)) <|> (manyTerm expression)) <*> optional expression <*> optional expression)
|
||||
where
|
||||
mkFieldDeclarationWithTag loc (fields, type', tag) | Just ty <- type', Just tag' <- tag = makeTerm loc (Go.Syntax.Field [ty, tag'] (makeTerm loc fields))
|
||||
| Just ty <- type' = makeTerm loc (Go.Syntax.Field [ty] (makeTerm loc fields))
|
||||
| Just tag' <- tag = makeTerm loc (Go.Syntax.Field [tag'] (makeTerm loc fields))
|
||||
| otherwise = makeTerm loc (Go.Syntax.Field [] (makeTerm loc fields))
|
||||
|
||||
functionType :: Assignment
|
||||
functionType = makeTerm <$> symbol FunctionType <*> children (Type.Function <$> manyTerm parameters <*> (expression <|> emptyTerm))
|
||||
|
||||
implicitLengthArrayType :: Assignment
|
||||
implicitLengthArrayType = makeTerm <$> symbol ImplicitLengthArrayType <*> children (Type.Array Nothing <$> expression)
|
||||
|
||||
interfaceType :: Assignment
|
||||
interfaceType = makeTerm <$> symbol InterfaceType <*> children (Type.Interface <$> manyTerm expression)
|
||||
|
||||
mapType :: Assignment
|
||||
mapType = makeTerm <$> symbol MapType <*> children (Type.Map <$> expression <*> expression)
|
||||
|
||||
pointerType :: Assignment
|
||||
pointerType = makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression)
|
||||
|
||||
qualifiedType :: Assignment
|
||||
qualifiedType = makeTerm <$> symbol QualifiedType <*> children (Expression.MemberAccess <$> expression <*> expression)
|
||||
|
||||
sliceType :: Assignment
|
||||
sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression)
|
||||
|
||||
structType :: Assignment
|
||||
structType = makeTerm <$> symbol StructType <*> children (Declaration.Constructor <$> emptyTerm <*> manyTerm expression)
|
||||
|
||||
typeAlias :: Assignment
|
||||
typeAlias = makeTerm <$> symbol TypeAlias <*> children (Declaration.TypeAlias [] <$> expression <*> expression)
|
||||
|
||||
typeDeclaration :: Assignment
|
||||
typeDeclaration = makeTerm <$> symbol TypeDeclaration <*> children (manyTerm ( (makeTerm <$> symbol TypeSpec <*> children (Declaration.Type <$> typeIdentifier <*> expression))
|
||||
<|> typeAlias ))
|
||||
|
||||
|
||||
|
||||
-- Expressions
|
||||
|
||||
binaryExpression :: Assignment
|
||||
binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression
|
||||
[ (inj .) . Expression.Plus <$ symbol AnonPlus
|
||||
, (inj .) . Expression.Minus <$ symbol AnonMinus
|
||||
, (inj .) . Expression.Times <$ symbol AnonStar
|
||||
, (inj .) . Expression.DividedBy <$ symbol AnonSlash
|
||||
, (inj .) . Expression.Modulo <$ symbol AnonPercent
|
||||
, (inj .) . Expression.Or <$ symbol AnonPipePipe
|
||||
, (inj .) . Expression.And <$ symbol AnonAmpersandAmpersand
|
||||
, (inj .) . Expression.LessThan <$ symbol AnonLAngle
|
||||
, (inj .) . Expression.LessThanEqual <$ symbol AnonLAngleEqual
|
||||
, (inj .) . Expression.GreaterThan <$ symbol AnonRAngle
|
||||
, (inj .) . Expression.GreaterThanEqual <$ symbol AnonRAngleEqual
|
||||
, (inj .) . invert Expression.Equal <$ symbol AnonBangEqual
|
||||
, (inj .) . Expression.Equal <$ symbol AnonEqualEqual
|
||||
, (inj .) . Expression.BOr <$ symbol AnonPipe
|
||||
, (inj .) . Expression.BAnd <$ symbol AnonAmpersand
|
||||
, (inj .) . Expression.BAnd <$ symbol AnonAmpersandCaret
|
||||
, (inj .) . Expression.BXOr <$ symbol AnonCaret
|
||||
, (inj .) . Expression.LShift <$ symbol AnonLAngleLAngle
|
||||
, (inj .) . Expression.RShift <$ symbol AnonRAngleRAngle
|
||||
])
|
||||
where
|
||||
invert cons a b = Expression.Not (makeTerm1 (cons a b))
|
||||
|
||||
block :: Assignment
|
||||
block = symbol Block *> children expressions
|
||||
|
||||
defaultCase :: Assignment
|
||||
defaultCase = makeTerm <$> symbol DefaultCase <*> children (Go.Syntax.DefaultPattern <$> (expressions <|> emptyTerm))
|
||||
|
||||
defaultExpressionCase :: Assignment
|
||||
defaultExpressionCase = makeTerm <$> symbol DefaultCase <*> (Go.Syntax.DefaultPattern <$ source <*> (expressions <|> emptyTerm))
|
||||
|
||||
callExpression :: Assignment
|
||||
callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> expression <*> manyTerm expression <*> emptyTerm)
|
||||
|
||||
expressionCase :: Assignment
|
||||
expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions)
|
||||
|
||||
expressionCaseClause :: Assignment
|
||||
expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultExpressionCase)
|
||||
|
||||
expressionList :: Assignment
|
||||
expressionList = symbol ExpressionList *> children expressions
|
||||
|
||||
expressionSwitchStatement :: Assignment
|
||||
expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> children (Statement.Match <$> (makeTerm <$> location <*> manyTermsTill expression (void (symbol ExpressionCaseClause)) <|> emptyTerm) <*> expressions)
|
||||
|
||||
fallThroughStatement :: Assignment
|
||||
fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier <$> source)) <*> emptyTerm)
|
||||
|
||||
functionDeclaration :: Assignment
|
||||
functionDeclaration = makeTerm <$> (symbol FunctionDeclaration <|> symbol FuncLiteral) <*> children (mkFunctionDeclaration <$> name <*> manyTerm parameters <*> (types <|> identifier <|> returnParameters <|> emptyTerm) <*> (block <|> emptyTerm))
|
||||
where
|
||||
mkFunctionDeclaration name' params' types' block' = Declaration.Function [types'] name' params' block'
|
||||
returnParameters = makeTerm <$> symbol Parameters <*> children (manyTerm expression)
|
||||
name = makeTerm <$> location <*> manyTermsTill expression (void (symbol Parameters))
|
||||
|
||||
importDeclaration :: Assignment
|
||||
importDeclaration = makeTerm <$> symbol ImportDeclaration <*> children (Declaration.Import <$> manyTerm expression)
|
||||
|
||||
importSpec :: Assignment
|
||||
importSpec = symbol ImportSpec *> children expressions
|
||||
|
||||
indexExpression :: Assignment
|
||||
indexExpression = makeTerm <$> symbol IndexExpression <*> children (Expression.Subscript <$> expression <*> manyTerm expression)
|
||||
|
||||
methodDeclaration :: Assignment
|
||||
methodDeclaration = makeTerm <$> symbol MethodDeclaration <*> children (mkTypedMethodDeclaration <$> receiver <*> fieldIdentifier <*> manyTerm parameters <*> ((makeTerm <$> location <*> (manyTermsTill expression (void (symbol Block)))) <|> emptyTerm) <*> (block <|> emptyTerm))
|
||||
where
|
||||
receiver = symbol Parameters *> children ((symbol ParameterDeclaration *> children expressions) <|> expressions)
|
||||
mkTypedMethodDeclaration receiver' name' parameters' type'' body' = Declaration.Method [type''] receiver' name' parameters' body'
|
||||
|
||||
methodSpec :: Assignment
|
||||
methodSpec = makeTerm <$> symbol MethodSpec <*> children (mkMethodSpec <$> expression <*> parameters <*> expression)
|
||||
where
|
||||
mkMethodSpec name' params optionalTypeLiteral = Declaration.MethodSignature [optionalTypeLiteral] name' [params]
|
||||
|
||||
packageClause :: Assignment
|
||||
packageClause = makeTerm <$> symbol PackageClause <*> children (Declaration.Module <$> expression <*> pure [])
|
||||
|
||||
parameters :: Assignment
|
||||
parameters = symbol Parameters *> children expressions
|
||||
|
||||
parameterDeclaration :: Assignment
|
||||
parameterDeclaration = makeTerm <$> symbol ParameterDeclaration <*> children (manyTerm expression)
|
||||
|
||||
parenthesizedExpression :: Assignment
|
||||
parenthesizedExpression = symbol ParenthesizedExpression *> children expressions
|
||||
|
||||
selectorExpression :: Assignment
|
||||
selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> expression)
|
||||
|
||||
sliceExpression :: Assignment
|
||||
sliceExpression = makeTerm <$> symbol SliceExpression <*> children (Go.Syntax.Slice <$> expression <* token AnonLBracket <*> (emptyTerm <|> expression) <* token AnonColon <*> (expression <|> emptyTerm) <* optional (token AnonColon) <*> (expression <|> emptyTerm))
|
||||
|
||||
typeAssertion :: Assignment
|
||||
typeAssertion = makeTerm <$> symbol TypeAssertionExpression <*> children (Go.Syntax.TypeAssertion <$> expression <*> expression)
|
||||
|
||||
typeCase :: Assignment
|
||||
typeCase = symbol TypeCase *> children expressions
|
||||
|
||||
typeCaseClause :: Assignment
|
||||
typeCaseClause = makeTerm <$> symbol TypeCaseClause <*> children (Statement.Pattern <$> expression <*> expressions)
|
||||
|
||||
typeConversion :: Assignment
|
||||
typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.Syntax.TypeConversion <$> expression <*> expression)
|
||||
|
||||
typeSwitchGuard :: Assignment
|
||||
typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expressions)
|
||||
|
||||
typeSwitchStatement :: Assignment
|
||||
typeSwitchStatement = makeTerm <$> symbol TypeSwitchStatement <*> children (Go.Syntax.TypeSwitch <$> typeSwitchSubject <*> expressions)
|
||||
where
|
||||
typeSwitchSubject = makeTerm <$> location <*> manyTermsTill expression (void (symbol TypeCaseClause)) <|> emptyTerm
|
||||
|
||||
unaryExpression :: Assignment
|
||||
unaryExpression = makeTerm' <$> symbol UnaryExpression <*> ( notExpression
|
||||
<|> unaryMinus
|
||||
<|> unaryAmpersand
|
||||
<|> unaryReceive
|
||||
<|> unaryPointer
|
||||
<|> unaryComplement
|
||||
<|> unaryPlus )
|
||||
where
|
||||
notExpression = inj <$> (children (Expression.Not <$ symbol AnonBang <*> expression))
|
||||
unaryAmpersand = inj <$> (children (Literal.Reference <$ symbol AnonAmpersand <*> expression))
|
||||
unaryComplement = inj <$> (children (Expression.Complement <$ symbol AnonCaret <*> expression))
|
||||
unaryMinus = inj <$> (children (Expression.Negate <$ symbol AnonMinus <*> expression))
|
||||
unaryPlus = children (symbol AnonPlus *> (Term.termOut <$> expression))
|
||||
unaryPointer = inj <$> (children (Literal.Pointer <$ symbol AnonStar <*> expression))
|
||||
unaryReceive = inj <$> (children (Go.Syntax.ReceiveOperator <$ symbol AnonLAngleMinus <*> expression))
|
||||
|
||||
varDeclaration :: Assignment
|
||||
varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions
|
||||
|
||||
variadicArgument :: Assignment
|
||||
variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression)
|
||||
|
||||
variadicParameterDeclaration :: Assignment
|
||||
variadicParameterDeclaration = makeTerm <$> symbol VariadicParameterDeclaration <*> children (flip Go.Syntax.Variadic <$> (expression <|> emptyTerm) <* token AnonDotDotDot <*> many expression)
|
||||
|
||||
varSpecification :: Assignment
|
||||
varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment <$> pure [] <*> (annotatedLHS <|> identifiers) <*> expressions)
|
||||
where
|
||||
annotatedLHS = makeTerm <$> location <*> (Type.Annotation <$> (makeTerm <$> location <*> (manyTermsTill identifier (void (symbol TypeIdentifier)))) <*> expression)
|
||||
|
||||
|
||||
-- Statements
|
||||
|
||||
assignment' :: Assignment
|
||||
assignment' = makeTerm' <$> symbol AssignmentStatement <*> children (infixTerm expressionList expressionList
|
||||
[ assign <$ symbol AnonEqual
|
||||
, augmentedAssign Expression.Plus <$ symbol AnonPlusEqual
|
||||
, augmentedAssign Expression.Minus <$ symbol AnonMinusEqual
|
||||
, augmentedAssign Expression.Times <$ symbol AnonStarEqual
|
||||
, augmentedAssign Expression.DividedBy <$ symbol AnonSlashEqual
|
||||
, augmentedAssign Expression.BOr <$ symbol AnonPipeEqual
|
||||
, augmentedAssign Expression.BAnd <$ symbol AnonAmpersandEqual
|
||||
, augmentedAssign Expression.Modulo <$ symbol AnonPercentEqual
|
||||
, augmentedAssign Expression.RShift <$ symbol AnonRAngleRAngleEqual
|
||||
, augmentedAssign Expression.LShift <$ symbol AnonLAngleLAngleEqual
|
||||
, augmentedAssign Expression.BXOr <$ symbol AnonCaretEqual
|
||||
, augmentedAssign (invert Expression.BAnd) <$ symbol AnonAmpersandCaretEqual
|
||||
])
|
||||
where
|
||||
assign :: Term -> Term -> Union Syntax Term
|
||||
assign l r = inj (Statement.Assignment [] l r)
|
||||
|
||||
augmentedAssign :: f :< Syntax => (Term -> Term -> f Term) -> Term -> Term -> Union Syntax Term
|
||||
augmentedAssign c l r = assign l (makeTerm1 (c l r))
|
||||
|
||||
invert cons a b = Expression.Not (makeTerm1 (cons a b))
|
||||
|
||||
breakStatement :: Assignment
|
||||
breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (expression <|> emptyTerm))
|
||||
|
||||
communicationClause :: Assignment
|
||||
communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Statement.Pattern <$> (communicationCase <|> expression) <*> expressions)
|
||||
where
|
||||
communicationCase = symbol CommunicationCase *> children expression
|
||||
|
||||
continueStatement :: Assignment
|
||||
continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (expression <|> emptyTerm))
|
||||
|
||||
decStatement :: Assignment
|
||||
decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression)
|
||||
|
||||
deferStatement :: Assignment
|
||||
deferStatement = makeTerm <$> symbol DeferStatement <*> children (Go.Syntax.Defer <$> expression)
|
||||
|
||||
elseClause :: Assignment
|
||||
elseClause = symbol ElseClause *> children expression
|
||||
|
||||
emptyStatement :: Assignment
|
||||
emptyStatement = makeTerm <$> token EmptyStatement <*> (Statement.NoOp <$> emptyTerm)
|
||||
|
||||
forStatement :: Assignment
|
||||
forStatement = makeTerm' <$> symbol ForStatement <*> children (forClause <|> forSimpleClause <|> rangeClause)
|
||||
where
|
||||
forClause = inj <$> (symbol ForClause *> children (Statement.For <$> (expression <|> emptyTerm) <*> (expression <|> emptyTerm) <*> (expression <|> emptyTerm)) <*> expression)
|
||||
forSimpleClause = inj <$> (Statement.For <$> emptyTerm <*> (expression <|> emptyTerm) <*> emptyTerm <*> expression)
|
||||
rangeClause = inj <$> (symbol RangeClause *> children (Statement.ForEach <$> (expression <|> emptyTerm) <*> expression) <*> expression)
|
||||
|
||||
goStatement :: Assignment
|
||||
goStatement = makeTerm <$> symbol GoStatement <*> children (Go.Syntax.Go <$> expression)
|
||||
|
||||
gotoStatement :: Assignment
|
||||
gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression)
|
||||
|
||||
ifStatement :: Assignment
|
||||
ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> (makeTerm <$> location <*> manyTermsTill expression (void (symbol Block))) <*> expression <*> (expression <|> emptyTerm))
|
||||
|
||||
ifInitializer :: Assignment
|
||||
ifInitializer = symbol IfInitializer *> children expression
|
||||
|
||||
incStatement :: Assignment
|
||||
incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression)
|
||||
|
||||
keyedElement :: Assignment
|
||||
keyedElement = makeTerm <$> symbol KeyedElement <*> children (Literal.KeyValue <$> expression <*> expression)
|
||||
|
||||
labelName :: Assignment
|
||||
labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source)
|
||||
|
||||
labeledStatement :: Assignment
|
||||
labeledStatement = makeTerm <$> (symbol LabeledStatement <|> symbol LabeledStatement') <*> children (Go.Syntax.Label <$> expression <*> (expression <|> emptyTerm))
|
||||
|
||||
returnStatement :: Assignment
|
||||
returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (expression <|> emptyTerm))
|
||||
|
||||
receiveStatement :: Assignment
|
||||
receiveStatement = makeTerm <$> symbol ReceiveStatement <*> children (Go.Syntax.Receive <$> (expression <|> emptyTerm) <*> expression)
|
||||
|
||||
shortVarDeclaration :: Assignment
|
||||
shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression)
|
||||
|
||||
selectStatement :: Assignment
|
||||
selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions)
|
||||
|
||||
sendStatement :: Assignment
|
||||
sendStatement = makeTerm <$> symbol SendStatement <*> children (Go.Syntax.Send <$> expression <*> expression)
|
||||
|
||||
|
||||
-- Helpers
|
||||
|
||||
-- | Match infix terms separated by any of a list of operators, assigning any comments following each operand.
|
||||
infixTerm :: Assignment
|
||||
-> Assignment
|
||||
-> [Assignment.Assignment [] Grammar (Term -> Term -> Union Syntax Term)]
|
||||
-> Assignment.Assignment [] Grammar (Union Syntax Term)
|
||||
infixTerm = infixContext comment
|
||||
|
||||
-- | Match a series of terms or comments until a delimiter is matched
|
||||
manyTermsTill :: Show b
|
||||
=> Assignment.Assignment [] Grammar Term
|
||||
-> Assignment.Assignment [] Grammar b
|
||||
-> Assignment.Assignment [] Grammar [Term]
|
||||
manyTermsTill step end = manyTill (step <|> comment) end
|
||||
|
||||
-- | Match a term optionally preceded by comment(s), or a sequence of comments if the term is not present.
|
||||
manyTerm :: Assignment -> Assignment.Assignment [] Grammar [Term]
|
||||
manyTerm = many . term
|
||||
|
||||
-- | Match a term and contextualize any comments preceeding or proceeding the term.
|
||||
term :: Assignment -> Assignment
|
||||
term term' = contextualize comment term' <|> makeTerm1 <$> (Syntax.Context <$> some1 comment <*> emptyTerm)
|
13
src/Language/Go/Grammar.hs
Normal file
13
src/Language/Go/Grammar.hs
Normal file
@ -0,0 +1,13 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Language.Go.Grammar where
|
||||
|
||||
import Language.Haskell.TH
|
||||
import TreeSitter.Go
|
||||
import TreeSitter.Language
|
||||
|
||||
-- Regenerate template haskell code when these files change:
|
||||
addDependentFileRelative "../../../vendor/haskell-tree-sitter/languages/go/vendor/tree-sitter-go/src/parser.c"
|
||||
|
||||
-- | Statically-known rules corresponding to symbols in the grammar.
|
||||
-- v1 - bump this to regenerate
|
||||
mkSymbolDatatype (mkName "Grammar") tree_sitter_go
|
@ -1,9 +1,148 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Language.Go.Syntax where
|
||||
|
||||
import Language.Haskell.TH
|
||||
import TreeSitter.Go
|
||||
import TreeSitter.Language
|
||||
import Data.Align.Generic
|
||||
import Data.ByteString (ByteString)
|
||||
import Data.Functor.Classes.Eq.Generic
|
||||
import Data.Functor.Classes.Ord.Generic
|
||||
import Data.Functor.Classes.Show.Generic
|
||||
import Data.Mergeable
|
||||
import Diffing.Algorithm
|
||||
import GHC.Generics
|
||||
|
||||
-- | Statically-known rules corresponding to symbols in the grammar.
|
||||
mkSymbolDatatype (mkName "Grammar") tree_sitter_go
|
||||
|
||||
-- A composite literal in Go
|
||||
data Composite a = Composite { compositeType :: !a, compositeElement :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Composite where liftEq = genericLiftEq
|
||||
instance Ord1 Composite where liftCompare = genericLiftCompare
|
||||
instance Show1 Composite where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A default pattern in a Go select or switch statement (e.g. `switch { default: s() }`).
|
||||
newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 DefaultPattern where liftEq = genericLiftEq
|
||||
instance Ord1 DefaultPattern where liftCompare = genericLiftCompare
|
||||
instance Show1 DefaultPattern where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A defer statement in Go (e.g. `defer x()`).
|
||||
newtype Defer a = Defer { deferBody :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Defer where liftEq = genericLiftEq
|
||||
instance Ord1 Defer where liftCompare = genericLiftCompare
|
||||
instance Show1 Defer where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A go statement (i.e. go routine) in Go (e.g. `go x()`).
|
||||
newtype Go a = Go { goBody :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Go where liftEq = genericLiftEq
|
||||
instance Ord1 Go where liftCompare = genericLiftCompare
|
||||
instance Show1 Go where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A label statement in Go (e.g. `label:continue`).
|
||||
data Label a = Label { _labelName :: !a, labelStatement :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Label where liftEq = genericLiftEq
|
||||
instance Ord1 Label where liftCompare = genericLiftCompare
|
||||
instance Show1 Label where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A rune literal in Go (e.g. `'⌘'`).
|
||||
newtype Rune a = Rune { _runeLiteral :: ByteString }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Rune where liftEq = genericLiftEq
|
||||
instance Ord1 Rune where liftCompare = genericLiftCompare
|
||||
instance Show1 Rune where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A select statement in Go (e.g. `select { case x := <-c: x() }` where each case is a send or receive operation on channels).
|
||||
data Select a = Select { selectCases :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Select where liftEq = genericLiftEq
|
||||
instance Ord1 Select where liftCompare = genericLiftCompare
|
||||
instance Show1 Select where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A send statement in Go (e.g. `channel <- value`).
|
||||
data Send a = Send { sendReceiver :: !a, sendValue :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Send where liftEq = genericLiftEq
|
||||
instance Ord1 Send where liftCompare = genericLiftCompare
|
||||
instance Show1 Send where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A slice expression in Go (e.g. `a[1:4:3]` where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity).
|
||||
data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCapacity :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Slice where liftEq = genericLiftEq
|
||||
instance Ord1 Slice where liftCompare = genericLiftCompare
|
||||
instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A type switch statement in Go (e.g. `switch x.(type) { // cases }`).
|
||||
data TypeSwitch a = TypeSwitch { typeSwitchSubject :: !a, typeSwitchCases :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeSwitch where liftEq = genericLiftEq
|
||||
instance Ord1 TypeSwitch where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeSwitch where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A type switch guard statement in a Go type switch statement (e.g. `switch i := x.(type) { // cases}`).
|
||||
newtype TypeSwitchGuard a = TypeSwitchGuard { typeSwitchGuardSubject :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeSwitchGuard where liftEq = genericLiftEq
|
||||
instance Ord1 TypeSwitchGuard where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeSwitchGuard where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A receive statement in a Go select statement (e.g. `case value := <-channel` )
|
||||
data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Receive where liftEq = genericLiftEq
|
||||
instance Ord1 Receive where liftCompare = genericLiftCompare
|
||||
instance Show1 Receive where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A receive operator unary expression in Go (e.g. `<-channel` )
|
||||
data ReceiveOperator a = ReceiveOperator a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 ReceiveOperator where liftEq = genericLiftEq
|
||||
instance Ord1 ReceiveOperator where liftCompare = genericLiftCompare
|
||||
instance Show1 ReceiveOperator where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A field declaration in a Go struct type declaration.
|
||||
data Field a = Field { fieldContext :: ![a], fieldName :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Field where liftEq = genericLiftEq
|
||||
instance Ord1 Field where liftCompare = genericLiftCompare
|
||||
instance Show1 Field where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A type assertion in Go (e.g. `x.(T)` where the value of `x` is not nil and is of type `T`).
|
||||
data TypeAssertion a = TypeAssertion { typeAssertionSubject :: !a, typeAssertionType :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeAssertion where liftEq = genericLiftEq
|
||||
instance Ord1 TypeAssertion where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeAssertion where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A type conversion expression in Go (e.g. `T(x)` where `T` is a type and `x` is an expression that can be converted to type `T`).
|
||||
data TypeConversion a = TypeConversion { typeConversionType :: !a, typeConversionSubject :: !a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 TypeConversion where liftEq = genericLiftEq
|
||||
instance Ord1 TypeConversion where liftCompare = genericLiftCompare
|
||||
instance Show1 TypeConversion where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | Variadic arguments and parameters in Go (e.g. parameter: `param ...Type`, argument: `Type...`).
|
||||
data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Variadic where liftEq = genericLiftEq
|
||||
instance Ord1 Variadic where liftCompare = genericLiftCompare
|
||||
instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec
|
||||
|
34
src/Language/Go/Type.hs
Normal file
34
src/Language/Go/Type.hs
Normal file
@ -0,0 +1,34 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
module Language.Go.Type where
|
||||
|
||||
import Data.Align.Generic
|
||||
import Data.Functor.Classes.Eq.Generic
|
||||
import Data.Functor.Classes.Ord.Generic
|
||||
import Data.Functor.Classes.Show.Generic
|
||||
import Data.Mergeable
|
||||
import Diffing.Algorithm
|
||||
import GHC.Generics
|
||||
|
||||
-- | A Bidirectional channel in Go (e.g. `chan`).
|
||||
newtype BidirectionalChannel a = BidirectionalChannel a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 BidirectionalChannel where liftEq = genericLiftEq
|
||||
instance Ord1 BidirectionalChannel where liftCompare = genericLiftCompare
|
||||
instance Show1 BidirectionalChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A Receive channel in Go (e.g. `<-chan`).
|
||||
newtype ReceiveChannel a = ReceiveChannel a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 ReceiveChannel where liftEq = genericLiftEq
|
||||
instance Ord1 ReceiveChannel where liftCompare = genericLiftCompare
|
||||
instance Show1 ReceiveChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A Send channel in Go (e.g. `chan<-`).
|
||||
newtype SendChannel a = SendChannel a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 SendChannel where liftEq = genericLiftEq
|
||||
instance Ord1 SendChannel where liftCompare = genericLiftCompare
|
||||
instance Show1 SendChannel where liftShowsPrec = genericLiftShowsPrec
|
@ -33,10 +33,11 @@ type Syntax = '[
|
||||
, Declaration.Class
|
||||
, Declaration.Function
|
||||
, Declaration.Method
|
||||
, Declaration.MethodSignature
|
||||
, Declaration.InterfaceDeclaration
|
||||
, Declaration.PublicFieldDefinition
|
||||
, Declaration.VariableDeclaration
|
||||
, Declaration.TypeAliasDeclaration
|
||||
, Declaration.TypeAlias
|
||||
, Declaration.Import
|
||||
, Declaration.Module
|
||||
, Expression.Arithmetic
|
||||
@ -115,7 +116,6 @@ type Syntax = '[
|
||||
, TypeScript.Syntax.IndexTypeQuery
|
||||
, TypeScript.Syntax.ThisType
|
||||
, TypeScript.Syntax.ExistentialType
|
||||
, TypeScript.Syntax.MethodSignature
|
||||
, TypeScript.Syntax.AbstractMethodSignature
|
||||
, TypeScript.Syntax.IndexSignature
|
||||
, TypeScript.Syntax.ObjectType
|
||||
@ -428,7 +428,7 @@ indexSignature = makeTerm <$> symbol Grammar.IndexSignature <*> children (TypeSc
|
||||
|
||||
methodSignature :: Assignment
|
||||
methodSignature = makeMethodSignature <$> symbol Grammar.MethodSignature <*> children ((,,,) <$> (term accessibilityModifier' <|> emptyTerm) <*> (term readonly' <|> emptyTerm) <*> term propertyName <*> callSignatureParts)
|
||||
where makeMethodSignature loc (modifier, readonly, propertyName, (typeParams, params, annotation)) = makeTerm loc (TypeScript.Syntax.MethodSignature [modifier, readonly, typeParams, annotation] propertyName params)
|
||||
where makeMethodSignature loc (modifier, readonly, propertyName, (typeParams, params, annotation)) = makeTerm loc (Declaration.MethodSignature [modifier, readonly, typeParams, annotation] propertyName params)
|
||||
|
||||
formalParameters :: Assignment.Assignment [] Grammar [Term]
|
||||
formalParameters = symbol FormalParameters *> children (contextualize' <$> Assignment.manyThrough comment (postContextualize' <$> (concat <$> many ((\as b -> as ++ [b]) <$> manyTerm decorator <*> term parameter)) <*> many comment))
|
||||
@ -657,7 +657,7 @@ declaration = everything
|
||||
|
||||
typeAliasDeclaration :: Assignment
|
||||
typeAliasDeclaration = makeTypeAliasDecl <$> symbol Grammar.TypeAliasDeclaration <*> children ((,,) <$> term identifier <*> (term typeParameters <|> emptyTerm) <*> term ty)
|
||||
where makeTypeAliasDecl loc (identifier, typeParams, body) = makeTerm loc (Declaration.TypeAliasDeclaration [typeParams] identifier body)
|
||||
where makeTypeAliasDecl loc (identifier, typeParams, body) = makeTerm loc (Declaration.TypeAlias [typeParams] identifier body)
|
||||
|
||||
enumDeclaration :: Assignment
|
||||
enumDeclaration = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (TypeScript.Syntax.EnumDeclaration <$> term identifier <*> (symbol EnumBody *> children (manyTerm (propertyName <|> enumAssignment))))
|
||||
|
@ -335,13 +335,6 @@ instance Eq1 IndexSignature where liftEq = genericLiftEq
|
||||
instance Ord1 IndexSignature where liftCompare = genericLiftCompare
|
||||
instance Show1 IndexSignature where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data MethodSignature a = MethodSignature { _methodSignatureContext :: ![a], _methodSignatureName :: !a, _methodSignatureParameters :: ![a] }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 MethodSignature where liftEq = genericLiftEq
|
||||
instance Ord1 MethodSignature where liftCompare = genericLiftCompare
|
||||
instance Show1 MethodSignature where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data AbstractMethodSignature a = AbstractMethodSignature { _abstractMethodSignatureContext :: ![a], _abstractMethodSignatureName :: !a, _abstractMethodSignatureParameters :: ![a] }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
|
@ -7,6 +7,7 @@ module Parsing.Parser
|
||||
-- Syntax parsers
|
||||
, syntaxParserForLanguage
|
||||
-- À la carte parsers
|
||||
, goParser
|
||||
, jsonParser
|
||||
, markdownParser
|
||||
, pythonParser
|
||||
@ -27,6 +28,7 @@ import Data.Term
|
||||
import Data.Union
|
||||
import Foreign.Ptr
|
||||
import Info hiding (Empty, Go)
|
||||
import qualified Language.Go.Assignment as Go
|
||||
import qualified Language.JSON.Assignment as JSON
|
||||
import qualified Language.Markdown.Assignment as Markdown
|
||||
import qualified Language.Python.Assignment as Python
|
||||
@ -70,7 +72,8 @@ data SomeParser typeclasses ann where
|
||||
-- This can be used to perform operations uniformly over terms produced by blobs with different 'Language's, and which therefore have different types in general. For example, given some 'Blob', we can parse and 'show' the parsed & assigned 'Term' like so:
|
||||
--
|
||||
-- > case someParser (Proxy :: Proxy '[Show1]) (blobLanguage language) of { Just (SomeParser parser) -> runTask (parse parser blob) >>= putStrLn . show ; _ -> return () }
|
||||
someParser :: ( ApplyAll typeclasses (Union JSON.Syntax)
|
||||
someParser :: ( ApplyAll typeclasses (Union Go.Syntax)
|
||||
, ApplyAll typeclasses (Union JSON.Syntax)
|
||||
, ApplyAll typeclasses (Union Markdown.Syntax)
|
||||
, ApplyAll typeclasses (Union Python.Syntax)
|
||||
, ApplyAll typeclasses (Union Ruby.Syntax)
|
||||
@ -79,7 +82,7 @@ someParser :: ( ApplyAll typeclasses (Union JSON.Syntax)
|
||||
=> proxy typeclasses -- ^ A proxy for the list of typeclasses required, e.g. @(Proxy :: Proxy '[Show1])@.
|
||||
-> Language -- ^ The 'Language' to select.
|
||||
-> Maybe (SomeParser typeclasses (Record Location)) -- ^ 'Maybe' a 'SomeParser' abstracting the syntax type to be produced.
|
||||
someParser _ Go = Nothing
|
||||
someParser _ Go = Just (SomeParser goParser)
|
||||
someParser _ JavaScript = Just (SomeParser typescriptParser)
|
||||
someParser _ JSON = Just (SomeParser jsonParser)
|
||||
someParser _ JSX = Just (SomeParser typescriptParser)
|
||||
@ -99,6 +102,9 @@ syntaxParserForLanguage language = case language of
|
||||
TypeScript -> Just (TreeSitterParser tree_sitter_typescript)
|
||||
_ -> Nothing
|
||||
|
||||
goParser :: Parser Go.Term
|
||||
goParser = AssignmentParser (ASTParser tree_sitter_go) Go.assignment
|
||||
|
||||
rubyParser :: Parser Ruby.Term
|
||||
rubyParser = AssignmentParser (ASTParser tree_sitter_ruby) Ruby.assignment
|
||||
|
||||
|
@ -96,8 +96,7 @@ spec = parallel $ do
|
||||
|
||||
it "summarizes Go methods with receivers with special formatting" $ do
|
||||
sourceBlobs <- blobsForPaths (both "go/method-with-receiver.A.go" "go/method-with-receiver.B.go")
|
||||
let Just goParser = syntaxParserForLanguage Go
|
||||
diff <- runTask $ distributeFor sourceBlobs (\ blob -> parse goParser blob >>= decorate (syntaxDeclarationAlgebra blob)) >>= runBothWith (diffTermPair sourceBlobs diffSyntaxTerms)
|
||||
diff <- runTask $ diffWithParser goParser sourceBlobs
|
||||
diffTOC diff `shouldBe`
|
||||
[ TOCSummary "Method" "(*apiClient) CheckAuth" (sourceSpanBetween (3,1) (3,101)) "added" ]
|
||||
|
||||
|
2
test/fixtures/go/array-types.A.go
vendored
2
test/fixtures/go/array-types.A.go
vendored
@ -2,4 +2,6 @@ package main
|
||||
|
||||
func main() {
|
||||
type a [2+2]x
|
||||
type b [3][5]int
|
||||
type c [2][2][2]float64
|
||||
}
|
||||
|
2
test/fixtures/go/array-types.B.go
vendored
2
test/fixtures/go/array-types.B.go
vendored
@ -2,4 +2,6 @@ package main
|
||||
|
||||
func main() {
|
||||
type a [1+1]y
|
||||
type d [6][9]int
|
||||
type e [1][2][3]float64
|
||||
}
|
||||
|
52
test/fixtures/go/array-types.diffA-B.txt
vendored
52
test/fixtures/go/array-types.diffA-B.txt
vendored
@ -2,17 +2,43 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Identifier)
|
||||
(ArrayTy
|
||||
(RelationalOperator
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
(Other "+")
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) })
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))
|
||||
->(Identifier) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Identifier)))))
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Identifier)))))))))
|
||||
|
52
test/fixtures/go/array-types.diffB-A.txt
vendored
52
test/fixtures/go/array-types.diffB-A.txt
vendored
@ -2,17 +2,43 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Identifier)
|
||||
(ArrayTy
|
||||
(RelationalOperator
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
(Other "+")
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) })
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))
|
||||
->(Identifier) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Identifier)))))
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Identifier)))))))))
|
||||
|
42
test/fixtures/go/array-types.parseA.txt
vendored
42
test/fixtures/go/array-types.parseA.txt
vendored
@ -2,14 +2,34 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Identifier)
|
||||
(ArrayTy
|
||||
(RelationalOperator
|
||||
(NumberLiteral)
|
||||
(Other "+")
|
||||
(NumberLiteral))
|
||||
(Identifier))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Identifier))))
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))))))
|
||||
|
42
test/fixtures/go/array-types.parseB.txt
vendored
42
test/fixtures/go/array-types.parseB.txt
vendored
@ -2,14 +2,34 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Identifier)
|
||||
(ArrayTy
|
||||
(RelationalOperator
|
||||
(NumberLiteral)
|
||||
(Other "+")
|
||||
(NumberLiteral))
|
||||
(Identifier))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Plus
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Identifier))))
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Array
|
||||
(Integer)
|
||||
(Identifier)))))))))
|
||||
|
@ -2,18 +2,19 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Other "composite_literal"
|
||||
(ArrayTy
|
||||
(Identifier))
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })))))
|
||||
|
@ -2,18 +2,19 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Other "composite_literal"
|
||||
(ArrayTy
|
||||
(Identifier))
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) })))))
|
||||
|
@ -2,15 +2,16 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Other "composite_literal"
|
||||
(ArrayTy
|
||||
(Identifier))
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Integer))))))
|
||||
|
@ -2,15 +2,16 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Other "composite_literal"
|
||||
(ArrayTy
|
||||
(Identifier))
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Composite
|
||||
(Array
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Integer))))))
|
||||
|
8
test/fixtures/go/assignment-statements.A.go
vendored
8
test/fixtures/go/assignment-statements.A.go
vendored
@ -5,4 +5,12 @@ a = 1
|
||||
b, c += 2, 3
|
||||
d *= 3
|
||||
e += 1
|
||||
f <<= 1
|
||||
g >>= 2
|
||||
h /= 2
|
||||
i ^= 2
|
||||
j %= 2
|
||||
k &^= 2
|
||||
|
||||
var pointer *Point3D = &Point3D{y: 1000}
|
||||
}
|
||||
|
16
test/fixtures/go/assignment-statements.B.go
vendored
16
test/fixtures/go/assignment-statements.B.go
vendored
@ -1,8 +1,16 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
x = 1
|
||||
y, c += 2, 3
|
||||
z *= 3
|
||||
h += 1
|
||||
h = 1
|
||||
f, g += 2, 3
|
||||
e *= 3
|
||||
d += 1
|
||||
c <<= 1
|
||||
b >>= 2
|
||||
a /= 2
|
||||
z ^= 2
|
||||
y %= 2
|
||||
x &^= 2
|
||||
|
||||
var pointer *Point2D = &Point2D{x: 1000}
|
||||
}
|
||||
|
154
test/fixtures/go/assignment-statements.diffA-B.txt
vendored
154
test/fixtures/go/assignment-statements.diffA-B.txt
vendored
@ -2,31 +2,133 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))))
|
||||
(Integer))
|
||||
(Assignment
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Plus
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
(Integer)
|
||||
(Integer))))
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Times
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Plus
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(LShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(RShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(DividedBy
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(BXOr
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Modulo
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Not
|
||||
{+(BAnd
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(Pointer
|
||||
{+(Identifier)+})+}
|
||||
{+(Reference
|
||||
{+(Composite
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(KeyValue
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+})+})+})+})+}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Times
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Plus
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(LShift
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(RShift
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(DividedBy
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(BXOr
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Modulo
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Not
|
||||
{-(BAnd
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(
|
||||
{-(Pointer
|
||||
{-(Identifier)-})-}
|
||||
{-(Reference
|
||||
{-(Composite
|
||||
{-(Identifier)-}
|
||||
{-(
|
||||
{-(KeyValue
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-})-})-})-})-})))
|
||||
|
152
test/fixtures/go/assignment-statements.diffB-A.txt
vendored
152
test/fixtures/go/assignment-statements.diffB-A.txt
vendored
@ -2,31 +2,131 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))))
|
||||
(Integer))
|
||||
(Assignment
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Plus
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
(Integer)
|
||||
(Integer))))
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Times
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Times
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->(Plus
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}) })
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(LShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(RShift
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(DividedBy
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(BXOr
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Modulo
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Not
|
||||
{+(BAnd
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+})+}
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(Pointer
|
||||
{+(Identifier)+})+}
|
||||
{+(Reference
|
||||
{+(Composite
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(KeyValue
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+})+})+})+})+})+}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Plus
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(LShift
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(RShift
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(DividedBy
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(BXOr
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Modulo
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Not
|
||||
{-(BAnd
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-})-}
|
||||
{-(Assignment
|
||||
{-(Identifier)-}
|
||||
{-(
|
||||
{-(Pointer
|
||||
{-(Identifier)-})-}
|
||||
{-(Reference
|
||||
{-(Composite
|
||||
{-(Identifier)-}
|
||||
{-(
|
||||
{-(KeyValue
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-})-})-})-})-})-})))
|
||||
|
@ -2,27 +2,75 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))))
|
||||
(Integer))
|
||||
(Assignment
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Times
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Not
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(
|
||||
(Pointer
|
||||
(Identifier))
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Integer))))))))))
|
||||
|
@ -2,27 +2,75 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))))
|
||||
(Integer))
|
||||
(Assignment
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Plus
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Times
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Plus
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(LShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(RShift
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(DividedBy
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(BXOr
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Modulo
|
||||
(Identifier)
|
||||
(Integer)))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Not
|
||||
(BAnd
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(
|
||||
(Pointer
|
||||
(Identifier))
|
||||
(Reference
|
||||
(Composite
|
||||
(Identifier)
|
||||
(
|
||||
(KeyValue
|
||||
(Identifier)
|
||||
(Integer))))))))))
|
||||
|
26
test/fixtures/go/binary-expressions.A.go
vendored
Normal file
26
test/fixtures/go/binary-expressions.A.go
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
// comment 1
|
||||
a || // comment 2
|
||||
b
|
||||
// comment 3
|
||||
c && d
|
||||
e == f
|
||||
g != h
|
||||
i < j
|
||||
k <= l
|
||||
m > n
|
||||
o >= p
|
||||
q + r
|
||||
s - t
|
||||
u | v
|
||||
x ^ y
|
||||
z * aa
|
||||
bb / cc
|
||||
dd % ee
|
||||
ff << gg
|
||||
hh >> ii
|
||||
jj & kk
|
||||
ll &^ mm
|
||||
}
|
26
test/fixtures/go/binary-expressions.B.go
vendored
Normal file
26
test/fixtures/go/binary-expressions.B.go
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
// comment 1
|
||||
b || // comment 2
|
||||
c
|
||||
// comment 3
|
||||
d && c
|
||||
f == e
|
||||
h != g
|
||||
j < i
|
||||
l <= k
|
||||
n > m
|
||||
p >= o
|
||||
r + q
|
||||
t - s
|
||||
v | u
|
||||
y ^ x
|
||||
aa * z
|
||||
cc / bb
|
||||
ee % dd
|
||||
gg << ff
|
||||
ii >> hh
|
||||
kk & jj
|
||||
mm &^ ll
|
||||
}
|
129
test/fixtures/go/binary-expressions.diffA-B.txt
vendored
Normal file
129
test/fixtures/go/binary-expressions.diffA-B.txt
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Context
|
||||
(Comment)
|
||||
(Or
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Context
|
||||
(Comment)
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Context
|
||||
(Comment)
|
||||
(And
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (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)+})+}
|
||||
{-(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)-})-})))
|
129
test/fixtures/go/binary-expressions.diffB-A.txt
vendored
Normal file
129
test/fixtures/go/binary-expressions.diffB-A.txt
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Context
|
||||
(Comment)
|
||||
(Or
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Context
|
||||
(Comment)
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Context
|
||||
(Comment)
|
||||
(And
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (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)+})+}
|
||||
{-(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)-})-})))
|
73
test/fixtures/go/binary-expressions.parseA.txt
vendored
Normal file
73
test/fixtures/go/binary-expressions.parseA.txt
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(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)))))
|
73
test/fixtures/go/binary-expressions.parseB.txt
vendored
Normal file
73
test/fixtures/go/binary-expressions.parseB.txt
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(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)))))
|
42
test/fixtures/go/call-expressions.diffA-B.txt
vendored
42
test/fixtures/go/call-expressions.diffA-B.txt
vendored
@ -2,22 +2,28 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
42
test/fixtures/go/call-expressions.diffB-A.txt
vendored
42
test/fixtures/go/call-expressions.diffB-A.txt
vendored
@ -2,22 +2,28 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(FunctionCall
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Call
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
36
test/fixtures/go/call-expressions.parseA.txt
vendored
36
test/fixtures/go/call-expressions.parseA.txt
vendored
@ -2,19 +2,25 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
36
test/fixtures/go/call-expressions.parseB.txt
vendored
36
test/fixtures/go/call-expressions.parseB.txt
vendored
@ -2,19 +2,25 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "variadic_argument"
|
||||
(Identifier)))))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Variadic
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
9
test/fixtures/go/case-statements.B.go
vendored
9
test/fixtures/go/case-statements.B.go
vendored
@ -2,4 +2,13 @@ package main
|
||||
|
||||
func main() {
|
||||
switch { case foo: f1() }
|
||||
switch e {
|
||||
case 1, 2:
|
||||
a()
|
||||
b()
|
||||
fallthrough
|
||||
default:
|
||||
c()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
49
test/fixtures/go/case-statements.diffA-B.txt
vendored
49
test/fixtures/go/case-statements.diffA-B.txt
vendored
@ -2,12 +2,43 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Switch
|
||||
{+(Case
|
||||
{+(Case
|
||||
{+(Other "expression_list"
|
||||
{+(Identifier)+})+})+}
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+})+})))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
{ (Match
|
||||
{-(Empty)-}
|
||||
{-([])-})
|
||||
->(
|
||||
{+(Match
|
||||
{+([])+}
|
||||
{+(Pattern
|
||||
{+(Identifier)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+})+}
|
||||
{+(Match
|
||||
{+(
|
||||
{+(Identifier)+})+}
|
||||
{+(
|
||||
{+(Pattern
|
||||
{+(
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Pattern
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+})+}
|
||||
{+(DefaultPattern
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Break
|
||||
{+(Empty)+})+})+})+})+})+}) }))
|
||||
|
49
test/fixtures/go/case-statements.diffB-A.txt
vendored
49
test/fixtures/go/case-statements.diffB-A.txt
vendored
@ -2,12 +2,43 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Switch
|
||||
{-(Case
|
||||
{-(Case
|
||||
{-(Other "expression_list"
|
||||
{-(Identifier)-})-})-}
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-})-})))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
{ (
|
||||
{-(Match
|
||||
{-([])-}
|
||||
{-(Pattern
|
||||
{-(Identifier)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(Match
|
||||
{-(
|
||||
{-(Identifier)-})-}
|
||||
{-(
|
||||
{-(Pattern
|
||||
{-(
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Pattern
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(DefaultPattern
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Break
|
||||
{-(Empty)-})-})-})-})-})-})
|
||||
->(Match
|
||||
{+(Empty)+}
|
||||
{+([])+}) }))
|
||||
|
10
test/fixtures/go/case-statements.parseA.txt
vendored
10
test/fixtures/go/case-statements.parseA.txt
vendored
@ -2,6 +2,10 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Switch)))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Match
|
||||
(Empty)
|
||||
([]))))
|
||||
|
46
test/fixtures/go/case-statements.parseB.txt
vendored
46
test/fixtures/go/case-statements.parseB.txt
vendored
@ -2,12 +2,40 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Switch
|
||||
(Case
|
||||
(Case
|
||||
(Other "expression_list"
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Match
|
||||
([])
|
||||
(Pattern
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))))
|
||||
(Match
|
||||
(
|
||||
(Identifier))
|
||||
(
|
||||
(Pattern
|
||||
(
|
||||
(Integer)
|
||||
(Integer))
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Pattern
|
||||
(Identifier)
|
||||
(Empty))))
|
||||
(DefaultPattern
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty)))))))))
|
||||
|
2
test/fixtures/go/channel-types.A.go
vendored
2
test/fixtures/go/channel-types.A.go
vendored
@ -5,5 +5,7 @@ type (
|
||||
c1 chan<- chan int
|
||||
c2 chan<- chan<- struct{}
|
||||
c3 chan<- <-chan int
|
||||
c4 <-chan <-chan int
|
||||
c5 chan (<-chan int)
|
||||
)
|
||||
}
|
||||
|
2
test/fixtures/go/channel-types.B.go
vendored
2
test/fixtures/go/channel-types.B.go
vendored
@ -5,5 +5,7 @@ type (
|
||||
c2 chan<- chan string
|
||||
c3 chan<- chan<- struct{}
|
||||
c4 chan<- <-chan string
|
||||
c4 <-chan <-chan string
|
||||
c5 chan (<-chan string)
|
||||
)
|
||||
}
|
||||
|
44
test/fixtures/go/channel-types.diffA-B.txt
vendored
44
test/fixtures/go/channel-types.diffA-B.txt
vendored
@ -2,26 +2,42 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(TypeDecl
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(StructTy))))
|
||||
(TypeDecl
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)))))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))))
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))))
|
||||
|
44
test/fixtures/go/channel-types.diffB-A.txt
vendored
44
test/fixtures/go/channel-types.diffB-A.txt
vendored
@ -2,26 +2,42 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(TypeDecl
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(StructTy))))
|
||||
(TypeDecl
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)))))
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))))
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))))
|
||||
|
42
test/fixtures/go/channel-types.parseA.txt
vendored
42
test/fixtures/go/channel-types.parseA.txt
vendored
@ -2,21 +2,35 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(TypeDecl
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(StructTy))))
|
||||
(TypeDecl
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(Identifier)))))))
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
(Identifier))))))))
|
||||
|
42
test/fixtures/go/channel-types.parseB.txt
vendored
42
test/fixtures/go/channel-types.parseB.txt
vendored
@ -2,21 +2,35 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(BidirectionalChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(TypeDecl
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(StructTy))))
|
||||
(TypeDecl
|
||||
(SendChannel
|
||||
(SendChannel
|
||||
(Constructor
|
||||
(Empty)))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(ChannelTy
|
||||
(Identifier)))))))
|
||||
(SendChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(ReceiveChannel
|
||||
(ReceiveChannel
|
||||
(Identifier))))
|
||||
(Type
|
||||
(Identifier)
|
||||
(BidirectionalChannel
|
||||
(Parenthesized
|
||||
(ReceiveChannel
|
||||
(Identifier))))))))
|
||||
|
12
test/fixtures/go/comment.diffA-B.txt
vendored
12
test/fixtures/go/comment.diffA-B.txt
vendored
@ -2,7 +2,11 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
{ (Comment)
|
||||
->(Comment) }))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Context
|
||||
{ (Comment)
|
||||
->(Comment) }
|
||||
(Empty))))
|
||||
|
12
test/fixtures/go/comment.diffB-A.txt
vendored
12
test/fixtures/go/comment.diffB-A.txt
vendored
@ -2,7 +2,11 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
{ (Comment)
|
||||
->(Comment) }))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Context
|
||||
{ (Comment)
|
||||
->(Comment) }
|
||||
(Empty))))
|
||||
|
10
test/fixtures/go/comment.parseA.txt
vendored
10
test/fixtures/go/comment.parseA.txt
vendored
@ -2,6 +2,10 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Comment)))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))))
|
||||
|
10
test/fixtures/go/comment.parseB.txt
vendored
10
test/fixtures/go/comment.parseB.txt
vendored
@ -2,6 +2,10 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Comment)))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))))
|
||||
|
@ -2,16 +2,19 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
{+(Identifier)+}
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Annotation
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{+(Identifier)+})
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Other "expression_list"
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{+(NumberLiteral)+})))))
|
||||
->(Identifier) })
|
||||
{ (Integer)
|
||||
->(
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}) })))
|
||||
|
@ -2,17 +2,19 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Other "expression_list"
|
||||
{+(NumberLiteral)+})+}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Other "expression_list"
|
||||
{-(NumberLiteral)-}
|
||||
{-(NumberLiteral)-})-}))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Annotation
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{-(Identifier)-})
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{ (
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})
|
||||
->(Integer) })))
|
||||
|
@ -2,11 +2,13 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(NumberLiteral))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Annotation
|
||||
(
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
(Integer))))
|
||||
|
@ -2,13 +2,16 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Annotation
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))
|
||||
|
@ -2,16 +2,16 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
{ (VarAssignment
|
||||
{-(Identifier)-}
|
||||
{-(Other "expression_list"
|
||||
{-(NumberLiteral)-})-})
|
||||
->(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Other "expression_list"
|
||||
{+(NumberLiteral)+}
|
||||
{+(NumberLiteral)+})+}) })))
|
||||
{+(Identifier)+}) }
|
||||
{ (Integer)
|
||||
->(
|
||||
{+(Integer)+}
|
||||
{+(Integer)+}) })))
|
||||
|
@ -2,16 +2,16 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
{ (VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
{ (
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Other "expression_list"
|
||||
{-(NumberLiteral)-}
|
||||
{-(NumberLiteral)-})-})
|
||||
->(VarAssignment
|
||||
{+(Identifier)+}
|
||||
{+(Other "expression_list"
|
||||
{+(NumberLiteral)+})+}) })))
|
||||
{-(Identifier)-})
|
||||
->(Identifier) }
|
||||
{ (
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})
|
||||
->(Integer) })))
|
||||
|
@ -2,10 +2,10 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(NumberLiteral))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))))
|
||||
|
@ -2,12 +2,14 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral))))))
|
||||
(Identifier))
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))
|
||||
|
@ -2,17 +2,20 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Other "expression_list"
|
||||
(Identifier)))
|
||||
(VarAssignment
|
||||
(Identifier))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(VarAssignment
|
||||
->(Identifier) }
|
||||
([]))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
->(Identifier) }
|
||||
([])))))
|
||||
|
@ -2,17 +2,20 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Other "expression_list"
|
||||
(Identifier)))
|
||||
(VarAssignment
|
||||
(Identifier))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(VarAssignment
|
||||
->(Identifier) }
|
||||
([]))
|
||||
(Assignment
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
->(Identifier) }
|
||||
([])))))
|
||||
|
@ -2,14 +2,17 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Identifier)))
|
||||
(VarAssignment
|
||||
(Identifier))
|
||||
(VarAssignment
|
||||
(Identifier)))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
([]))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
([])))))
|
||||
|
@ -2,14 +2,17 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(Identifier)))
|
||||
(VarAssignment
|
||||
(Identifier))
|
||||
(VarAssignment
|
||||
(Identifier)))))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
([]))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
([])))))
|
||||
|
68
test/fixtures/go/constructors.diffA-B.txt
vendored
68
test/fixtures/go/constructors.diffA-B.txt
vendored
@ -2,35 +2,41 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Other "-")
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) })
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(DictionaryTy
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty)))))
|
||||
|
68
test/fixtures/go/constructors.diffB-A.txt
vendored
68
test/fixtures/go/constructors.diffB-A.txt
vendored
@ -2,35 +2,41 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Other "-")
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) }
|
||||
{ (NumberLiteral)
|
||||
->(NumberLiteral) })
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(DictionaryTy
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }))))
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
{ (Integer)
|
||||
->(Integer) }
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty)))))
|
||||
|
52
test/fixtures/go/constructors.parseA.txt
vendored
52
test/fixtures/go/constructors.parseA.txt
vendored
@ -2,28 +2,34 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier))
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Other "-")
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier))
|
||||
(NumberLiteral)
|
||||
(NumberLiteral))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(DictionaryTy
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
52
test/fixtures/go/constructors.parseB.txt
vendored
52
test/fixtures/go/constructors.parseB.txt
vendored
@ -2,28 +2,34 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier))
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Other "-")
|
||||
(Identifier)))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(ChannelTy
|
||||
(Identifier))
|
||||
(NumberLiteral)
|
||||
(NumberLiteral))
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(DictionaryTy
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Minus
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(SendChannel
|
||||
(Identifier))
|
||||
(Integer)
|
||||
(Integer)
|
||||
(Empty))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Map
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))))
|
||||
|
57
test/fixtures/go/float-literals.diffA-B.txt
vendored
57
test/fixtures/go/float-literals.diffA-B.txt
vendored
@ -2,35 +2,28 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) }))))
|
||||
|
57
test/fixtures/go/float-literals.diffB-A.txt
vendored
57
test/fixtures/go/float-literals.diffB-A.txt
vendored
@ -2,35 +2,28 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
{ (FloatLiteral)
|
||||
->(FloatLiteral) }))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) })
|
||||
(Assignment
|
||||
(Identifier)
|
||||
{ (Float)
|
||||
->(Float) }))))
|
||||
|
47
test/fixtures/go/float-literals.parseA.txt
vendored
47
test/fixtures/go/float-literals.parseA.txt
vendored
@ -2,30 +2,23 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float)))))
|
||||
|
47
test/fixtures/go/float-literals.parseB.txt
vendored
47
test/fixtures/go/float-literals.parseB.txt
vendored
@ -2,30 +2,23 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))
|
||||
(Assignment
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(FloatLiteral)))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float))
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Float)))))
|
||||
|
10
test/fixtures/go/for-statements.A.go
vendored
10
test/fixtures/go/for-statements.A.go
vendored
@ -21,4 +21,14 @@ for x := range y {
|
||||
a(x)
|
||||
break
|
||||
}
|
||||
for i, s := range a {
|
||||
g(i, s)
|
||||
}
|
||||
for key, val = range m {
|
||||
h(key, val)
|
||||
}
|
||||
for 1 < 2 {
|
||||
i()
|
||||
}
|
||||
for range ch {}
|
||||
}
|
||||
|
10
test/fixtures/go/for-statements.B.go
vendored
10
test/fixtures/go/for-statements.B.go
vendored
@ -21,4 +21,14 @@ for {
|
||||
a(x)
|
||||
break
|
||||
}
|
||||
for s, i := range b {
|
||||
g(i, s)
|
||||
}
|
||||
for k, v = range m {
|
||||
h(k, v)
|
||||
}
|
||||
for 2 < 1 {
|
||||
j()
|
||||
}
|
||||
for range b {}
|
||||
}
|
||||
|
231
test/fixtures/go/for-statements.diffA-B.txt
vendored
231
test/fixtures/go/for-statements.diffA-B.txt
vendored
@ -2,81 +2,170 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
{ (For
|
||||
{-(ExpressionStatements
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Other "goto_statement"
|
||||
{-(Identifier)-})-})-})
|
||||
->(For
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Other "goto_statement"
|
||||
{+(Identifier)+})+}) }
|
||||
{+(For
|
||||
{+(Other "expression_list"
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Break
|
||||
{+(Identifier)+})+})+}
|
||||
{+(For
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Continue
|
||||
{+(Identifier)+})+})+}
|
||||
{+(For
|
||||
{+(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
{+(ForEach
|
||||
{+(Identifier)+}
|
||||
{+(Other "<")+}
|
||||
{+(NumberLiteral)+})+}
|
||||
{+(IncrementStatement)+}
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Continue)+})+}
|
||||
{+(For
|
||||
{+(ExpressionStatements
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Break
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(For
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Continue
|
||||
{+(Identifier)+})+})+})+}
|
||||
(For
|
||||
{ (Assignment
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->(LessThan
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+}) }
|
||||
{ (LessThan
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})
|
||||
->(PostIncrement
|
||||
{+(Identifier)+}) }
|
||||
{ (PostIncrement
|
||||
{-(Identifier)-})
|
||||
->(Empty) }
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
{+(Continue
|
||||
{+(Empty)+})+}
|
||||
{-(Break
|
||||
{-(Identifier)-})-}))
|
||||
{+(For
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Break
|
||||
{+(Empty)+})+})+})+}
|
||||
{+(ForEach
|
||||
{+(
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Break)+})+})+}
|
||||
{-(For
|
||||
{-(VarDecl
|
||||
{-(Other "expression_list"
|
||||
{+(Identifier)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(ForEach
|
||||
{+(
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(For
|
||||
{+(Empty)+}
|
||||
{+(LessThan
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
{+(Empty)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(ForEach
|
||||
{+(Empty)+}
|
||||
{+(Identifier)+}
|
||||
{+([])+})+}
|
||||
{-(For
|
||||
{-(LessThan
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-}
|
||||
{-(PostIncrement
|
||||
{-(Identifier)-})-}
|
||||
{-(Other "expression_list"
|
||||
{-(NumberLiteral)-})-})-}
|
||||
{-(RelationalOperator
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Continue
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(For
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Continue
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(ForEach
|
||||
{-(Identifier)-}
|
||||
{-(Other "<")-}
|
||||
{-(NumberLiteral)-})-}
|
||||
{-(IncrementStatement)-}
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Break
|
||||
{-(Identifier)-})-})-}
|
||||
{-(For
|
||||
{-(RelationalOperator
|
||||
{-(Identifier)-}
|
||||
{-(Other "<")-}
|
||||
{-(NumberLiteral)-})-}
|
||||
{-(IncrementStatement)-}
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Continue
|
||||
{-(Identifier)-})-})-}
|
||||
{-(For
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Continue)-})-}
|
||||
{-(For
|
||||
{-(Other "expression_list"
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(FunctionCall
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Break
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(ForEach
|
||||
{-(
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Break)-})-}))
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(ForEach
|
||||
{-(
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(For
|
||||
{-(Empty)-}
|
||||
{-(LessThan
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Empty)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(ForEach
|
||||
{-(Empty)-}
|
||||
{-(Identifier)-}
|
||||
{-([])-})-})))
|
||||
|
225
test/fixtures/go/for-statements.diffB-A.txt
vendored
225
test/fixtures/go/for-statements.diffB-A.txt
vendored
@ -2,74 +2,167 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
{ (For
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Other "goto_statement"
|
||||
{-(Identifier)-})-})
|
||||
->(For
|
||||
{+(ExpressionStatements
|
||||
{+(FunctionCall
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
{+(For
|
||||
{+(Assignment
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+}
|
||||
{+(LessThan
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+}
|
||||
{+(PostIncrement
|
||||
{+(Identifier)+})+}
|
||||
{+(Other "goto_statement"
|
||||
{+(Identifier)+})+})+}) }
|
||||
{+(For
|
||||
{+(VarDecl
|
||||
{+(Other "expression_list"
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Break
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(For
|
||||
{+(LessThan
|
||||
{+(Identifier)+}
|
||||
{+(Integer)+})+}
|
||||
{+(PostIncrement
|
||||
{+(Identifier)+})+}
|
||||
{+(Other "expression_list"
|
||||
{+(NumberLiteral)+})+})+}
|
||||
{+(RelationalOperator
|
||||
{+(Identifier)+}
|
||||
{+(Other "<")+}
|
||||
{+(NumberLiteral)+})+}
|
||||
{+(IncrementStatement)+}
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Break
|
||||
{+(Identifier)+})+})+}
|
||||
{+(For
|
||||
{+(RelationalOperator
|
||||
{+(Identifier)+}
|
||||
{+(Other "<")+}
|
||||
{+(NumberLiteral)+})+}
|
||||
{+(IncrementStatement)+}
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Continue
|
||||
{+(Identifier)+})+})+}
|
||||
{+(For
|
||||
{+(FunctionCall
|
||||
{+(Identifier)+})+}
|
||||
{+(Continue)+})+}
|
||||
(For
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(FunctionCall
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Continue
|
||||
{+(Identifier)+})+})+})+}
|
||||
{+(For
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+}
|
||||
{+(Continue
|
||||
{+(Empty)+})+})+})+}
|
||||
(ForEach
|
||||
(Identifier)
|
||||
{+(Identifier)+})
|
||||
(Break
|
||||
{-(Identifier)-}))
|
||||
{-(For
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Continue
|
||||
{-(Identifier)-})-})-}
|
||||
{-(For
|
||||
{-(RelationalOperator
|
||||
{-(Identifier)-}
|
||||
{-(Other "<")-}
|
||||
{-(NumberLiteral)-})-}
|
||||
{-(IncrementStatement)-}
|
||||
{-(FunctionCall
|
||||
{-(Identifier)-})-}
|
||||
{-(Continue)-})-}
|
||||
{-(For
|
||||
{-(ExpressionStatements
|
||||
{-(FunctionCall
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
{+(Identifier)+}
|
||||
(Empty))
|
||||
(Break
|
||||
{ (Identifier)
|
||||
->(Empty) })))
|
||||
{+(ForEach
|
||||
{+(
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(ForEach
|
||||
{+(
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+})+}
|
||||
{+(Identifier)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(For
|
||||
{+(Empty)+}
|
||||
{+(LessThan
|
||||
{+(Integer)+}
|
||||
{+(Integer)+})+}
|
||||
{+(Empty)+}
|
||||
{+(Call
|
||||
{+(Identifier)+}
|
||||
{+(Empty)+})+})+}
|
||||
{+(ForEach
|
||||
{+(Empty)+}
|
||||
{+(Identifier)+}
|
||||
{+([])+})+}
|
||||
{-(For
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Continue
|
||||
{-(Identifier)-})-})-})-}
|
||||
{-(For
|
||||
{-(LessThan
|
||||
{-(Identifier)-}
|
||||
{-(Integer)-})-}
|
||||
{-(PostIncrement
|
||||
{-(Identifier)-})-}
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Continue
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(For
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-}
|
||||
{-(Break
|
||||
{-(Empty)-})-})-})-}
|
||||
{-(ForEach
|
||||
{-(
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Break)-})-})-}))
|
||||
{-(Identifier)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(ForEach
|
||||
{-(
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-})-}
|
||||
{-(Identifier)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(For
|
||||
{-(Empty)-}
|
||||
{-(LessThan
|
||||
{-(Integer)-}
|
||||
{-(Integer)-})-}
|
||||
{-(Empty)-}
|
||||
{-(Call
|
||||
{-(Identifier)-}
|
||||
{-(Empty)-})-})-}
|
||||
{-(ForEach
|
||||
{-(Empty)-}
|
||||
{-(Identifier)-}
|
||||
{-([])-})-})))
|
||||
|
131
test/fixtures/go/for-statements.parseA.txt
vendored
131
test/fixtures/go/for-statements.parseA.txt
vendored
@ -2,48 +2,99 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(For
|
||||
(ExpressionStatements
|
||||
(FunctionCall
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
(For
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Other "goto_statement"
|
||||
(Identifier))))
|
||||
(For
|
||||
(VarDecl
|
||||
(Other "expression_list"
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))))
|
||||
(For
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)))
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Identifier))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(Identifier)
|
||||
(Other "<")
|
||||
(NumberLiteral))
|
||||
(IncrementStatement)
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Break
|
||||
(Identifier)))
|
||||
(For
|
||||
(RelationalOperator
|
||||
(Identifier)
|
||||
(Other "<")
|
||||
(NumberLiteral))
|
||||
(IncrementStatement)
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Continue
|
||||
(Identifier)))
|
||||
(For
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Continue))
|
||||
(For
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(FunctionCall
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Break))))
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(For
|
||||
(Empty)
|
||||
(LessThan
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Empty)
|
||||
(Identifier)
|
||||
([])))))
|
||||
|
120
test/fixtures/go/for-statements.parseB.txt
vendored
120
test/fixtures/go/for-statements.parseB.txt
vendored
@ -2,38 +2,94 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(For
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Other "goto_statement"
|
||||
(Identifier)))
|
||||
(For
|
||||
(Other "expression_list"
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Break
|
||||
(Identifier)))
|
||||
(For
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Continue
|
||||
(Identifier)))
|
||||
(For
|
||||
(RelationalOperator
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Goto
|
||||
(Identifier))))
|
||||
(ForEach
|
||||
(Identifier)
|
||||
(Other "<")
|
||||
(NumberLiteral))
|
||||
(IncrementStatement)
|
||||
(FunctionCall
|
||||
(Identifier))
|
||||
(Continue))
|
||||
(For
|
||||
(ExpressionStatements
|
||||
(FunctionCall
|
||||
(Identifier)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Identifier))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Identifier))))
|
||||
(For
|
||||
(LessThan
|
||||
(Identifier)
|
||||
(Integer))
|
||||
(PostIncrement
|
||||
(Identifier))
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Continue
|
||||
(Empty))))
|
||||
(For
|
||||
(Empty)
|
||||
(Empty)
|
||||
(Empty)
|
||||
(
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty))
|
||||
(Break
|
||||
(Empty))))
|
||||
(ForEach
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Break)))))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(For
|
||||
(Empty)
|
||||
(LessThan
|
||||
(Integer)
|
||||
(Integer))
|
||||
(Empty)
|
||||
(Call
|
||||
(Identifier)
|
||||
(Empty)))
|
||||
(ForEach
|
||||
(Empty)
|
||||
(Identifier)
|
||||
([])))))
|
||||
|
2
test/fixtures/go/function-declarations.A.go
vendored
2
test/fixtures/go/function-declarations.A.go
vendored
@ -5,3 +5,5 @@ func f1() {}
|
||||
func f2(a int, b, c, d string) int {}
|
||||
func f2() (int, error) {}
|
||||
func f2() (result int, err error) {}
|
||||
func lockedOSThread() bool
|
||||
func getcontext(c *u) /* int32 */ {}
|
||||
|
3
test/fixtures/go/function-declarations.B.go
vendored
3
test/fixtures/go/function-declarations.B.go
vendored
@ -5,3 +5,6 @@ func fa() {}
|
||||
func fb(a int, b, c, d string) int {}
|
||||
func fc() (int, error) {}
|
||||
func fd() (result int, err error) {}
|
||||
func fe() () {;}
|
||||
func lockOSThread() int
|
||||
func setcontext(c *u) /* int32 */ {}
|
||||
|
@ -1,41 +1,84 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args)
|
||||
(Args
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Identifier)))
|
||||
([]))
|
||||
{+(Function
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Identifier)+})+}
|
||||
{+([])+}
|
||||
{+([])+}
|
||||
{+(NoOp
|
||||
{+(Empty)+})+})+}
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
(Empty))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))
|
||||
([])))
|
||||
|
106
test/fixtures/go/function-declarations.diffB-A.txt
vendored
106
test/fixtures/go/function-declarations.diffB-A.txt
vendored
@ -1,41 +1,99 @@
|
||||
(Program
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args)
|
||||
(Args
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Args)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(Empty)
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Identifier)))
|
||||
([]))
|
||||
{+(Function
|
||||
{+(Identifier)+}
|
||||
{+(
|
||||
{+(Identifier)+})+}
|
||||
{+([])+}
|
||||
{+(Empty)+})+}
|
||||
{+(Function
|
||||
{+(Empty)+}
|
||||
{+(
|
||||
{+(Identifier)+})+}
|
||||
{+(
|
||||
{+(Identifier)+}
|
||||
{+(Pointer
|
||||
{+(Identifier)+})+})+}
|
||||
{+(Context
|
||||
{+(Comment)+}
|
||||
{+(Empty)+})+}
|
||||
{+([])+})+}
|
||||
{-(Function
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Identifier)-})-}
|
||||
{-([])-}
|
||||
{-([])-}
|
||||
{-(NoOp
|
||||
{-(Empty)-})-})-}
|
||||
{-(Function
|
||||
{-(Identifier)-}
|
||||
{-(
|
||||
{-(Identifier)-})-}
|
||||
{-([])-}
|
||||
{-(Empty)-})-}
|
||||
{-(Function
|
||||
{-(Empty)-}
|
||||
{-(
|
||||
{-(Identifier)-})-}
|
||||
{-(
|
||||
{-(Identifier)-}
|
||||
{-(Pointer
|
||||
{-(Identifier)-})-})-}
|
||||
{-(Context
|
||||
{-(Comment)-}
|
||||
{-(Empty)-})-}
|
||||
{-([])-})-})
|
||||
|
@ -2,36 +2,68 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier))
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Args
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Identifier)))
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Empty))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))
|
||||
([])))
|
||||
|
@ -2,36 +2,76 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier))
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Args
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(Identifier))
|
||||
([]))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(ParameterDecl
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))))
|
||||
(Identifier)))
|
||||
([]))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
([])
|
||||
(NoOp
|
||||
(Empty)))
|
||||
(Function
|
||||
(Identifier)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Empty))
|
||||
(Function
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
(
|
||||
(Identifier)
|
||||
(Pointer
|
||||
(Identifier)))
|
||||
(Context
|
||||
(Comment)
|
||||
(Empty))
|
||||
([])))
|
||||
|
38
test/fixtures/go/function-literals.diffA-B.txt
vendored
38
test/fixtures/go/function-literals.diffA-B.txt
vendored
@ -2,18 +2,26 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(AnonymousFunction
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Return
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
([])
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Return
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
|
38
test/fixtures/go/function-literals.diffB-A.txt
vendored
38
test/fixtures/go/function-literals.diffB-A.txt
vendored
@ -2,18 +2,26 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(AnonymousFunction
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(Return
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
([])
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Return
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
|
32
test/fixtures/go/function-literals.parseA.txt
vendored
32
test/fixtures/go/function-literals.parseA.txt
vendored
@ -2,16 +2,22 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(AnonymousFunction
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Return
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Return
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
|
32
test/fixtures/go/function-literals.parseB.txt
vendored
32
test/fixtures/go/function-literals.parseB.txt
vendored
@ -2,16 +2,22 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "const_declaration"
|
||||
(VarAssignment
|
||||
(Identifier)
|
||||
(Other "expression_list"
|
||||
(AnonymousFunction
|
||||
(Identifier)
|
||||
(Identifier)
|
||||
(Return
|
||||
(Other "expression_list"
|
||||
(NumberLiteral)
|
||||
(NumberLiteral)))))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(Assignment
|
||||
(Identifier)
|
||||
(Function
|
||||
(Empty)
|
||||
([])
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Return
|
||||
(
|
||||
(Integer)
|
||||
(Integer)))))))
|
||||
|
32
test/fixtures/go/function-types.diffA-B.txt
vendored
32
test/fixtures/go/function-types.diffA-B.txt
vendored
@ -2,29 +2,31 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(FunctionTy
|
||||
(Args
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(TypeDecl
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Function
|
||||
(
|
||||
{-(Identifier)-}
|
||||
(Identifier)
|
||||
{+(Identifier)+})
|
||||
(Args
|
||||
{+(ParameterDecl
|
||||
{+(ChannelTy
|
||||
(
|
||||
{+(
|
||||
{+(BidirectionalChannel
|
||||
{+(Identifier)+})+})+}
|
||||
{-(Identifier)-}
|
||||
(Identifier)))))))
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
32
test/fixtures/go/function-types.diffB-A.txt
vendored
32
test/fixtures/go/function-types.diffB-A.txt
vendored
@ -2,29 +2,31 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(FunctionTy
|
||||
(Args
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Function
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) }))
|
||||
(TypeDecl
|
||||
(Type
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Function
|
||||
(
|
||||
{-(Identifier)-}
|
||||
(Identifier)
|
||||
{+(Identifier)+})
|
||||
(Args
|
||||
(
|
||||
{+(Identifier)+}
|
||||
{-(ParameterDecl
|
||||
{-(ChannelTy
|
||||
{-(
|
||||
{-(BidirectionalChannel
|
||||
{-(Identifier)-})-})-}
|
||||
(Identifier)))))))
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
26
test/fixtures/go/function-types.parseA.txt
vendored
26
test/fixtures/go/function-types.parseA.txt
vendored
@ -2,21 +2,23 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(TypeDecl
|
||||
(Type
|
||||
(Identifier)
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Function
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Args
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier)))))))
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
30
test/fixtures/go/function-types.parseB.txt
vendored
30
test/fixtures/go/function-types.parseB.txt
vendored
@ -2,23 +2,25 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Other "type_declaration"
|
||||
(TypeDecl
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Type
|
||||
(Identifier)
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Identifier)))
|
||||
(TypeDecl
|
||||
(Type
|
||||
(Identifier)
|
||||
(FunctionTy
|
||||
(Args
|
||||
(Function
|
||||
(
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Args
|
||||
(ParameterDecl
|
||||
(ChannelTy
|
||||
(
|
||||
(
|
||||
(BidirectionalChannel
|
||||
(Identifier)))
|
||||
(Identifier)))))))
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
@ -2,19 +2,24 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Defer
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Go
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty))))))
|
||||
|
@ -2,19 +2,24 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Defer
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })))
|
||||
(Go
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
{ (Identifier)
|
||||
->(Identifier) }
|
||||
{ (Identifier)
|
||||
->(Identifier) })
|
||||
(Empty))))))
|
||||
|
@ -2,15 +2,20 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Defer
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
(Identifier)
|
||||
(Identifier))))
|
||||
(Go
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
@ -2,15 +2,20 @@
|
||||
(Module
|
||||
(Identifier))
|
||||
(Function
|
||||
(Identifier)
|
||||
(Args)
|
||||
(Defer
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
(Identifier)
|
||||
(Identifier))))
|
||||
(Go
|
||||
(FunctionCall
|
||||
(SubscriptAccess
|
||||
(Identifier)
|
||||
(Identifier))))))
|
||||
(Empty)
|
||||
(
|
||||
(Identifier))
|
||||
([])
|
||||
(
|
||||
(Defer
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty)))
|
||||
(Go
|
||||
(Call
|
||||
(MemberAccess
|
||||
(Identifier)
|
||||
(Identifier))
|
||||
(Empty))))))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user