Documentation ¶
Index ¶
- func Parse(input string, parse func(*parser) interface{}) (result interface{}, errors []error)
- func ParseDeclarations(input string) (declarations []ast.Declaration, errors []error)
- func ParseExpression(input string) (expression ast.Expression, errors []error)
- func ParseProgram(input string) (program *ast.Program, err error)
- func ParseProgramFromFile(filename string) (program *ast.Program, code string, err error)
- func ParseStatements(input string) (statements []ast.Statement, errors []error)
- func ParseType(input string) (ty ast.Type, errors []error)
- type Error
- type IntegerLiteralKind
- type InvalidIntegerLiteralError
- type InvalidNumberLiteralKind
- type JuxtaposedUnaryOperatorsError
- type ParseError
- type SyntaxError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
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 ParseDeclarations ¶ added in v0.3.0
func ParseDeclarations(input string) (declarations []ast.Declaration, errors []error)
func ParseExpression ¶ added in v0.2.1
func ParseExpression(input string) (expression ast.Expression, errors []error)
func ParseProgram ¶ added in v0.3.0
func ParseProgramFromFile ¶ added in v0.5.0
func ParseStatements ¶ added in v0.2.1
Types ¶
type Error ¶ added in v0.3.0
type Error struct {
Errors []error
}
func (Error) ChildErrors ¶ added in v0.3.0
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 )
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() 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() 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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.