Documentation ¶
Index ¶
- Constants
- func Parse(input string, parse func(*parser) (any, error), memoryGauge common.MemoryGauge) (result any, errors []error)
- func ParseArgumentList(input string, memoryGauge common.MemoryGauge) (arguments ast.Arguments, errs []error)
- func ParseDeclarations(input string, memoryGauge common.MemoryGauge) (declarations []ast.Declaration, errs []error)
- func ParseDocstringPragmaArguments(docString string) []string
- func ParseDocstringPragmaSigners(docString string) []string
- func ParseExpression(input string, memoryGauge common.MemoryGauge) (expression ast.Expression, errs []error)
- func ParseProgram(code string, memoryGauge common.MemoryGauge) (program *ast.Program, err error)
- func ParseProgramFromFile(filename string, memoryGauge common.MemoryGauge) (program *ast.Program, code string, err error)
- func ParseProgramFromTokenStream(input lexer.TokenStream, memoryGauge common.MemoryGauge) (program *ast.Program, err error)
- func ParseStatements(input string, memoryGauge common.MemoryGauge) (statements []ast.Statement, errs []error)
- func ParseTokenStream(memoryGauge common.MemoryGauge, tokens lexer.TokenStream, ...) (result any, errs []error)
- func ParseType(input string, memoryGauge common.MemoryGauge) (ty ast.Type, errs []error)
- type Error
- type ExpressionDepthLimitReachedError
- type IntegerLiteralKind
- type InvalidIntegerLiteralError
- type InvalidNumberLiteralKind
- type JuxtaposedUnaryOperatorsError
- type MissingCommaInParameterListError
- type ParseError
- type SyntaxError
- type TypeDepthLimitReachedError
Constants ¶
const (
KeywordTransaction = "transaction"
)
Variables ¶
This section is empty.
Functions ¶
func Parse ¶ added in v0.25.0
func Parse(input string, parse func(*parser) (any, error), memoryGauge common.MemoryGauge) (result any, errors []error)
Parse creates a lexer to scan the given input string, and uses the given `parse` function to parse tokens into a result.
It can be composed with different parse functions to parse the input string into different results. See "ParseExpression", "ParseStatements" as examples.
func ParseArgumentList ¶ added in v0.25.0
func ParseDeclarations ¶ added in v0.25.0
func ParseDeclarations(input string, memoryGauge common.MemoryGauge) (declarations []ast.Declaration, errs []error)
func ParseDocstringPragmaArguments ¶ added in v0.25.0
ParseDocstringPragmaArguments parses the docstring and returns the values of all pragma arguments declarations.
A pragma arguments declaration has the form `pragma arguments <argument-list>`, where <argument-list> is a Cadence argument list.
The validity of the argument list is NOT checked by this function.
func ParseDocstringPragmaSigners ¶ added in v0.25.0
ParseDocstringPragmaSigners parses the docstring and returns the values of all pragma signers declarations.
A pragma signers declaration has the form `pragma signers <signers-list>`, where <signers-list> is a list of strings.
The validity of the argument list is NOT checked by this function.
func ParseExpression ¶
func ParseExpression(input string, memoryGauge common.MemoryGauge) (expression ast.Expression, errs []error)
func ParseProgram ¶
func ParseProgramFromFile ¶
func ParseProgramFromTokenStream ¶ added in v0.25.0
func ParseProgramFromTokenStream( input lexer.TokenStream, memoryGauge common.MemoryGauge, ) ( program *ast.Program, err error, )
func ParseStatements ¶ added in v0.25.0
func ParseTokenStream ¶ added in v0.25.0
func ParseTokenStream( memoryGauge common.MemoryGauge, tokens lexer.TokenStream, parse func(*parser) (any, error), ) ( result any, errs []error, )
Types ¶
type Error ¶
func (Error) ChildErrors ¶
type ExpressionDepthLimitReachedError ¶ added in v0.25.0
ExpressionDepthLimitReachedError is reported when the expression depth limit was reached
func (ExpressionDepthLimitReachedError) EndPosition ¶ added in v0.25.0
func (e ExpressionDepthLimitReachedError) EndPosition(_ common.MemoryGauge) ast.Position
func (ExpressionDepthLimitReachedError) Error ¶ added in v0.25.0
func (e ExpressionDepthLimitReachedError) Error() string
func (ExpressionDepthLimitReachedError) IsUserError ¶ added in v0.25.0
func (ExpressionDepthLimitReachedError) IsUserError()
func (ExpressionDepthLimitReachedError) StartPosition ¶ added in v0.25.0
func (e ExpressionDepthLimitReachedError) StartPosition() ast.Position
type IntegerLiteralKind ¶
type IntegerLiteralKind uint
const ( IntegerLiteralKindUnknown IntegerLiteralKind = iota IntegerLiteralKindBinary IntegerLiteralKindOctal IntegerLiteralKindDecimal IntegerLiteralKindHexadecimal )
func (IntegerLiteralKind) Base ¶
func (k IntegerLiteralKind) Base() int
func (IntegerLiteralKind) Name ¶
func (k IntegerLiteralKind) Name() string
func (IntegerLiteralKind) String ¶
func (i IntegerLiteralKind) String() string
type InvalidIntegerLiteralError ¶
type InvalidIntegerLiteralError struct { Literal string IntegerLiteralKind IntegerLiteralKind InvalidIntegerLiteralKind InvalidNumberLiteralKind ast.Range }
func (*InvalidIntegerLiteralError) Error ¶
func (e *InvalidIntegerLiteralError) Error() string
func (*InvalidIntegerLiteralError) IsUserError ¶ added in v0.25.0
func (*InvalidIntegerLiteralError) IsUserError()
func (*InvalidIntegerLiteralError) SecondaryError ¶
func (e *InvalidIntegerLiteralError) SecondaryError() string
type InvalidNumberLiteralKind ¶
type InvalidNumberLiteralKind uint
const ( InvalidNumberLiteralKindUnknown InvalidNumberLiteralKind = iota InvalidNumberLiteralKindLeadingUnderscore InvalidNumberLiteralKindTrailingUnderscore InvalidNumberLiteralKindUnknownPrefix InvalidNumberLiteralKindMissingDigits )
func (InvalidNumberLiteralKind) Description ¶
func (k InvalidNumberLiteralKind) Description() string
func (InvalidNumberLiteralKind) String ¶
func (i InvalidNumberLiteralKind) String() string
type JuxtaposedUnaryOperatorsError ¶
func (*JuxtaposedUnaryOperatorsError) EndPosition ¶
func (e *JuxtaposedUnaryOperatorsError) EndPosition(_ common.MemoryGauge) ast.Position
func (*JuxtaposedUnaryOperatorsError) Error ¶
func (e *JuxtaposedUnaryOperatorsError) Error() string
func (*JuxtaposedUnaryOperatorsError) IsUserError ¶ added in v0.25.0
func (*JuxtaposedUnaryOperatorsError) IsUserError()
func (*JuxtaposedUnaryOperatorsError) StartPosition ¶
func (e *JuxtaposedUnaryOperatorsError) StartPosition() ast.Position
type MissingCommaInParameterListError ¶ added in v0.25.0
func (*MissingCommaInParameterListError) EndPosition ¶ added in v0.25.0
func (e *MissingCommaInParameterListError) EndPosition(_ common.MemoryGauge) ast.Position
func (*MissingCommaInParameterListError) Error ¶ added in v0.25.0
func (e *MissingCommaInParameterListError) Error() string
func (*MissingCommaInParameterListError) IsUserError ¶ added in v0.25.0
func (*MissingCommaInParameterListError) IsUserError()
func (*MissingCommaInParameterListError) StartPosition ¶ added in v0.25.0
func (e *MissingCommaInParameterListError) StartPosition() ast.Position
type ParseError ¶
type ParseError interface { errors.UserError ast.HasPosition // contains filtered or unexported methods }
type SyntaxError ¶
func NewSyntaxError ¶ added in v0.25.0
func NewSyntaxError(pos ast.Position, message string, params ...any) *SyntaxError
func NewUnpositionedSyntaxError ¶ added in v0.25.0
func NewUnpositionedSyntaxError(message string, params ...any) *SyntaxError
func (*SyntaxError) EndPosition ¶
func (e *SyntaxError) EndPosition(_ common.MemoryGauge) ast.Position
func (*SyntaxError) Error ¶
func (e *SyntaxError) Error() string
func (*SyntaxError) IsUserError ¶ added in v0.25.0
func (*SyntaxError) IsUserError()
func (*SyntaxError) StartPosition ¶
func (e *SyntaxError) StartPosition() ast.Position
type TypeDepthLimitReachedError ¶ added in v0.25.0
func (TypeDepthLimitReachedError) EndPosition ¶ added in v0.25.0
func (e TypeDepthLimitReachedError) EndPosition(_ common.MemoryGauge) ast.Position
func (TypeDepthLimitReachedError) Error ¶ added in v0.25.0
func (e TypeDepthLimitReachedError) Error() string
func (TypeDepthLimitReachedError) IsUserError ¶ added in v0.25.0
func (TypeDepthLimitReachedError) IsUserError()
func (TypeDepthLimitReachedError) StartPosition ¶ added in v0.25.0
func (e TypeDepthLimitReachedError) StartPosition() ast.Position