Versions in this module Expand all Collapse all v0 v0.0.1 Sep 26, 2022 Changes in this version + var ErrIdentConflict error = errors.New("ident conflict") + var ErrIsKeyword error = errors.New("token is keyword") + var ErrListElemIllegal error = errors.New("list element format illegal") + var ErrMapKVIllegal error = errors.New("map kv format illegal") + var ErrStatementInferFailed error = errors.New("statement infer failed") + var ErrStatementTooMany error = errors.New("statement too many") + var ErrStatementUnknow error = errors.New("unknow statement") + var ErrTokenCharacterIllegal error = errors.New("token character illegal") + var ErrTokenNumInLine error = errors.New("token number not match") + var ErrTokenRegex error = errors.New("token regex not match") + var ErrTokenType error = errors.New("token type not match") + var ErrTokenValue error = errors.New("token value not match") + var ErrVariableFormat error = errors.New("variable format illegal") + var ErrVariableHasCycle error = errors.New("variable has cycle") + var ErrVariableNameDuplicated error = errors.New("variable name is duplicated") + var ErrVariableNameEmpty error = errors.New("variable name is empty") + var ErrVariableNotDefined error = errors.New("variable not defined") + var ErrVariableValueType error = errors.New("variable's value type illegal") + type AST struct + func New(rd io.Reader) (*AST, error) + func (ast *AST) Desc() string + func (ast *AST) Foreach(do func(*Block) error) error + func (ast *AST) GetBlocks() (loads []*Block, fns []*Block, runs []*Block) + func (ast *AST) Global() *Block + type Block struct + func (b *Block) AddField2Var(name, field, val string) error + func (b *Block) Body() body + func (b *Block) Child() []*Block + func (b *Block) Debug() + func (b *Block) ExecCondition() bool + func (b *Block) GetVarValue(name string) string + func (b *Block) InFor() bool + func (b *Block) InIf() bool + func (b *Block) InSwitch() bool + func (b *Block) IsArgs() bool + func (b *Block) IsBtf() bool + func (b *Block) IsBuiltinDirective() (string, bool) + func (b *Block) IsCase() bool + func (b *Block) IsCo() bool + func (b *Block) IsDefault() bool + func (b *Block) IsEvent() bool + func (b *Block) IsFn() bool + func (b *Block) IsFor() bool + func (b *Block) IsGlobal() bool + func (b *Block) IsIf() bool + func (b *Block) IsLoad() bool + func (b *Block) IsSwitch() bool + func (b *Block) IsVar() bool + func (b *Block) Iskind(s string) bool + func (b *Block) Parent() *Block + func (b *Block) RewriteVar(stm *Statement) error + func (b *Block) String() string + func (b *Block) Target1() *Token + func (b *Block) Target2() *Token + type ListBody struct + func (l *ListBody) Append(o interface{}) error + func (l *ListBody) ToSlice() []string + func (r *ListBody) Len() int + func (r *ListBody) List() []*Statement + func (r *ListBody) Type() string + type MapBody struct + func (m *MapBody) Append(o interface{}) error + func (m *MapBody) ToMap() map[string]string + func (r *MapBody) Len() int + func (r *MapBody) List() []*Statement + func (r *MapBody) Type() string + type Statement struct + func NewStatement(desc string) *Statement + func (s *Statement) Append(t *Token) *Statement + func (s *Statement) Copy() *Statement + func (s *Statement) FormatString() string + type Token struct + func (t *Token) FormatString() string + func (t *Token) IsEmpty() bool + func (t *Token) String() string + func (t *Token) StringEqual(t1 *Token) bool + func (t *Token) TypeEqual(ts ...TokenType) bool + func (t *Token) Value() string + type TokenType int