ast

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AddressLocationPrefix = "A"
View Source
const IdentifierLocationPrefix = "I"

IdentifierLocation

View Source
const NilConstant = "nil"
View Source
const StringLocationPrefix = "S"

Variables

Functions

func AccessCount added in v0.5.0

func AccessCount() int

func ConditionKindCount added in v0.5.0

func ConditionKindCount() int

func LocationsMatch

func LocationsMatch(first, second Location) bool

func OperationCount added in v0.8.0

func OperationCount() int

func TransferOperationCount added in v0.8.0

func TransferOperationCount() int

func VariableKindCount added in v0.8.0

func VariableKindCount() int

Types

type Access

type Access uint
const (
	AccessNotSpecified Access = iota
	AccessPrivate
	AccessContract
	AccessAccount
	AccessPublic
	AccessPublicSettable
)

func (Access) Description

func (a Access) Description() string

func (Access) IsLessPermissiveThan

func (a Access) IsLessPermissiveThan(otherAccess Access) bool

func (Access) Keyword

func (a Access) Keyword() string

func (Access) MarshalJSON added in v0.5.0

func (a Access) MarshalJSON() ([]byte, error)

func (Access) String

func (i Access) String() string

type AccessExpression

type AccessExpression interface {
	Expression

	AccessedExpression() Expression
	// contains filtered or unexported methods
}

type AddressLocation

type AddressLocation struct {
	Address common.Address
	Name    string
}

AddressLocation is the location of a contract/contract interface at an address

func (AddressLocation) ID

func (l AddressLocation) ID() LocationID

func (AddressLocation) MarshalJSON added in v0.9.0

func (l AddressLocation) MarshalJSON() ([]byte, error)

func (AddressLocation) QualifiedIdentifier added in v0.10.2

func (l AddressLocation) QualifiedIdentifier(typeID TypeID) string

func (AddressLocation) String

func (l AddressLocation) String() string

func (AddressLocation) TypeID added in v0.10.2

func (l AddressLocation) TypeID(qualifiedIdentifier string) TypeID

type Argument

type Argument struct {
	Label         string    `json:",omitempty"`
	LabelStartPos *Position `json:",omitempty"`
	LabelEndPos   *Position `json:",omitempty"`
	Expression    Expression
}

func (Argument) EndPosition added in v0.5.0

func (a Argument) EndPosition() Position

func (Argument) MarshalJSON added in v0.5.0

func (a Argument) MarshalJSON() ([]byte, error)

func (Argument) StartPosition added in v0.5.0

func (a Argument) StartPosition() Position

func (Argument) String

func (a Argument) String() string

type Arguments

type Arguments []*Argument

func (Arguments) String

func (args Arguments) String() string

type ArrayExpression

type ArrayExpression struct {
	Values []Expression
	Range
}

func (*ArrayExpression) Accept

func (e *ArrayExpression) Accept(visitor Visitor) Repr

func (*ArrayExpression) AcceptExp

func (e *ArrayExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ArrayExpression) MarshalJSON added in v0.8.0

func (e *ArrayExpression) MarshalJSON() ([]byte, error)

func (*ArrayExpression) String

func (e *ArrayExpression) String() string

type ArrayExtractor

type ArrayExtractor interface {
	ExtractArray(extractor *ExpressionExtractor, expression *ArrayExpression) ExpressionExtraction
}

type AssignmentStatement

type AssignmentStatement struct {
	Target   Expression
	Transfer *Transfer
	Value    Expression
}

func (*AssignmentStatement) Accept

func (s *AssignmentStatement) Accept(visitor Visitor) Repr

func (*AssignmentStatement) EndPosition

func (s *AssignmentStatement) EndPosition() Position

func (*AssignmentStatement) MarshalJSON added in v0.9.0

func (s *AssignmentStatement) MarshalJSON() ([]byte, error)

func (*AssignmentStatement) StartPosition

func (s *AssignmentStatement) StartPosition() Position

type BinaryExpression

type BinaryExpression struct {
	Operation Operation
	Left      Expression
	Right     Expression
}

func (*BinaryExpression) Accept

func (e *BinaryExpression) Accept(visitor Visitor) Repr

func (*BinaryExpression) AcceptExp

func (e *BinaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*BinaryExpression) EndPosition

func (e *BinaryExpression) EndPosition() Position

func (*BinaryExpression) MarshalJSON added in v0.9.0

func (e *BinaryExpression) MarshalJSON() ([]byte, error)

func (*BinaryExpression) StartPosition

func (e *BinaryExpression) StartPosition() Position

func (*BinaryExpression) String

func (e *BinaryExpression) String() string

type BinaryExtractor

type BinaryExtractor interface {
	ExtractBinary(extractor *ExpressionExtractor, expression *BinaryExpression) ExpressionExtraction
}

type Block

type Block struct {
	Statements []Statement
	Range
}

func (*Block) Accept

func (b *Block) Accept(visitor Visitor) Repr

func (*Block) MarshalJSON added in v0.8.0

func (b *Block) MarshalJSON() ([]byte, error)

type BoolExpression

type BoolExpression struct {
	Value bool
	Range
}

func (*BoolExpression) Accept

func (e *BoolExpression) Accept(visitor Visitor) Repr

func (*BoolExpression) AcceptExp

func (e *BoolExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*BoolExpression) MarshalJSON added in v0.5.0

func (e *BoolExpression) MarshalJSON() ([]byte, error)

func (*BoolExpression) String

func (e *BoolExpression) String() string

type BoolExtractor

type BoolExtractor interface {
	ExtractBool(extractor *ExpressionExtractor, expression *BoolExpression) ExpressionExtraction
}

type BreakStatement

type BreakStatement struct {
	Range
}

func (*BreakStatement) Accept

func (s *BreakStatement) Accept(visitor Visitor) Repr

func (*BreakStatement) MarshalJSON added in v0.8.0

func (s *BreakStatement) MarshalJSON() ([]byte, error)

type CastingExpression

type CastingExpression struct {
	Expression                Expression
	Operation                 Operation
	TypeAnnotation            *TypeAnnotation
	ParentVariableDeclaration *VariableDeclaration `json:"-"`
}

func (*CastingExpression) Accept

func (e *CastingExpression) Accept(visitor Visitor) Repr

func (*CastingExpression) AcceptExp

func (e *CastingExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*CastingExpression) EndPosition

func (e *CastingExpression) EndPosition() Position

func (*CastingExpression) MarshalJSON added in v0.9.0

func (e *CastingExpression) MarshalJSON() ([]byte, error)

func (*CastingExpression) StartPosition

func (e *CastingExpression) StartPosition() Position

func (*CastingExpression) String

func (e *CastingExpression) String() string

type CastingExtractor

type CastingExtractor interface {
	ExtractCast(extractor *ExpressionExtractor, expression *CastingExpression) ExpressionExtraction
}

type CompositeDeclaration

type CompositeDeclaration struct {
	Access        Access
	CompositeKind common.CompositeKind
	Identifier    Identifier
	Conformances  []*NominalType
	Members       *Members
	DocString     string
	Range
}

func (*CompositeDeclaration) Accept

func (d *CompositeDeclaration) Accept(visitor Visitor) Repr

func (*CompositeDeclaration) DeclarationAccess

func (d *CompositeDeclaration) DeclarationAccess() Access

func (*CompositeDeclaration) DeclarationIdentifier

func (d *CompositeDeclaration) DeclarationIdentifier() *Identifier

func (*CompositeDeclaration) DeclarationKind

func (d *CompositeDeclaration) DeclarationKind() common.DeclarationKind

func (*CompositeDeclaration) MarshalJSON added in v0.9.0

func (d *CompositeDeclaration) MarshalJSON() ([]byte, error)

type Condition

type Condition struct {
	Kind    ConditionKind
	Test    Expression
	Message Expression
}

func (*Condition) Accept

func (c *Condition) Accept(visitor Visitor) Repr

type ConditionKind

type ConditionKind uint
const (
	ConditionKindUnknown ConditionKind = iota
	ConditionKindPre
	ConditionKindPost
)

func (ConditionKind) MarshalJSON added in v0.5.0

func (k ConditionKind) MarshalJSON() ([]byte, error)

func (ConditionKind) Name

func (k ConditionKind) Name() string

func (ConditionKind) String

func (i ConditionKind) String() string

type ConditionalExpression

type ConditionalExpression struct {
	Test Expression
	Then Expression
	Else Expression
}

func (*ConditionalExpression) Accept

func (e *ConditionalExpression) Accept(visitor Visitor) Repr

func (*ConditionalExpression) AcceptExp

func (e *ConditionalExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ConditionalExpression) EndPosition

func (e *ConditionalExpression) EndPosition() Position

func (*ConditionalExpression) MarshalJSON added in v0.9.0

func (e *ConditionalExpression) MarshalJSON() ([]byte, error)

func (*ConditionalExpression) StartPosition

func (e *ConditionalExpression) StartPosition() Position

func (*ConditionalExpression) String

func (e *ConditionalExpression) String() string

type ConditionalExtractor

type ConditionalExtractor interface {
	ExtractConditional(extractor *ExpressionExtractor, expression *ConditionalExpression) ExpressionExtraction
}

type Conditions

type Conditions []*Condition

func (*Conditions) Append

func (c *Conditions) Append(conditions Conditions)

type ConstantSizedType

type ConstantSizedType struct {
	Type Type `json:"ElementType"`
	Size *IntegerExpression
	Range
}

func (*ConstantSizedType) MarshalJSON added in v0.9.0

func (t *ConstantSizedType) MarshalJSON() ([]byte, error)

func (*ConstantSizedType) String

func (t *ConstantSizedType) String() string

type ContinueStatement

type ContinueStatement struct {
	Range
}

func (*ContinueStatement) Accept

func (s *ContinueStatement) Accept(visitor Visitor) Repr

func (*ContinueStatement) MarshalJSON added in v0.8.0

func (s *ContinueStatement) MarshalJSON() ([]byte, error)

type CreateExpression

type CreateExpression struct {
	InvocationExpression *InvocationExpression
	StartPos             Position `json:"-"`
}

func (*CreateExpression) Accept

func (e *CreateExpression) Accept(visitor Visitor) Repr

func (*CreateExpression) AcceptExp

func (e *CreateExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*CreateExpression) EndPosition

func (e *CreateExpression) EndPosition() Position

func (*CreateExpression) MarshalJSON added in v0.9.0

func (e *CreateExpression) MarshalJSON() ([]byte, error)

func (*CreateExpression) StartPosition

func (e *CreateExpression) StartPosition() Position

func (*CreateExpression) String

func (e *CreateExpression) String() string

type CreateExtractor

type CreateExtractor interface {
	ExtractCreate(extractor *ExpressionExtractor, expression *CreateExpression) ExpressionExtraction
}

type Declaration

type Declaration interface {
	Element

	DeclarationIdentifier() *Identifier
	DeclarationKind() common.DeclarationKind
	DeclarationAccess() Access
	// contains filtered or unexported methods
}

type DestroyExpression

type DestroyExpression struct {
	Expression Expression
	StartPos   Position `json:"-"`
}

func (*DestroyExpression) Accept

func (e *DestroyExpression) Accept(visitor Visitor) Repr

func (*DestroyExpression) AcceptExp

func (e *DestroyExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*DestroyExpression) EndPosition

func (e *DestroyExpression) EndPosition() Position

func (*DestroyExpression) MarshalJSON added in v0.9.0

func (e *DestroyExpression) MarshalJSON() ([]byte, error)

func (*DestroyExpression) StartPosition

func (e *DestroyExpression) StartPosition() Position

func (*DestroyExpression) String

func (e *DestroyExpression) String() string

type DestroyExtractor

type DestroyExtractor interface {
	ExtractDestroy(extractor *ExpressionExtractor, expression *DestroyExpression) ExpressionExtraction
}

type DictionaryEntry added in v0.8.0

type DictionaryEntry struct {
	Key   Expression
	Value Expression
}

func (DictionaryEntry) MarshalJSON added in v0.8.0

func (e DictionaryEntry) MarshalJSON() ([]byte, error)

type DictionaryExpression

type DictionaryExpression struct {
	Entries []DictionaryEntry
	Range
}

func (*DictionaryExpression) Accept

func (e *DictionaryExpression) Accept(visitor Visitor) Repr

func (*DictionaryExpression) AcceptExp

func (e *DictionaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*DictionaryExpression) MarshalJSON added in v0.8.0

func (e *DictionaryExpression) MarshalJSON() ([]byte, error)

func (*DictionaryExpression) String

func (e *DictionaryExpression) String() string

type DictionaryExtractor

type DictionaryExtractor interface {
	ExtractDictionary(extractor *ExpressionExtractor, expression *DictionaryExpression) ExpressionExtraction
}

type DictionaryType

type DictionaryType struct {
	KeyType   Type
	ValueType Type
	Range
}

func (*DictionaryType) MarshalJSON added in v0.9.0

func (t *DictionaryType) MarshalJSON() ([]byte, error)

func (*DictionaryType) String

func (t *DictionaryType) String() string

type Element

type Element interface {
	HasPosition
	Accept(Visitor) Repr
}

type EmitStatement

type EmitStatement struct {
	InvocationExpression *InvocationExpression
	StartPos             Position `json:"-"`
}

func (*EmitStatement) Accept

func (s *EmitStatement) Accept(visitor Visitor) Repr

func (*EmitStatement) EndPosition

func (s *EmitStatement) EndPosition() Position

func (*EmitStatement) MarshalJSON added in v0.9.0

func (s *EmitStatement) MarshalJSON() ([]byte, error)

func (*EmitStatement) StartPosition

func (s *EmitStatement) StartPosition() Position

type EnumCaseDeclaration added in v0.10.0

type EnumCaseDeclaration struct {
	Access     Access
	Identifier Identifier
	DocString  string
	StartPos   Position `json:"-"`
}

func (*EnumCaseDeclaration) Accept added in v0.10.0

func (d *EnumCaseDeclaration) Accept(visitor Visitor) Repr

func (*EnumCaseDeclaration) DeclarationAccess added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationAccess() Access

func (*EnumCaseDeclaration) DeclarationIdentifier added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationIdentifier() *Identifier

func (*EnumCaseDeclaration) DeclarationKind added in v0.10.0

func (d *EnumCaseDeclaration) DeclarationKind() common.DeclarationKind

func (*EnumCaseDeclaration) EndPosition added in v0.10.0

func (d *EnumCaseDeclaration) EndPosition() Position

func (*EnumCaseDeclaration) MarshalJSON added in v0.10.0

func (d *EnumCaseDeclaration) MarshalJSON() ([]byte, error)

func (*EnumCaseDeclaration) StartPosition added in v0.10.0

func (d *EnumCaseDeclaration) StartPosition() Position

type Expression

type Expression interface {
	Element
	fmt.Stringer
	IfStatementTest

	AcceptExp(ExpressionVisitor) Repr
	// contains filtered or unexported methods
}

type ExpressionExtraction

type ExpressionExtraction struct {
	RewrittenExpression  Expression
	ExtractedExpressions []ExtractedExpression
}

type ExpressionExtractor

type ExpressionExtractor struct {
	BoolExtractor        BoolExtractor
	NilExtractor         NilExtractor
	IntExtractor         IntExtractor
	FixedPointExtractor  FixedPointExtractor
	StringExtractor      StringExtractor
	ArrayExtractor       ArrayExtractor
	DictionaryExtractor  DictionaryExtractor
	IdentifierExtractor  IdentifierExtractor
	InvocationExtractor  InvocationExtractor
	MemberExtractor      MemberExtractor
	IndexExtractor       IndexExtractor
	ConditionalExtractor ConditionalExtractor
	UnaryExtractor       UnaryExtractor
	BinaryExtractor      BinaryExtractor
	FunctionExtractor    FunctionExtractor
	CastingExtractor     CastingExtractor
	CreateExtractor      CreateExtractor
	DestroyExtractor     DestroyExtractor
	ReferenceExtractor   ReferenceExtractor
	ForceExtractor       ForceExtractor
	PathExtractor        PathExtractor
	// contains filtered or unexported fields
}

func (*ExpressionExtractor) Extract

func (extractor *ExpressionExtractor) Extract(expression Expression) ExpressionExtraction

func (*ExpressionExtractor) ExtractArray

func (extractor *ExpressionExtractor) ExtractArray(expression *ArrayExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractBinary

func (extractor *ExpressionExtractor) ExtractBinary(expression *BinaryExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractBool

func (extractor *ExpressionExtractor) ExtractBool(expression *BoolExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractCast

func (extractor *ExpressionExtractor) ExtractCast(expression *CastingExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractConditional

func (extractor *ExpressionExtractor) ExtractConditional(expression *ConditionalExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractCreate

func (extractor *ExpressionExtractor) ExtractCreate(expression *CreateExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractDestroy

func (extractor *ExpressionExtractor) ExtractDestroy(expression *DestroyExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractDictionary

func (extractor *ExpressionExtractor) ExtractDictionary(expression *DictionaryExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractFixedPoint

func (extractor *ExpressionExtractor) ExtractFixedPoint(expression *FixedPointExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractForce

func (extractor *ExpressionExtractor) ExtractForce(expression *ForceExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractFunction

func (extractor *ExpressionExtractor) ExtractFunction(_ *FunctionExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractIdentifier

func (extractor *ExpressionExtractor) ExtractIdentifier(expression *IdentifierExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractIndex

func (extractor *ExpressionExtractor) ExtractIndex(expression *IndexExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractInteger

func (extractor *ExpressionExtractor) ExtractInteger(expression *IntegerExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractInvocation

func (extractor *ExpressionExtractor) ExtractInvocation(expression *InvocationExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractMember

func (extractor *ExpressionExtractor) ExtractMember(expression *MemberExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractNil

func (extractor *ExpressionExtractor) ExtractNil(expression *NilExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractPath

func (extractor *ExpressionExtractor) ExtractPath(expression *PathExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractReference

func (extractor *ExpressionExtractor) ExtractReference(expression *ReferenceExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractString

func (extractor *ExpressionExtractor) ExtractString(expression *StringExpression) ExpressionExtraction

func (*ExpressionExtractor) ExtractUnary

func (extractor *ExpressionExtractor) ExtractUnary(expression *UnaryExpression) ExpressionExtraction

func (*ExpressionExtractor) FormatIdentifier

func (extractor *ExpressionExtractor) FormatIdentifier(identifier int) string

func (*ExpressionExtractor) FreshIdentifier

func (extractor *ExpressionExtractor) FreshIdentifier() string

func (*ExpressionExtractor) VisitArrayExpression

func (extractor *ExpressionExtractor) VisitArrayExpression(expression *ArrayExpression) Repr

func (*ExpressionExtractor) VisitBinaryExpression

func (extractor *ExpressionExtractor) VisitBinaryExpression(expression *BinaryExpression) Repr

func (*ExpressionExtractor) VisitBoolExpression

func (extractor *ExpressionExtractor) VisitBoolExpression(expression *BoolExpression) Repr

func (*ExpressionExtractor) VisitCastingExpression

func (extractor *ExpressionExtractor) VisitCastingExpression(expression *CastingExpression) Repr

func (*ExpressionExtractor) VisitConditionalExpression

func (extractor *ExpressionExtractor) VisitConditionalExpression(expression *ConditionalExpression) Repr

func (*ExpressionExtractor) VisitCreateExpression

func (extractor *ExpressionExtractor) VisitCreateExpression(expression *CreateExpression) Repr

func (*ExpressionExtractor) VisitDestroyExpression

func (extractor *ExpressionExtractor) VisitDestroyExpression(expression *DestroyExpression) Repr

func (*ExpressionExtractor) VisitDictionaryExpression

func (extractor *ExpressionExtractor) VisitDictionaryExpression(expression *DictionaryExpression) Repr

func (*ExpressionExtractor) VisitExpressions

func (extractor *ExpressionExtractor) VisitExpressions(
	expressions []Expression,
) (
	[]Expression, []ExtractedExpression,
)

func (*ExpressionExtractor) VisitFixedPointExpression

func (extractor *ExpressionExtractor) VisitFixedPointExpression(expression *FixedPointExpression) Repr

func (*ExpressionExtractor) VisitForceExpression

func (extractor *ExpressionExtractor) VisitForceExpression(expression *ForceExpression) Repr

func (*ExpressionExtractor) VisitFunctionExpression

func (extractor *ExpressionExtractor) VisitFunctionExpression(expression *FunctionExpression) Repr

func (*ExpressionExtractor) VisitIdentifierExpression

func (extractor *ExpressionExtractor) VisitIdentifierExpression(expression *IdentifierExpression) Repr

func (*ExpressionExtractor) VisitIndexExpression

func (extractor *ExpressionExtractor) VisitIndexExpression(expression *IndexExpression) Repr

func (*ExpressionExtractor) VisitIntegerExpression

func (extractor *ExpressionExtractor) VisitIntegerExpression(expression *IntegerExpression) Repr

func (*ExpressionExtractor) VisitInvocationExpression

func (extractor *ExpressionExtractor) VisitInvocationExpression(expression *InvocationExpression) Repr

func (*ExpressionExtractor) VisitMemberExpression

func (extractor *ExpressionExtractor) VisitMemberExpression(expression *MemberExpression) Repr

func (*ExpressionExtractor) VisitNilExpression

func (extractor *ExpressionExtractor) VisitNilExpression(expression *NilExpression) Repr

func (*ExpressionExtractor) VisitPathExpression

func (extractor *ExpressionExtractor) VisitPathExpression(expression *PathExpression) Repr

func (*ExpressionExtractor) VisitReferenceExpression

func (extractor *ExpressionExtractor) VisitReferenceExpression(expression *ReferenceExpression) Repr

func (*ExpressionExtractor) VisitStringExpression

func (extractor *ExpressionExtractor) VisitStringExpression(expression *StringExpression) Repr

func (*ExpressionExtractor) VisitUnaryExpression

func (extractor *ExpressionExtractor) VisitUnaryExpression(expression *UnaryExpression) Repr

type ExpressionStatement

type ExpressionStatement struct {
	Expression Expression
}

func (*ExpressionStatement) Accept

func (s *ExpressionStatement) Accept(visitor Visitor) Repr

func (*ExpressionStatement) EndPosition

func (s *ExpressionStatement) EndPosition() Position

func (*ExpressionStatement) MarshalJSON added in v0.8.0

func (s *ExpressionStatement) MarshalJSON() ([]byte, error)

func (*ExpressionStatement) StartPosition

func (s *ExpressionStatement) StartPosition() Position

type ExpressionVisitor

type ExpressionVisitor interface {
	VisitBoolExpression(*BoolExpression) Repr
	VisitNilExpression(*NilExpression) Repr
	VisitIntegerExpression(*IntegerExpression) Repr
	VisitFixedPointExpression(*FixedPointExpression) Repr
	VisitArrayExpression(*ArrayExpression) Repr
	VisitDictionaryExpression(*DictionaryExpression) Repr
	VisitIdentifierExpression(*IdentifierExpression) Repr
	VisitInvocationExpression(*InvocationExpression) Repr
	VisitMemberExpression(*MemberExpression) Repr
	VisitIndexExpression(*IndexExpression) Repr
	VisitConditionalExpression(*ConditionalExpression) Repr
	VisitUnaryExpression(*UnaryExpression) Repr
	VisitBinaryExpression(*BinaryExpression) Repr
	VisitFunctionExpression(*FunctionExpression) Repr
	VisitStringExpression(*StringExpression) Repr
	VisitCastingExpression(*CastingExpression) Repr
	VisitCreateExpression(*CreateExpression) Repr
	VisitDestroyExpression(*DestroyExpression) Repr
	VisitReferenceExpression(*ReferenceExpression) Repr
	VisitForceExpression(*ForceExpression) Repr
	VisitPathExpression(*PathExpression) Repr
}

type ExtractedExpression

type ExtractedExpression struct {
	Identifier Identifier
	Expression Expression
}

type FieldDeclaration

type FieldDeclaration struct {
	Access         Access
	VariableKind   VariableKind
	Identifier     Identifier
	TypeAnnotation *TypeAnnotation
	DocString      string
	Range
}

func (*FieldDeclaration) Accept

func (d *FieldDeclaration) Accept(visitor Visitor) Repr

func (*FieldDeclaration) DeclarationAccess

func (d *FieldDeclaration) DeclarationAccess() Access

func (*FieldDeclaration) DeclarationIdentifier

func (d *FieldDeclaration) DeclarationIdentifier() *Identifier

func (*FieldDeclaration) DeclarationKind

func (d *FieldDeclaration) DeclarationKind() common.DeclarationKind

func (*FieldDeclaration) MarshalJSON added in v0.9.0

func (d *FieldDeclaration) MarshalJSON() ([]byte, error)

type FixedPointExpression

type FixedPointExpression struct {
	Negative        bool
	UnsignedInteger *big.Int `json:"-"`
	Fractional      *big.Int `json:"-"`
	Scale           uint
	Range
}

func (*FixedPointExpression) Accept

func (e *FixedPointExpression) Accept(visitor Visitor) Repr

func (*FixedPointExpression) AcceptExp

func (e *FixedPointExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*FixedPointExpression) MarshalJSON added in v0.8.0

func (e *FixedPointExpression) MarshalJSON() ([]byte, error)

func (*FixedPointExpression) String

func (e *FixedPointExpression) String() string

type FixedPointExtractor

type FixedPointExtractor interface {
	ExtractFixedPoint(extractor *ExpressionExtractor, expression *FixedPointExpression) ExpressionExtraction
}

type ForStatement

type ForStatement struct {
	Identifier Identifier
	Value      Expression
	Block      *Block
	StartPos   Position `json:"-"`
}

func (*ForStatement) Accept

func (s *ForStatement) Accept(visitor Visitor) Repr

func (*ForStatement) EndPosition

func (s *ForStatement) EndPosition() Position

func (*ForStatement) MarshalJSON added in v0.8.0

func (s *ForStatement) MarshalJSON() ([]byte, error)

func (*ForStatement) StartPosition

func (s *ForStatement) StartPosition() Position

type ForceExpression

type ForceExpression struct {
	Expression Expression
	EndPos     Position `json:"-"`
}

func (*ForceExpression) Accept

func (e *ForceExpression) Accept(visitor Visitor) Repr

func (*ForceExpression) AcceptExp

func (e *ForceExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ForceExpression) EndPosition

func (e *ForceExpression) EndPosition() Position

func (*ForceExpression) MarshalJSON added in v0.9.0

func (e *ForceExpression) MarshalJSON() ([]byte, error)

func (*ForceExpression) StartPosition

func (e *ForceExpression) StartPosition() Position

func (*ForceExpression) String

func (e *ForceExpression) String() string

type ForceExtractor

type ForceExtractor interface {
	ExtractForce(extractor *ExpressionExtractor, expression *ForceExpression) ExpressionExtraction
}

type FunctionBlock

type FunctionBlock struct {
	Block          *Block
	PreConditions  *Conditions `json:",omitempty"`
	PostConditions *Conditions `json:",omitempty"`
}

func (*FunctionBlock) Accept

func (b *FunctionBlock) Accept(visitor Visitor) Repr

func (*FunctionBlock) EndPosition added in v0.8.0

func (b *FunctionBlock) EndPosition() Position

func (*FunctionBlock) MarshalJSON added in v0.8.0

func (b *FunctionBlock) MarshalJSON() ([]byte, error)

func (*FunctionBlock) StartPosition added in v0.8.0

func (b *FunctionBlock) StartPosition() Position

type FunctionDeclaration

type FunctionDeclaration struct {
	Access               Access
	Identifier           Identifier
	ParameterList        *ParameterList
	ReturnTypeAnnotation *TypeAnnotation
	FunctionBlock        *FunctionBlock
	DocString            string
	StartPos             Position `json:"-"`
}

func (*FunctionDeclaration) Accept

func (d *FunctionDeclaration) Accept(visitor Visitor) Repr

func (*FunctionDeclaration) DeclarationAccess

func (d *FunctionDeclaration) DeclarationAccess() Access

func (*FunctionDeclaration) DeclarationIdentifier

func (d *FunctionDeclaration) DeclarationIdentifier() *Identifier

func (*FunctionDeclaration) DeclarationKind

func (d *FunctionDeclaration) DeclarationKind() common.DeclarationKind

func (*FunctionDeclaration) EndPosition

func (d *FunctionDeclaration) EndPosition() Position

func (*FunctionDeclaration) MarshalJSON added in v0.9.0

func (d *FunctionDeclaration) MarshalJSON() ([]byte, error)

func (*FunctionDeclaration) StartPosition

func (d *FunctionDeclaration) StartPosition() Position

func (*FunctionDeclaration) ToExpression

func (d *FunctionDeclaration) ToExpression() *FunctionExpression

type FunctionExpression

type FunctionExpression struct {
	ParameterList        *ParameterList
	ReturnTypeAnnotation *TypeAnnotation
	FunctionBlock        *FunctionBlock
	StartPos             Position `json:"-"`
}

func (*FunctionExpression) Accept

func (e *FunctionExpression) Accept(visitor Visitor) Repr

func (*FunctionExpression) AcceptExp

func (e *FunctionExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*FunctionExpression) EndPosition

func (e *FunctionExpression) EndPosition() Position

func (*FunctionExpression) MarshalJSON added in v0.9.0

func (e *FunctionExpression) MarshalJSON() ([]byte, error)

func (*FunctionExpression) StartPosition

func (e *FunctionExpression) StartPosition() Position

func (*FunctionExpression) String

func (e *FunctionExpression) String() string

type FunctionExtractor

type FunctionExtractor interface {
	ExtractFunction(extractor *ExpressionExtractor, expression *FunctionExpression) ExpressionExtraction
}

type FunctionType

type FunctionType struct {
	ParameterTypeAnnotations []*TypeAnnotation `json:",omitempty"`
	ReturnTypeAnnotation     *TypeAnnotation
	Range
}

func (*FunctionType) MarshalJSON added in v0.9.0

func (t *FunctionType) MarshalJSON() ([]byte, error)

func (*FunctionType) String

func (t *FunctionType) String() string

type HasImportLocation

type HasImportLocation interface {
	ImportLocation() Location
}

type HasPosition

type HasPosition interface {
	StartPosition() Position
	EndPosition() Position
}

type Identifier

type Identifier struct {
	Identifier string
	Pos        Position
}

func (Identifier) EndPosition

func (i Identifier) EndPosition() Position

func (Identifier) MarshalJSON added in v0.8.0

func (i Identifier) MarshalJSON() ([]byte, error)

func (Identifier) StartPosition

func (i Identifier) StartPosition() Position

func (Identifier) String

func (i Identifier) String() string

type IdentifierExpression

type IdentifierExpression struct {
	Identifier Identifier
}

func (*IdentifierExpression) Accept

func (e *IdentifierExpression) Accept(visitor Visitor) Repr

func (*IdentifierExpression) AcceptExp

func (e *IdentifierExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IdentifierExpression) EndPosition added in v0.8.0

func (e *IdentifierExpression) EndPosition() Position

func (*IdentifierExpression) MarshalJSON added in v0.8.0

func (e *IdentifierExpression) MarshalJSON() ([]byte, error)

func (*IdentifierExpression) StartPosition added in v0.8.0

func (e *IdentifierExpression) StartPosition() Position

func (*IdentifierExpression) String

func (e *IdentifierExpression) String() string

type IdentifierExtractor

type IdentifierExtractor interface {
	ExtractIdentifier(extractor *ExpressionExtractor, expression *IdentifierExpression) ExpressionExtraction
}

type IdentifierLocation added in v0.5.0

type IdentifierLocation string

func (IdentifierLocation) ID added in v0.5.0

func (IdentifierLocation) MarshalJSON added in v0.9.0

func (l IdentifierLocation) MarshalJSON() ([]byte, error)

func (IdentifierLocation) QualifiedIdentifier added in v0.10.2

func (l IdentifierLocation) QualifiedIdentifier(typeID TypeID) string

func (IdentifierLocation) TypeID added in v0.10.2

func (l IdentifierLocation) TypeID(qualifiedIdentifier string) TypeID

type IfStatement

type IfStatement struct {
	Test     IfStatementTest
	Then     *Block
	Else     *Block
	StartPos Position `json:"-"`
}

func (*IfStatement) Accept

func (s *IfStatement) Accept(visitor Visitor) Repr

func (*IfStatement) EndPosition

func (s *IfStatement) EndPosition() Position

func (*IfStatement) MarshalJSON added in v0.8.0

func (s *IfStatement) MarshalJSON() ([]byte, error)

func (*IfStatement) StartPosition

func (s *IfStatement) StartPosition() Position

type IfStatementTest

type IfStatementTest interface {
	// contains filtered or unexported methods
}

type ImportDeclaration

type ImportDeclaration struct {
	Identifiers []Identifier
	Location    Location
	LocationPos Position
	Range
}

func (*ImportDeclaration) Accept

func (d *ImportDeclaration) Accept(visitor Visitor) Repr

func (*ImportDeclaration) DeclarationAccess

func (d *ImportDeclaration) DeclarationAccess() Access

func (*ImportDeclaration) DeclarationIdentifier

func (d *ImportDeclaration) DeclarationIdentifier() *Identifier

func (*ImportDeclaration) DeclarationKind

func (d *ImportDeclaration) DeclarationKind() common.DeclarationKind

func (*ImportDeclaration) MarshalJSON added in v0.9.0

func (d *ImportDeclaration) MarshalJSON() ([]byte, error)

type IndexExpression

type IndexExpression struct {
	TargetExpression   Expression
	IndexingExpression Expression
	Range
}

func (*IndexExpression) Accept

func (e *IndexExpression) Accept(visitor Visitor) Repr

func (*IndexExpression) AcceptExp

func (e *IndexExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IndexExpression) AccessedExpression

func (e *IndexExpression) AccessedExpression() Expression

func (*IndexExpression) MarshalJSON added in v0.8.0

func (e *IndexExpression) MarshalJSON() ([]byte, error)

func (*IndexExpression) String

func (e *IndexExpression) String() string

type IndexExtractor

type IndexExtractor interface {
	ExtractIndex(extractor *ExpressionExtractor, expression *IndexExpression) ExpressionExtraction
}

type InstantiationType added in v0.5.0

type InstantiationType struct {
	Type                  Type `json:"InstantiatedType"`
	TypeArguments         []*TypeAnnotation
	TypeArgumentsStartPos Position
	EndPos                Position `json:"-"`
}

func (*InstantiationType) EndPosition added in v0.5.0

func (t *InstantiationType) EndPosition() Position

func (*InstantiationType) MarshalJSON added in v0.9.0

func (t *InstantiationType) MarshalJSON() ([]byte, error)

func (*InstantiationType) StartPosition added in v0.5.0

func (t *InstantiationType) StartPosition() Position

func (*InstantiationType) String added in v0.5.0

func (t *InstantiationType) String() string

type IntExtractor

type IntExtractor interface {
	ExtractInteger(extractor *ExpressionExtractor, expression *IntegerExpression) ExpressionExtraction
}

type IntegerExpression

type IntegerExpression struct {
	Value *big.Int `json:"-"`
	Base  int
	Range
}

func (*IntegerExpression) Accept

func (e *IntegerExpression) Accept(visitor Visitor) Repr

func (*IntegerExpression) AcceptExp

func (e *IntegerExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*IntegerExpression) MarshalJSON added in v0.8.0

func (e *IntegerExpression) MarshalJSON() ([]byte, error)

func (*IntegerExpression) String

func (e *IntegerExpression) String() string

type InterfaceDeclaration

type InterfaceDeclaration struct {
	Access        Access
	CompositeKind common.CompositeKind
	Identifier    Identifier
	Members       *Members
	DocString     string
	Range
}

func (*InterfaceDeclaration) Accept

func (d *InterfaceDeclaration) Accept(visitor Visitor) Repr

func (*InterfaceDeclaration) DeclarationAccess

func (d *InterfaceDeclaration) DeclarationAccess() Access

func (*InterfaceDeclaration) DeclarationIdentifier

func (d *InterfaceDeclaration) DeclarationIdentifier() *Identifier

func (*InterfaceDeclaration) DeclarationKind

func (d *InterfaceDeclaration) DeclarationKind() common.DeclarationKind

func (*InterfaceDeclaration) MarshalJSON added in v0.9.0

func (d *InterfaceDeclaration) MarshalJSON() ([]byte, error)

type InvocationExpression

type InvocationExpression struct {
	InvokedExpression Expression
	TypeArguments     []*TypeAnnotation
	Arguments         Arguments
	EndPos            Position `json:"-"`
}

func (*InvocationExpression) Accept

func (e *InvocationExpression) Accept(visitor Visitor) Repr

func (*InvocationExpression) AcceptExp

func (e *InvocationExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*InvocationExpression) EndPosition

func (e *InvocationExpression) EndPosition() Position

func (*InvocationExpression) MarshalJSON added in v0.9.0

func (e *InvocationExpression) MarshalJSON() ([]byte, error)

func (*InvocationExpression) StartPosition

func (e *InvocationExpression) StartPosition() Position

func (*InvocationExpression) String

func (e *InvocationExpression) String() string

type InvocationExtractor

type InvocationExtractor interface {
	ExtractInvocation(extractor *ExpressionExtractor, expression *InvocationExpression) ExpressionExtraction
}

type Location

type Location interface {
	// ID returns the canonical ID for this import location.
	ID() LocationID
	// TypeID returns a type ID for the given qualified identifier
	TypeID(qualifiedIdentifier string) TypeID
	// QualifiedIdentifier returns the qualified identifier for the given type ID
	QualifiedIdentifier(typeID TypeID) string
}

Location describes the origin of a Cadence script. This could be a file, a transaction, or a smart contract.

func LocationFromTypeID added in v0.2.0

func LocationFromTypeID(typeID string) Location

type LocationID

type LocationID string

LocationID

func NewLocationID added in v0.5.0

func NewLocationID(parts ...string) LocationID

type MemberExpression

type MemberExpression struct {
	Expression Expression
	Optional   bool
	// The position of the token (`.`, `?.`) that separates the accessed expression
	// and the identifier of the member
	AccessPos  Position
	Identifier Identifier
}

func (*MemberExpression) Accept

func (e *MemberExpression) Accept(visitor Visitor) Repr

func (*MemberExpression) AcceptExp

func (e *MemberExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*MemberExpression) AccessedExpression

func (e *MemberExpression) AccessedExpression() Expression

func (*MemberExpression) EndPosition

func (e *MemberExpression) EndPosition() Position

func (*MemberExpression) MarshalJSON added in v0.8.0

func (e *MemberExpression) MarshalJSON() ([]byte, error)

func (*MemberExpression) StartPosition

func (e *MemberExpression) StartPosition() Position

func (*MemberExpression) String

func (e *MemberExpression) String() string

type MemberExtractor

type MemberExtractor interface {
	ExtractMember(extractor *ExpressionExtractor, expression *MemberExpression) ExpressionExtraction
}

type Members

type Members struct {
	Declarations []Declaration
	// contains filtered or unexported fields
}

func (*Members) Composites added in v0.10.0

func (m *Members) Composites() []*CompositeDeclaration

func (*Members) Destructor

func (m *Members) Destructor() *SpecialFunctionDeclaration

Destructor returns the first destructor, if any

func (*Members) Destructors

func (m *Members) Destructors() []*SpecialFunctionDeclaration

func (*Members) EnumCases added in v0.10.0

func (m *Members) EnumCases() []*EnumCaseDeclaration

func (*Members) FieldPosition

func (m *Members) FieldPosition(name string, compositeKind common.CompositeKind) Position

func (*Members) Fields

func (m *Members) Fields() []*FieldDeclaration

func (*Members) FieldsByIdentifier

func (m *Members) FieldsByIdentifier() map[string]*FieldDeclaration

func (*Members) Functions

func (m *Members) Functions() []*FunctionDeclaration

func (*Members) FunctionsByIdentifier

func (m *Members) FunctionsByIdentifier() map[string]*FunctionDeclaration

func (*Members) Initializers

func (m *Members) Initializers() []*SpecialFunctionDeclaration

func (*Members) Interfaces added in v0.10.0

func (m *Members) Interfaces() []*InterfaceDeclaration

func (*Members) SpecialFunctions

func (m *Members) SpecialFunctions() []*SpecialFunctionDeclaration

type NilExpression

type NilExpression struct {
	Pos Position `json:"-"`
}

func (*NilExpression) Accept

func (e *NilExpression) Accept(visitor Visitor) Repr

func (*NilExpression) AcceptExp

func (e *NilExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*NilExpression) EndPosition

func (e *NilExpression) EndPosition() Position

func (*NilExpression) MarshalJSON added in v0.5.0

func (e *NilExpression) MarshalJSON() ([]byte, error)

func (*NilExpression) StartPosition

func (e *NilExpression) StartPosition() Position

func (*NilExpression) String

func (e *NilExpression) String() string

type NilExtractor

type NilExtractor interface {
	ExtractNil(extractor *ExpressionExtractor, expression *NilExpression) ExpressionExtraction
}

type NominalType

type NominalType struct {
	Identifier        Identifier
	NestedIdentifiers []Identifier `json:",omitempty"`
}

func (*NominalType) EndPosition

func (t *NominalType) EndPosition() Position

func (*NominalType) MarshalJSON added in v0.9.0

func (t *NominalType) MarshalJSON() ([]byte, error)

func (*NominalType) StartPosition

func (t *NominalType) StartPosition() Position

func (*NominalType) String

func (t *NominalType) String() string

type NotAnElement

type NotAnElement struct{}

func (NotAnElement) Accept

func (NotAnElement) Accept(Visitor) Repr

func (NotAnElement) EndPosition

func (NotAnElement) EndPosition() Position

func (NotAnElement) StartPosition

func (NotAnElement) StartPosition() Position

type Operation

type Operation uint
const (
	OperationUnknown Operation = iota
	OperationOr
	OperationAnd
	OperationEqual
	OperationNotEqual
	OperationLess
	OperationGreater
	OperationLessEqual
	OperationGreaterEqual
	OperationPlus
	OperationMinus
	OperationMul
	OperationDiv
	OperationMod
	OperationNegate
	OperationNilCoalesce
	OperationMove
	OperationCast
	OperationFailableCast
	OperationForceCast
	OperationBitwiseOr
	OperationBitwiseXor
	OperationBitwiseAnd
	OperationBitwiseLeftShift
	OperationBitwiseRightShift
)

func (Operation) MarshalJSON added in v0.8.0

func (s Operation) MarshalJSON() ([]byte, error)

func (Operation) String

func (i Operation) String() string

func (Operation) Symbol

func (s Operation) Symbol() string

type OptionalType

type OptionalType struct {
	Type   Type     `json:"ElementType"`
	EndPos Position `json:"-"`
}

func (*OptionalType) EndPosition

func (t *OptionalType) EndPosition() Position

func (*OptionalType) MarshalJSON added in v0.9.0

func (t *OptionalType) MarshalJSON() ([]byte, error)

func (*OptionalType) StartPosition

func (t *OptionalType) StartPosition() Position

func (*OptionalType) String

func (t *OptionalType) String() string

type Parameter

type Parameter struct {
	Label          string
	Identifier     Identifier
	TypeAnnotation *TypeAnnotation
	Range
}

func (Parameter) EffectiveArgumentLabel

func (p Parameter) EffectiveArgumentLabel() string

EffectiveArgumentLabel returns the effective argument label that an argument in a call must use: If no argument label is declared for parameter, the parameter name is used as the argument label

type ParameterList

type ParameterList struct {
	Parameters []*Parameter

	Range
	// contains filtered or unexported fields
}

func (*ParameterList) EffectiveArgumentLabels

func (l *ParameterList) EffectiveArgumentLabels() []string

EffectiveArgumentLabels returns the effective argument labels that the arguments of a call must use: If no argument label is declared for parameter, the parameter name is used as the argument label

func (*ParameterList) ParametersByIdentifier

func (l *ParameterList) ParametersByIdentifier() map[string]*Parameter

type PathExpression

type PathExpression struct {
	StartPos   Position `json:"-"`
	Domain     Identifier
	Identifier Identifier
}

func (*PathExpression) Accept

func (e *PathExpression) Accept(visitor Visitor) Repr

func (*PathExpression) AcceptExp

func (e *PathExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*PathExpression) EndPosition

func (e *PathExpression) EndPosition() Position

func (*PathExpression) MarshalJSON added in v0.8.0

func (e *PathExpression) MarshalJSON() ([]byte, error)

func (*PathExpression) StartPosition

func (e *PathExpression) StartPosition() Position

func (*PathExpression) String

func (e *PathExpression) String() string

type PathExtractor

type PathExtractor interface {
	ExtractPath(extractor *ExpressionExtractor, expression *PathExpression) ExpressionExtraction
}

type Position

type Position struct {
	// offset, starting at 0
	Offset int
	// line number, starting at 1
	Line int
	// column number, starting at 0 (byte count)
	Column int
}

Position defines a row/column within a Cadence script.

func EndPosition

func EndPosition(startPosition Position, end int) Position

func (Position) Compare

func (position Position) Compare(other Position) int

func (Position) Hash

func (position Position) Hash() (result uint32)

func (Position) Shifted

func (position Position) Shifted(length int) Position

type PragmaDeclaration added in v0.7.0

type PragmaDeclaration struct {
	Expression Expression
	Range
}

func (*PragmaDeclaration) Accept added in v0.7.0

func (d *PragmaDeclaration) Accept(visitor Visitor) Repr

func (*PragmaDeclaration) DeclarationAccess added in v0.7.0

func (d *PragmaDeclaration) DeclarationAccess() Access

func (*PragmaDeclaration) DeclarationIdentifier added in v0.7.0

func (d *PragmaDeclaration) DeclarationIdentifier() *Identifier

func (*PragmaDeclaration) DeclarationKind added in v0.7.0

func (d *PragmaDeclaration) DeclarationKind() common.DeclarationKind

func (*PragmaDeclaration) MarshalJSON added in v0.9.0

func (d *PragmaDeclaration) MarshalJSON() ([]byte, error)

type Program

type Program struct {
	// all declarations, in the order they are defined
	Declarations []Declaration
	// contains filtered or unexported fields
}

func (*Program) Accept

func (p *Program) Accept(visitor Visitor) Repr

func (*Program) CompositeDeclarations

func (p *Program) CompositeDeclarations() []*CompositeDeclaration

func (*Program) EndPosition

func (p *Program) EndPosition() Position

func (*Program) FunctionDeclarations

func (p *Program) FunctionDeclarations() []*FunctionDeclaration

func (*Program) ImportDeclarations

func (p *Program) ImportDeclarations() []*ImportDeclaration

func (*Program) InterfaceDeclarations

func (p *Program) InterfaceDeclarations() []*InterfaceDeclaration

func (*Program) MarshalJSON added in v0.10.0

func (p *Program) MarshalJSON() ([]byte, error)

func (*Program) PragmaDeclarations added in v0.7.0

func (p *Program) PragmaDeclarations() []*PragmaDeclaration

func (*Program) StartPosition

func (p *Program) StartPosition() Position

func (*Program) TransactionDeclarations

func (p *Program) TransactionDeclarations() []*TransactionDeclaration

type Range

type Range struct {
	StartPos Position
	EndPos   Position
}

func NewRangeFromPositioned

func NewRangeFromPositioned(hasPosition HasPosition) Range

func (*Range) EndPosition

func (e *Range) EndPosition() Position

func (*Range) StartPosition

func (e *Range) StartPosition() Position

type ReferenceExpression

type ReferenceExpression struct {
	Expression Expression
	Type       Type     `json:"TargetType"`
	StartPos   Position `json:"-"`
}

func (*ReferenceExpression) Accept

func (e *ReferenceExpression) Accept(visitor Visitor) Repr

func (*ReferenceExpression) AcceptExp

func (e *ReferenceExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*ReferenceExpression) EndPosition

func (e *ReferenceExpression) EndPosition() Position

func (*ReferenceExpression) MarshalJSON added in v0.9.0

func (e *ReferenceExpression) MarshalJSON() ([]byte, error)

func (*ReferenceExpression) StartPosition

func (e *ReferenceExpression) StartPosition() Position

func (*ReferenceExpression) String

func (e *ReferenceExpression) String() string

type ReferenceExtractor

type ReferenceExtractor interface {
	ExtractReference(extractor *ExpressionExtractor, expression *ReferenceExpression) ExpressionExtraction
}

type ReferenceType

type ReferenceType struct {
	Authorized bool
	Type       Type     `json:"ReferencedType"`
	StartPos   Position `json:"-"`
}

func (*ReferenceType) EndPosition

func (t *ReferenceType) EndPosition() Position

func (*ReferenceType) MarshalJSON added in v0.9.0

func (t *ReferenceType) MarshalJSON() ([]byte, error)

func (*ReferenceType) StartPosition

func (t *ReferenceType) StartPosition() Position

func (*ReferenceType) String

func (t *ReferenceType) String() string

type Repr

type Repr interface{}

type RestrictedType

type RestrictedType struct {
	Type         Type `json:"RestrictedType"`
	Restrictions []*NominalType
	Range
}

func (*RestrictedType) MarshalJSON added in v0.9.0

func (t *RestrictedType) MarshalJSON() ([]byte, error)

func (*RestrictedType) String

func (t *RestrictedType) String() string

type ReturnStatement

type ReturnStatement struct {
	Expression Expression
	Range
}

func (*ReturnStatement) Accept

func (s *ReturnStatement) Accept(visitor Visitor) Repr

func (*ReturnStatement) MarshalJSON added in v0.8.0

func (s *ReturnStatement) MarshalJSON() ([]byte, error)

type SpecialFunctionDeclaration

type SpecialFunctionDeclaration struct {
	Kind                common.DeclarationKind
	FunctionDeclaration *FunctionDeclaration
}

func (*SpecialFunctionDeclaration) Accept added in v0.9.0

func (d *SpecialFunctionDeclaration) Accept(visitor Visitor) Repr

func (*SpecialFunctionDeclaration) DeclarationAccess added in v0.9.0

func (d *SpecialFunctionDeclaration) DeclarationAccess() Access

func (*SpecialFunctionDeclaration) DeclarationIdentifier added in v0.9.0

func (d *SpecialFunctionDeclaration) DeclarationIdentifier() *Identifier

func (*SpecialFunctionDeclaration) DeclarationKind

func (d *SpecialFunctionDeclaration) DeclarationKind() common.DeclarationKind

func (*SpecialFunctionDeclaration) EndPosition added in v0.9.0

func (d *SpecialFunctionDeclaration) EndPosition() Position

func (*SpecialFunctionDeclaration) MarshalJSON added in v0.9.0

func (d *SpecialFunctionDeclaration) MarshalJSON() ([]byte, error)

func (*SpecialFunctionDeclaration) StartPosition added in v0.9.0

func (d *SpecialFunctionDeclaration) StartPosition() Position

type Statement

type Statement interface {
	Element
	// contains filtered or unexported methods
}

type StatementVisitor

type StatementVisitor interface {
	VisitReturnStatement(*ReturnStatement) Repr
	VisitBreakStatement(*BreakStatement) Repr
	VisitContinueStatement(*ContinueStatement) Repr
	VisitIfStatement(*IfStatement) Repr
	VisitSwitchStatement(*SwitchStatement) Repr
	VisitWhileStatement(*WhileStatement) Repr
	VisitForStatement(*ForStatement) Repr
	VisitEmitStatement(*EmitStatement) Repr
	VisitVariableDeclaration(*VariableDeclaration) Repr
	VisitAssignmentStatement(*AssignmentStatement) Repr
	VisitSwapStatement(*SwapStatement) Repr
	VisitExpressionStatement(*ExpressionStatement) Repr
}

type StringExpression

type StringExpression struct {
	Value string
	Range
}

func (*StringExpression) Accept

func (e *StringExpression) Accept(visitor Visitor) Repr

func (*StringExpression) AcceptExp

func (e *StringExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*StringExpression) MarshalJSON added in v0.8.0

func (e *StringExpression) MarshalJSON() ([]byte, error)

func (*StringExpression) String

func (e *StringExpression) String() string

type StringExtractor

type StringExtractor interface {
	ExtractString(extractor *ExpressionExtractor, expression *StringExpression) ExpressionExtraction
}

type StringLocation

type StringLocation string

StringLocation

func (StringLocation) ID

func (l StringLocation) ID() LocationID

func (StringLocation) MarshalJSON added in v0.9.0

func (l StringLocation) MarshalJSON() ([]byte, error)

func (StringLocation) QualifiedIdentifier added in v0.10.2

func (l StringLocation) QualifiedIdentifier(typeID TypeID) string

func (StringLocation) TypeID added in v0.10.2

func (l StringLocation) TypeID(qualifiedIdentifier string) TypeID

type SwapStatement

type SwapStatement struct {
	Left  Expression
	Right Expression
}

func (*SwapStatement) Accept

func (s *SwapStatement) Accept(visitor Visitor) Repr

func (*SwapStatement) EndPosition

func (s *SwapStatement) EndPosition() Position

func (*SwapStatement) MarshalJSON added in v0.9.0

func (s *SwapStatement) MarshalJSON() ([]byte, error)

func (*SwapStatement) StartPosition

func (s *SwapStatement) StartPosition() Position

type SwitchCase added in v0.10.0

type SwitchCase struct {
	Expression Expression
	Statements []Statement
	Range
}

func (*SwitchCase) MarshalJSON added in v0.10.0

func (s *SwitchCase) MarshalJSON() ([]byte, error)

type SwitchStatement added in v0.10.0

type SwitchStatement struct {
	Expression Expression
	Cases      []*SwitchCase
	Range
}

func (*SwitchStatement) Accept added in v0.10.0

func (s *SwitchStatement) Accept(visitor Visitor) Repr

func (*SwitchStatement) MarshalJSON added in v0.10.0

func (s *SwitchStatement) MarshalJSON() ([]byte, error)

type TransactionDeclaration

type TransactionDeclaration struct {
	ParameterList  *ParameterList
	Fields         []*FieldDeclaration
	Prepare        *SpecialFunctionDeclaration
	PreConditions  *Conditions
	PostConditions *Conditions
	Execute        *SpecialFunctionDeclaration
	Range
}

func (*TransactionDeclaration) Accept

func (d *TransactionDeclaration) Accept(visitor Visitor) Repr

func (*TransactionDeclaration) DeclarationAccess

func (d *TransactionDeclaration) DeclarationAccess() Access

func (*TransactionDeclaration) DeclarationIdentifier

func (d *TransactionDeclaration) DeclarationIdentifier() *Identifier

func (*TransactionDeclaration) DeclarationKind

func (d *TransactionDeclaration) DeclarationKind() common.DeclarationKind

func (*TransactionDeclaration) MarshalJSON added in v0.9.0

func (d *TransactionDeclaration) MarshalJSON() ([]byte, error)

type Transfer

type Transfer struct {
	Operation TransferOperation
	Pos       Position `json:"-"`
}

Transfer represents the operation in variable declarations and assignments

func (Transfer) EndPosition

func (f Transfer) EndPosition() Position

func (Transfer) MarshalJSON added in v0.8.0

func (f Transfer) MarshalJSON() ([]byte, error)

func (Transfer) StartPosition

func (f Transfer) StartPosition() Position

type TransferOperation

type TransferOperation uint
const (
	TransferOperationUnknown TransferOperation = iota
	TransferOperationCopy
	TransferOperationMove
	TransferOperationMoveForced
)

func (TransferOperation) IsMove

func (k TransferOperation) IsMove() bool

func (TransferOperation) MarshalJSON added in v0.8.0

func (k TransferOperation) MarshalJSON() ([]byte, error)

func (TransferOperation) Operator

func (k TransferOperation) Operator() string

func (TransferOperation) String

func (i TransferOperation) String() string

type Type

type Type interface {
	HasPosition
	fmt.Stringer
	// contains filtered or unexported methods
}

func ExpressionAsType

func ExpressionAsType(expression Expression) Type

ExpressionAsType attempts to convert an expression to a type. Some expressions can be considered both an expression and a type

type TypeAnnotation

type TypeAnnotation struct {
	IsResource bool
	Type       Type     `json:"AnnotatedType"`
	StartPos   Position `json:"-"`
}

func (*TypeAnnotation) EndPosition

func (t *TypeAnnotation) EndPosition() Position

func (*TypeAnnotation) MarshalJSON added in v0.9.0

func (t *TypeAnnotation) MarshalJSON() ([]byte, error)

func (*TypeAnnotation) StartPosition

func (t *TypeAnnotation) StartPosition() Position

func (*TypeAnnotation) String

func (t *TypeAnnotation) String() string

type TypeID added in v0.10.2

type TypeID string

TypeID

func NewTypeID added in v0.10.2

func NewTypeID(parts ...string) TypeID

type UnaryExpression

type UnaryExpression struct {
	Operation  Operation
	Expression Expression
	StartPos   Position `json:"-"`
}

func (*UnaryExpression) Accept

func (e *UnaryExpression) Accept(visitor Visitor) Repr

func (*UnaryExpression) AcceptExp

func (e *UnaryExpression) AcceptExp(visitor ExpressionVisitor) Repr

func (*UnaryExpression) EndPosition added in v0.2.1

func (e *UnaryExpression) EndPosition() Position

func (*UnaryExpression) MarshalJSON added in v0.9.0

func (e *UnaryExpression) MarshalJSON() ([]byte, error)

func (*UnaryExpression) StartPosition added in v0.2.1

func (e *UnaryExpression) StartPosition() Position

func (*UnaryExpression) String

func (e *UnaryExpression) String() string

type UnaryExtractor

type UnaryExtractor interface {
	ExtractUnary(extractor *ExpressionExtractor, expression *UnaryExpression) ExpressionExtraction
}

type VariableDeclaration

type VariableDeclaration struct {
	Access            Access
	IsConstant        bool
	Identifier        Identifier
	TypeAnnotation    *TypeAnnotation
	Value             Expression
	Transfer          *Transfer
	StartPos          Position `json:"-"`
	SecondTransfer    *Transfer
	SecondValue       Expression
	ParentIfStatement *IfStatement `json:"-"`
	DocString         string
}

func (*VariableDeclaration) Accept

func (d *VariableDeclaration) Accept(visitor Visitor) Repr

func (*VariableDeclaration) DeclarationAccess

func (d *VariableDeclaration) DeclarationAccess() Access

func (*VariableDeclaration) DeclarationIdentifier

func (d *VariableDeclaration) DeclarationIdentifier() *Identifier

func (*VariableDeclaration) DeclarationKind

func (d *VariableDeclaration) DeclarationKind() common.DeclarationKind

func (*VariableDeclaration) EndPosition

func (d *VariableDeclaration) EndPosition() Position

func (*VariableDeclaration) MarshalJSON added in v0.9.0

func (d *VariableDeclaration) MarshalJSON() ([]byte, error)

func (*VariableDeclaration) StartPosition

func (d *VariableDeclaration) StartPosition() Position

type VariableKind

type VariableKind uint
const (
	VariableKindNotSpecified VariableKind = iota
	VariableKindVariable
	VariableKindConstant
)

func (VariableKind) Keyword

func (k VariableKind) Keyword() string

func (VariableKind) MarshalJSON added in v0.8.0

func (k VariableKind) MarshalJSON() ([]byte, error)

func (VariableKind) Name

func (k VariableKind) Name() string

func (VariableKind) String

func (i VariableKind) String() string

type VariableSizedType

type VariableSizedType struct {
	Type Type `json:"ElementType"`
	Range
}

func (*VariableSizedType) MarshalJSON added in v0.9.0

func (t *VariableSizedType) MarshalJSON() ([]byte, error)

func (*VariableSizedType) String

func (t *VariableSizedType) String() string

type Visitor

type Visitor interface {
	StatementVisitor
	ExpressionVisitor
	VisitProgram(*Program) Repr
	VisitFunctionDeclaration(*FunctionDeclaration) Repr
	VisitBlock(*Block) Repr
	VisitFunctionBlock(*FunctionBlock) Repr
	VisitCompositeDeclaration(*CompositeDeclaration) Repr
	VisitInterfaceDeclaration(*InterfaceDeclaration) Repr
	VisitFieldDeclaration(*FieldDeclaration) Repr
	VisitEnumCaseDeclaration(*EnumCaseDeclaration) Repr
	VisitCondition(*Condition) Repr
	VisitPragmaDeclaration(*PragmaDeclaration) Repr
	VisitImportDeclaration(*ImportDeclaration) Repr
	VisitTransactionDeclaration(*TransactionDeclaration) Repr
}

type WhileStatement

type WhileStatement struct {
	Test     Expression
	Block    *Block
	StartPos Position `json:"-"`
}

func (*WhileStatement) Accept

func (s *WhileStatement) Accept(visitor Visitor) Repr

func (*WhileStatement) EndPosition

func (s *WhileStatement) EndPosition() Position

func (*WhileStatement) MarshalJSON added in v0.8.0

func (s *WhileStatement) MarshalJSON() ([]byte, error)

func (*WhileStatement) StartPosition

func (s *WhileStatement) StartPosition() Position

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL