Documentation ¶
Overview ¶
Package parser translates the linear stream of tokens into ast structures based on the syntax of the ok language.
Index ¶
- type Errors
- type File
- type Parser
- func (p *Parser) AppendError(node ast.Node, message string)
- func (p *Parser) AppendErrorAt(pos string, message string)
- func (p *Parser) AppendErrorf(node ast.Node, format string, args ...interface{})
- func (p *Parser) AppendFinally(finally *ast.Finally)
- func (p *Parser) Errors() Errors
- func (p *Parser) NextFunctionName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Funcs map[string]*ast.Func Tests []*ast.Test Imports map[string]string Comments []*ast.Comment Tokens []lexer.Token }
File contains the output state of the parser for a single input.
type Parser ¶
type Parser struct { File *File Interfaces map[string]map[string]string // Constants are variables defined at the package level. They cannot be // modified and only allow literals for values. // // TODO(elliot): We should allow for expressions that can be resolved at // compile time, such as "3600 * 24". Constants map[string]*ast.Literal // contains filtered or unexported fields }
func ParseString ¶
ParseString parses source code and returns the AST for the file.
func (*Parser) AppendError ¶ added in v0.13.1
AppendError adds an error to the stack.
func (*Parser) AppendErrorAt ¶ added in v0.13.1
AppendError adds an error to the stack.
func (*Parser) AppendErrorf ¶ added in v0.13.1
AppendErrorf adds an error to the stack.
func (*Parser) AppendFinally ¶ added in v0.15.3
AppendFinally will track finalizers until the function is finished, then it will be reset.
func (*Parser) NextFunctionName ¶ added in v0.17.0
NextFunctionName returns a unique name to be used internally for anonymous functions.
Source Files ¶
- array.go
- assert.go
- assign.go
- assignable.go
- block.go
- call.go
- consume.go
- doc.go
- error.go
- error_scope.go
- errors.go
- expr.go
- file.go
- for.go
- func.go
- group.go
- identifier.go
- if.go
- import.go
- interpolate.go
- key_value.go
- literal.go
- map.go
- parse.go
- parser.go
- raise.go
- return.go
- statement.go
- switch.go
- test.go
- type.go
- types.go
- unary.go
Click to show internal directories.
Click to hide internal directories.