Documentation ¶
Index ¶
- Constants
- func Parse(input string, parse func(*parser) interface{}, memoryGauge common.MemoryGauge) (result interface{}, 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 interface{}, errors []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 ParseError
- type SyntaxError
- type TypeDepthLimitReachedError
Constants ¶
const (
KeywordTransaction = "transaction"
)
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(input string, parse func(*parser) interface{}, memoryGauge common.MemoryGauge) (result interface{}, 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.12.4
func ParseDeclarations ¶ added in v0.3.0
func ParseDeclarations(input string, memoryGauge common.MemoryGauge) (declarations []ast.Declaration, errs []error)
func ParseDocstringPragmaArguments ¶ added in v0.12.4
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.13.4
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 ¶ added in v0.2.1
func ParseExpression(input string, memoryGauge common.MemoryGauge) (expression ast.Expression, errs []error)
func ParseProgram ¶ added in v0.3.0
func ParseProgramFromFile ¶ added in v0.5.0
func ParseProgramFromTokenStream ¶ added in v0.20.0
func ParseProgramFromTokenStream( input lexer.TokenStream, memoryGauge common.MemoryGauge, ) ( program *ast.Program, err error, )
func ParseStatements ¶ added in v0.2.1
func ParseTokenStream ¶ added in v0.20.0
func ParseTokenStream( memoryGauge common.MemoryGauge, tokens lexer.TokenStream, parse func(*parser) interface{}, ) ( result interface{}, errors []error, )
Types ¶
type Error ¶ added in v0.3.0
func (Error) ChildErrors ¶ added in v0.3.0
type ExpressionDepthLimitReachedError ¶ added in v0.24.0
ExpressionDepthLimitReachedError is reported when the expression depth limit was reached
func (ExpressionDepthLimitReachedError) EndPosition ¶ added in v0.24.0
func (e ExpressionDepthLimitReachedError) EndPosition(_ common.MemoryGauge) ast.Position
func (ExpressionDepthLimitReachedError) Error ¶ added in v0.24.0
func (e ExpressionDepthLimitReachedError) Error() string
func (ExpressionDepthLimitReachedError) StartPosition ¶ added in v0.24.0
func (e ExpressionDepthLimitReachedError) StartPosition() ast.Position
type IntegerLiteralKind ¶ added in v0.3.0
type IntegerLiteralKind uint
const ( IntegerLiteralKindUnknown IntegerLiteralKind = iota IntegerLiteralKindBinary IntegerLiteralKindOctal IntegerLiteralKindDecimal IntegerLiteralKindHexadecimal )
func (IntegerLiteralKind) Base ¶ added in v0.3.0
func (k IntegerLiteralKind) Base() int
func (IntegerLiteralKind) Name ¶ added in v0.3.0
func (k IntegerLiteralKind) Name() string
func (IntegerLiteralKind) String ¶ added in v0.3.0
func (i IntegerLiteralKind) String() string
type InvalidIntegerLiteralError ¶ added in v0.3.0
type InvalidIntegerLiteralError struct { Literal string IntegerLiteralKind IntegerLiteralKind InvalidIntegerLiteralKind InvalidNumberLiteralKind ast.Range }
func (*InvalidIntegerLiteralError) Error ¶ added in v0.3.0
func (e *InvalidIntegerLiteralError) Error() string
func (*InvalidIntegerLiteralError) SecondaryError ¶ added in v0.3.0
func (e *InvalidIntegerLiteralError) SecondaryError() string
type InvalidNumberLiteralKind ¶ added in v0.3.0
type InvalidNumberLiteralKind uint
const ( InvalidNumberLiteralKindUnknown InvalidNumberLiteralKind = iota InvalidNumberLiteralKindLeadingUnderscore InvalidNumberLiteralKindTrailingUnderscore InvalidNumberLiteralKindUnknownPrefix InvalidNumberLiteralKindMissingDigits )
func (InvalidNumberLiteralKind) Description ¶ added in v0.3.0
func (k InvalidNumberLiteralKind) Description() string
func (InvalidNumberLiteralKind) String ¶ added in v0.3.0
func (i InvalidNumberLiteralKind) String() string
type JuxtaposedUnaryOperatorsError ¶ added in v0.3.0
func (*JuxtaposedUnaryOperatorsError) EndPosition ¶ added in v0.3.0
func (e *JuxtaposedUnaryOperatorsError) EndPosition(common.MemoryGauge) ast.Position
func (*JuxtaposedUnaryOperatorsError) Error ¶ added in v0.3.0
func (e *JuxtaposedUnaryOperatorsError) Error() string
func (*JuxtaposedUnaryOperatorsError) StartPosition ¶ added in v0.3.0
func (e *JuxtaposedUnaryOperatorsError) StartPosition() ast.Position
type ParseError ¶ added in v0.3.0
type ParseError interface { error ast.HasPosition // contains filtered or unexported methods }
type SyntaxError ¶ added in v0.3.0
func (*SyntaxError) EndPosition ¶ added in v0.3.0
func (e *SyntaxError) EndPosition(common.MemoryGauge) ast.Position
func (*SyntaxError) Error ¶ added in v0.3.0
func (e *SyntaxError) Error() string
func (*SyntaxError) StartPosition ¶ added in v0.3.0
func (e *SyntaxError) StartPosition() ast.Position
type TypeDepthLimitReachedError ¶ added in v0.24.0
func (TypeDepthLimitReachedError) EndPosition ¶ added in v0.24.0
func (e TypeDepthLimitReachedError) EndPosition(_ common.MemoryGauge) ast.Position
func (TypeDepthLimitReachedError) Error ¶ added in v0.24.0
func (e TypeDepthLimitReachedError) Error() string
func (TypeDepthLimitReachedError) StartPosition ¶ added in v0.24.0
func (e TypeDepthLimitReachedError) StartPosition() ast.Position