Documentation
¶
Overview ¶
Package parser implements a parser used by the Elk interpreter.
Parser expects a slice of bytes containing Elk source code parses it, registering any encountered errors, and returns an Abstract Syntax Tree.
Index ¶
- func Parse(sourceName string, source string) (*ast.ProgramNode, diagnostic.DiagnosticList)
- type Parser
- func (*Parser) Class() *value.Class
- func (p *Parser) Copy() value.Reference
- func (*Parser) DirectClass() *value.Class
- func (p *Parser) Error() string
- func (p *Parser) Inspect() string
- func (p *Parser) InstanceVariables() *value.InstanceVariables
- func (p *Parser) IsIncomplete() bool
- func (p *Parser) Parse() (*ast.ProgramNode, diagnostic.DiagnosticList)
- func (p *Parser) ShouldIndent() bool
- func (p *Parser) SingletonClass() *value.Class
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(sourceName string, source string) (*ast.ProgramNode, diagnostic.DiagnosticList)
Parse the given source code and return an Abstract Syntax Tree. Main entry point to the parser.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Holds the current state of the parsing process.
func (*Parser) DirectClass ¶
func (*Parser) InstanceVariables ¶
func (p *Parser) InstanceVariables() *value.InstanceVariables
func (*Parser) IsIncomplete ¶
Returns true when the parser had finished early because of an END_OF_FILE token.
func (*Parser) Parse ¶
func (p *Parser) Parse() (*ast.ProgramNode, diagnostic.DiagnosticList)
Start the parsing process from the top.
func (*Parser) ShouldIndent ¶
Returns true when the parser had finished early because of an END_OF_FILE token and the following code should be indented.
func (*Parser) SingletonClass ¶
type Result ¶
type Result struct {
AST *ast.ProgramNode
Diagnostics diagnostic.DiagnosticList
}
func (*Result) DirectClass ¶
func (*Result) InstanceVariables ¶
func (r *Result) InstanceVariables() *value.InstanceVariables
func (*Result) SingletonClass ¶
Click to show internal directories.
Click to hide internal directories.