ast

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthAst        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAst          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAst = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Stringify

func Stringify(exp *Expression) string

Types

type ArrayLiteral

type ArrayLiteral struct {
	Token    token.Token   `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Elements []*Expression `protobuf:"bytes,2,rep,name=elements,proto3" json:"elements,omitempty"`
}

func UnwrapArrayLiteral

func UnwrapArrayLiteral(expr *Expression) (*ArrayLiteral, bool)

func (*ArrayLiteral) Descriptor

func (*ArrayLiteral) Descriptor() ([]byte, []int)

func (*ArrayLiteral) GetElements

func (m *ArrayLiteral) GetElements() []*Expression

func (*ArrayLiteral) GetToken

func (m *ArrayLiteral) GetToken() token.Token

func (*ArrayLiteral) Marshal

func (m *ArrayLiteral) Marshal() (dAtA []byte, err error)

func (*ArrayLiteral) MarshalTo

func (m *ArrayLiteral) MarshalTo(dAtA []byte) (int, error)

func (*ArrayLiteral) MarshalToSizedBuffer

func (m *ArrayLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ArrayLiteral) ProtoMessage

func (*ArrayLiteral) ProtoMessage()

func (*ArrayLiteral) Reset

func (m *ArrayLiteral) Reset()

func (*ArrayLiteral) Size

func (m *ArrayLiteral) Size() (n int)

func (*ArrayLiteral) String

func (m *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (al *ArrayLiteral) TokenLiteral() string

func (*ArrayLiteral) Unmarshal

func (m *ArrayLiteral) Unmarshal(dAtA []byte) error

func (*ArrayLiteral) XXX_DiscardUnknown

func (m *ArrayLiteral) XXX_DiscardUnknown()

func (*ArrayLiteral) XXX_Marshal

func (m *ArrayLiteral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ArrayLiteral) XXX_Merge

func (m *ArrayLiteral) XXX_Merge(src proto.Message)

func (*ArrayLiteral) XXX_Size

func (m *ArrayLiteral) XXX_Size() int

func (*ArrayLiteral) XXX_Unmarshal

func (m *ArrayLiteral) XXX_Unmarshal(b []byte) error

type BooleanLiteral

type BooleanLiteral struct {
	Token token.Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Value bool        `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
}

func UnwrapBooleanLiteral

func UnwrapBooleanLiteral(expr *Expression) (*BooleanLiteral, bool)

func (*BooleanLiteral) Descriptor

func (*BooleanLiteral) Descriptor() ([]byte, []int)

func (*BooleanLiteral) GetToken

func (m *BooleanLiteral) GetToken() token.Token

func (*BooleanLiteral) GetValue

func (m *BooleanLiteral) GetValue() bool

func (*BooleanLiteral) Marshal

func (m *BooleanLiteral) Marshal() (dAtA []byte, err error)

func (*BooleanLiteral) MarshalTo

func (m *BooleanLiteral) MarshalTo(dAtA []byte) (int, error)

func (*BooleanLiteral) MarshalToSizedBuffer

func (m *BooleanLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BooleanLiteral) ProtoMessage

func (*BooleanLiteral) ProtoMessage()

func (*BooleanLiteral) Reset

func (m *BooleanLiteral) Reset()

func (*BooleanLiteral) Size

func (m *BooleanLiteral) Size() (n int)

func (*BooleanLiteral) String

func (m *BooleanLiteral) String() string

func (*BooleanLiteral) TokenLiteral

func (bl *BooleanLiteral) TokenLiteral() string

func (*BooleanLiteral) Unmarshal

func (m *BooleanLiteral) Unmarshal(dAtA []byte) error

func (*BooleanLiteral) XXX_DiscardUnknown

func (m *BooleanLiteral) XXX_DiscardUnknown()

func (*BooleanLiteral) XXX_Marshal

func (m *BooleanLiteral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BooleanLiteral) XXX_Merge

func (m *BooleanLiteral) XXX_Merge(src proto.Message)

func (*BooleanLiteral) XXX_Size

func (m *BooleanLiteral) XXX_Size() int

func (*BooleanLiteral) XXX_Unmarshal

func (m *BooleanLiteral) XXX_Unmarshal(b []byte) error

type CallExpression

type CallExpression struct {
	Token     token.Token   `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Function  *Identifier   `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"`
	Arguments []*Expression `protobuf:"bytes,3,rep,name=arguments,proto3" json:"arguments,omitempty"`
}

func UnwrapCallExpression

func UnwrapCallExpression(expr *Expression) (*CallExpression, bool)

func (*CallExpression) Descriptor

func (*CallExpression) Descriptor() ([]byte, []int)

func (*CallExpression) GetArguments

func (m *CallExpression) GetArguments() []*Expression

func (*CallExpression) GetFunction

func (m *CallExpression) GetFunction() *Identifier

func (*CallExpression) GetToken

func (m *CallExpression) GetToken() token.Token

func (*CallExpression) Marshal

func (m *CallExpression) Marshal() (dAtA []byte, err error)

func (*CallExpression) MarshalTo

func (m *CallExpression) MarshalTo(dAtA []byte) (int, error)

func (*CallExpression) MarshalToSizedBuffer

func (m *CallExpression) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CallExpression) ProtoMessage

func (*CallExpression) ProtoMessage()

func (*CallExpression) Reset

func (m *CallExpression) Reset()

func (*CallExpression) Size

func (m *CallExpression) Size() (n int)

func (*CallExpression) String

func (m *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

func (*CallExpression) Unmarshal

func (m *CallExpression) Unmarshal(dAtA []byte) error

func (*CallExpression) XXX_DiscardUnknown

func (m *CallExpression) XXX_DiscardUnknown()

func (*CallExpression) XXX_Marshal

func (m *CallExpression) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CallExpression) XXX_Merge

func (m *CallExpression) XXX_Merge(src proto.Message)

func (*CallExpression) XXX_Size

func (m *CallExpression) XXX_Size() int

func (*CallExpression) XXX_Unmarshal

func (m *CallExpression) XXX_Unmarshal(b []byte) error

type Expander

type Expander interface {
	// Expand expands an identifier into another AST node.
	//
	// The expansion is done as a pre-processing step when an Action is
	// created, like a macro in some programming languages.
	// Custom modules can implement this interface to provide custom
	// expansions for their identifiers.
	//
	// A no-op expansion is to return the input identifier as a single-element.
	//
	// After the pre-processing step, the identifiers that are left must be
	// able to be resolved by the x/intent modules.
	Expand(ctx context.Context, ident *Identifier) (*Expression, error)
}

type Expression

type Expression struct {
	// Types that are valid to be assigned to Value:
	//	*Expression_Identifier
	//	*Expression_IntegerLiteral
	//	*Expression_BooleanLiteral
	//	*Expression_ArrayLiteral
	//	*Expression_CallExpression
	//	*Expression_InfixExpression
	Value isExpression_Value `protobuf_oneof:"value"`
}

func NewArrayLiteral

func NewArrayLiteral(array *ArrayLiteral) *Expression

func NewBooleanLiteral

func NewBooleanLiteral(boolean *BooleanLiteral) *Expression

func NewCallExpression

func NewCallExpression(call *CallExpression) *Expression

func NewExpression

func NewExpression(val isExpression_Value) *Expression

func NewIdentifier

func NewIdentifier(identifier *Identifier) *Expression

func NewInfixExpression

func NewInfixExpression(infix *InfixExpression) *Expression

func NewIntegerLiteral

func NewIntegerLiteral(integer *IntegerLiteral) *Expression

func (*Expression) Descriptor

func (*Expression) Descriptor() ([]byte, []int)

func (*Expression) GetArrayLiteral

func (m *Expression) GetArrayLiteral() *ArrayLiteral

func (*Expression) GetBooleanLiteral

func (m *Expression) GetBooleanLiteral() *BooleanLiteral

func (*Expression) GetCallExpression

func (m *Expression) GetCallExpression() *CallExpression

func (*Expression) GetIdentifier

func (m *Expression) GetIdentifier() *Identifier

func (*Expression) GetInfixExpression

func (m *Expression) GetInfixExpression() *InfixExpression

func (*Expression) GetIntegerLiteral

func (m *Expression) GetIntegerLiteral() *IntegerLiteral

func (*Expression) GetValue

func (m *Expression) GetValue() isExpression_Value

func (*Expression) Marshal

func (m *Expression) Marshal() (dAtA []byte, err error)

func (*Expression) MarshalTo

func (m *Expression) MarshalTo(dAtA []byte) (int, error)

func (*Expression) MarshalToSizedBuffer

func (m *Expression) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression) ProtoMessage

func (*Expression) ProtoMessage()

func (*Expression) Reset

func (m *Expression) Reset()

func (*Expression) Size

func (m *Expression) Size() (n int)

func (*Expression) String

func (m *Expression) String() string

func (*Expression) Unmarshal

func (m *Expression) Unmarshal(dAtA []byte) error

func (*Expression) XXX_DiscardUnknown

func (m *Expression) XXX_DiscardUnknown()

func (*Expression) XXX_Marshal

func (m *Expression) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Expression) XXX_Merge

func (m *Expression) XXX_Merge(src proto.Message)

func (*Expression) XXX_OneofWrappers

func (*Expression) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*Expression) XXX_Size

func (m *Expression) XXX_Size() int

func (*Expression) XXX_Unmarshal

func (m *Expression) XXX_Unmarshal(b []byte) error

type Expression_ArrayLiteral

type Expression_ArrayLiteral struct {
	ArrayLiteral *ArrayLiteral `protobuf:"bytes,4,opt,name=array_literal,json=arrayLiteral,proto3,oneof" json:"array_literal,omitempty"`
}

func (*Expression_ArrayLiteral) MarshalTo

func (m *Expression_ArrayLiteral) MarshalTo(dAtA []byte) (int, error)

func (*Expression_ArrayLiteral) MarshalToSizedBuffer

func (m *Expression_ArrayLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_ArrayLiteral) Size

func (m *Expression_ArrayLiteral) Size() (n int)

type Expression_BooleanLiteral

type Expression_BooleanLiteral struct {
	BooleanLiteral *BooleanLiteral `protobuf:"bytes,3,opt,name=boolean_literal,json=booleanLiteral,proto3,oneof" json:"boolean_literal,omitempty"`
}

func (*Expression_BooleanLiteral) MarshalTo

func (m *Expression_BooleanLiteral) MarshalTo(dAtA []byte) (int, error)

func (*Expression_BooleanLiteral) MarshalToSizedBuffer

func (m *Expression_BooleanLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_BooleanLiteral) Size

func (m *Expression_BooleanLiteral) Size() (n int)

type Expression_CallExpression

type Expression_CallExpression struct {
	CallExpression *CallExpression `protobuf:"bytes,5,opt,name=call_expression,json=callExpression,proto3,oneof" json:"call_expression,omitempty"`
}

func (*Expression_CallExpression) MarshalTo

func (m *Expression_CallExpression) MarshalTo(dAtA []byte) (int, error)

func (*Expression_CallExpression) MarshalToSizedBuffer

func (m *Expression_CallExpression) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_CallExpression) Size

func (m *Expression_CallExpression) Size() (n int)

type Expression_Identifier

type Expression_Identifier struct {
	Identifier *Identifier `protobuf:"bytes,1,opt,name=identifier,proto3,oneof" json:"identifier,omitempty"`
}

func (*Expression_Identifier) MarshalTo

func (m *Expression_Identifier) MarshalTo(dAtA []byte) (int, error)

func (*Expression_Identifier) MarshalToSizedBuffer

func (m *Expression_Identifier) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_Identifier) Size

func (m *Expression_Identifier) Size() (n int)

type Expression_InfixExpression

type Expression_InfixExpression struct {
	InfixExpression *InfixExpression `protobuf:"bytes,6,opt,name=infix_expression,json=infixExpression,proto3,oneof" json:"infix_expression,omitempty"`
}

func (*Expression_InfixExpression) MarshalTo

func (m *Expression_InfixExpression) MarshalTo(dAtA []byte) (int, error)

func (*Expression_InfixExpression) MarshalToSizedBuffer

func (m *Expression_InfixExpression) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_InfixExpression) Size

func (m *Expression_InfixExpression) Size() (n int)

type Expression_IntegerLiteral

type Expression_IntegerLiteral struct {
	IntegerLiteral *IntegerLiteral `protobuf:"bytes,2,opt,name=integer_literal,json=integerLiteral,proto3,oneof" json:"integer_literal,omitempty"`
}

func (*Expression_IntegerLiteral) MarshalTo

func (m *Expression_IntegerLiteral) MarshalTo(dAtA []byte) (int, error)

func (*Expression_IntegerLiteral) MarshalToSizedBuffer

func (m *Expression_IntegerLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Expression_IntegerLiteral) Size

func (m *Expression_IntegerLiteral) Size() (n int)

type Identifier

type Identifier struct {
	Token token.Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Value string      `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

func NewIdent

func NewIdent(name string) *Identifier

func UnwrapIdentifier

func UnwrapIdentifier(expr *Expression) (*Identifier, bool)

func (*Identifier) Descriptor

func (*Identifier) Descriptor() ([]byte, []int)

func (*Identifier) GetToken

func (m *Identifier) GetToken() token.Token

func (*Identifier) GetValue

func (m *Identifier) GetValue() string

func (*Identifier) Marshal

func (m *Identifier) Marshal() (dAtA []byte, err error)

func (*Identifier) MarshalTo

func (m *Identifier) MarshalTo(dAtA []byte) (int, error)

func (*Identifier) MarshalToSizedBuffer

func (m *Identifier) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Identifier) ProtoMessage

func (*Identifier) ProtoMessage()

func (*Identifier) Reset

func (m *Identifier) Reset()

func (*Identifier) Size

func (m *Identifier) Size() (n int)

func (*Identifier) String

func (m *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

func (*Identifier) Unmarshal

func (m *Identifier) Unmarshal(dAtA []byte) error

func (*Identifier) XXX_DiscardUnknown

func (m *Identifier) XXX_DiscardUnknown()

func (*Identifier) XXX_Marshal

func (m *Identifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Identifier) XXX_Merge

func (m *Identifier) XXX_Merge(src proto.Message)

func (*Identifier) XXX_Size

func (m *Identifier) XXX_Size() int

func (*Identifier) XXX_Unmarshal

func (m *Identifier) XXX_Unmarshal(b []byte) error

type InfixExpression

type InfixExpression struct {
	Token    token.Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Left     *Expression `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"`
	Operator string      `protobuf:"bytes,3,opt,name=operator,proto3" json:"operator,omitempty"`
	Right    *Expression `protobuf:"bytes,4,opt,name=right,proto3" json:"right,omitempty"`
}

func UnwrapInfixExpression

func UnwrapInfixExpression(expr *Expression) (*InfixExpression, bool)

func (*InfixExpression) Descriptor

func (*InfixExpression) Descriptor() ([]byte, []int)

func (*InfixExpression) GetLeft

func (m *InfixExpression) GetLeft() *Expression

func (*InfixExpression) GetOperator

func (m *InfixExpression) GetOperator() string

func (*InfixExpression) GetRight

func (m *InfixExpression) GetRight() *Expression

func (*InfixExpression) GetToken

func (m *InfixExpression) GetToken() token.Token

func (*InfixExpression) Marshal

func (m *InfixExpression) Marshal() (dAtA []byte, err error)

func (*InfixExpression) MarshalTo

func (m *InfixExpression) MarshalTo(dAtA []byte) (int, error)

func (*InfixExpression) MarshalToSizedBuffer

func (m *InfixExpression) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*InfixExpression) ProtoMessage

func (*InfixExpression) ProtoMessage()

func (*InfixExpression) Reset

func (m *InfixExpression) Reset()

func (*InfixExpression) Size

func (m *InfixExpression) Size() (n int)

func (*InfixExpression) String

func (m *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (ie *InfixExpression) TokenLiteral() string

func (*InfixExpression) Unmarshal

func (m *InfixExpression) Unmarshal(dAtA []byte) error

func (*InfixExpression) XXX_DiscardUnknown

func (m *InfixExpression) XXX_DiscardUnknown()

func (*InfixExpression) XXX_Marshal

func (m *InfixExpression) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InfixExpression) XXX_Merge

func (m *InfixExpression) XXX_Merge(src proto.Message)

func (*InfixExpression) XXX_Size

func (m *InfixExpression) XXX_Size() int

func (*InfixExpression) XXX_Unmarshal

func (m *InfixExpression) XXX_Unmarshal(b []byte) error

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token"`
	Value int64       `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
}

func UnwrapIntegerLiteral

func UnwrapIntegerLiteral(expr *Expression) (*IntegerLiteral, bool)

func (*IntegerLiteral) Descriptor

func (*IntegerLiteral) Descriptor() ([]byte, []int)

func (*IntegerLiteral) GetToken

func (m *IntegerLiteral) GetToken() token.Token

func (*IntegerLiteral) GetValue

func (m *IntegerLiteral) GetValue() int64

func (*IntegerLiteral) Marshal

func (m *IntegerLiteral) Marshal() (dAtA []byte, err error)

func (*IntegerLiteral) MarshalTo

func (m *IntegerLiteral) MarshalTo(dAtA []byte) (int, error)

func (*IntegerLiteral) MarshalToSizedBuffer

func (m *IntegerLiteral) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IntegerLiteral) ProtoMessage

func (*IntegerLiteral) ProtoMessage()

func (*IntegerLiteral) Reset

func (m *IntegerLiteral) Reset()

func (*IntegerLiteral) Size

func (m *IntegerLiteral) Size() (n int)

func (*IntegerLiteral) String

func (m *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

func (*IntegerLiteral) Unmarshal

func (m *IntegerLiteral) Unmarshal(dAtA []byte) error

func (*IntegerLiteral) XXX_DiscardUnknown

func (m *IntegerLiteral) XXX_DiscardUnknown()

func (*IntegerLiteral) XXX_Marshal

func (m *IntegerLiteral) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IntegerLiteral) XXX_Merge

func (m *IntegerLiteral) XXX_Merge(src proto.Message)

func (*IntegerLiteral) XXX_Size

func (m *IntegerLiteral) XXX_Size() int

func (*IntegerLiteral) XXX_Unmarshal

func (m *IntegerLiteral) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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