Documentation ¶
Index ¶
- func ParseChunk(scanner Scanner) (stat ast.BlockStat, err error)
- func ParseExp(scanner Scanner) (exp ast.ExpNode, err error)
- type Error
- type Parser
- func (p *Parser) Args(t *token.Token) ([]ast.ExpNode, *token.Token)
- func (p *Parser) Block(t *token.Token) (ast.BlockStat, *token.Token)
- func (p *Parser) Exp(t *token.Token) (ast.ExpNode, *token.Token)
- func (p *Parser) ExpList(t *token.Token) ([]ast.ExpNode, *token.Token)
- func (p *Parser) Field(t *token.Token) (ast.TableField, *token.Token)
- func (p *Parser) For(t *token.Token) (ast.Stat, *token.Token)
- func (p *Parser) FunctionDef(startTok *token.Token) (ast.Function, *token.Token)
- func (p *Parser) FunctionStat(*token.Token) (ast.Stat, *token.Token)
- func (p *Parser) If(t *token.Token) (ast.IfStat, *token.Token)
- func (p *Parser) Local(*token.Token) (ast.Stat, *token.Token)
- func (p *Parser) Name(t *token.Token) (ast.Name, *token.Token)
- func (p *Parser) NameAttrib(t *token.Token) (ast.NameAttrib, *token.Token)
- func (p *Parser) PrefixExp(t *token.Token) (ast.ExpNode, *token.Token)
- func (p *Parser) Return(*token.Token) ([]ast.ExpNode, *token.Token)
- func (p *Parser) Scan() *token.Token
- func (p *Parser) ShortExp(t *token.Token) (ast.ExpNode, *token.Token)
- func (p *Parser) Stat(t *token.Token) (ast.Stat, *token.Token)
- func (p *Parser) TableConstructor(opTok *token.Token) (ast.TableConstructor, *token.Token)
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseChunk ¶
ParseChunk takes in a function that returns tokens and builds a BlockStat for it (or returns an error).
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser can parse lua statements or expressions
func (*Parser) Args ¶
Args parses the arguments of a function call. It returns nil rather than panicking if it couldn't parse arguments.
func (*Parser) Block ¶
Block parses a block whose starting token (e.g. "do") has already been consumed. Returns the token that closes the block (e.g. "end"). So the caller should check that this is the right kind of closing token.
func (*Parser) FunctionDef ¶
FunctionDef parses a function definition expression.
func (*Parser) FunctionStat ¶
FunctionStat parses a function definition statement. It assumes that t is the "function" token.
func (*Parser) Local ¶
Local parses a "local" statement (function definition of variable declaration). It assumes that t is the "local" token.
func (*Parser) NameAttrib ¶
func (*Parser) PrefixExp ¶
PrefixExp parses an expression made of a name or and expression in brackets followed by zero or more indexing operations or function applications.
func (*Parser) ShortExp ¶
ShortExp parses an expression which is either atomic, a unary operation, a prefix expression or a power operation (right associatively composed). In other words, any expression that doesn't contain a binary operator.
func (*Parser) TableConstructor ¶
TableConstructor parses a table constructor.