Documentation ¶
Index ¶
- Constants
- func Inspect(node Node, f func(Node) bool)
- func Parse(condStr string) (Node, []*Ident, error)
- func Walk(v Visitor, node Node)
- type BasicLit
- type BasicLitList
- type BinaryExpr
- type CallExpr
- type Error
- type ErrorHandler
- type Expr
- type Ident
- type Node
- type ParenExpr
- type Parser
- type Scanner
- type Token
- type UnaryExpr
- type Visitor
Constants ¶
const BASICLIT = 57353
const BOOL = 57355
const COMMA = 57354
const COMMENT = 57360
const EOF = 0
The parser expects the lexer to return 0 on EOF. Give it a name for clarity.
const FLOAT = 57358
const IDENT = 57346
const ILLEGAL = 57361
const IMAG = 57359
const INT = 57357
const LAND = 57347
const LOR = 57348
const LPAREN = 57349
const NOT = 57351
const RPAREN = 57350
const SEMICOLON = 57352
const STRING = 57356
Variables ¶
This section is empty.
Functions ¶
func Inspect ¶
Inspect traverses an AST in depth-first order: It starts by calling f(node); node must not be nil. If f returns true, Inspect invokes f for all the non-nil children of node, recursively.
Types ¶
type BasicLitList ¶
type BasicLitList []*BasicLit
func (BasicLitList) End ¶
func (b BasicLitList) End() token.Pos
func (BasicLitList) Pos ¶
func (b BasicLitList) Pos() token.Pos
type BinaryExpr ¶
func (*BinaryExpr) End ¶
func (b *BinaryExpr) End() token.Pos
func (*BinaryExpr) Pos ¶
func (b *BinaryExpr) Pos() token.Pos
type ErrorHandler ¶
ErrorHandler is error handler for scanner and lexer
type Scanner ¶
type Scanner struct { ErrorCount int // contains filtered or unexported fields }
func (*Scanner) Init ¶
func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler)
Init prepares the scanner s to tokenize the text src by setting the scanner at the beginning of src. The scanner uses the file set file for position information and it adds line information for each line. It is ok to re-use the same file when re-scanning the same file as line information which is already present is ignored. Init causes a panic if the file size does not match the src size.
Calls to Scan will invoke the error handler err if they encounter a syntax error and err is not nil. Also, for each error encountered, the Scanner field ErrorCount is incremented by one. The mode parameter determines how comments are handled.
Note that Init may call err if there is an error in the first character of the file.