parser

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenNumInLine        error = errors.New("token number not match")
	ErrTokenType             error = errors.New("token type not match")
	ErrTokenValue            error = errors.New("token value not match")
	ErrTokenRegex            error = errors.New("token regex not match")
	ErrTokenCharacterIllegal error = errors.New("token character illegal")
	ErrIsKeyword             error = errors.New("token is keyword")
)
View Source
var (
	ErrStatementUnknow      error = errors.New("unknow statement")
	ErrMapKVIllegal         error = errors.New("map kv format illegal")
	ErrListElemIllegal      error = errors.New("list element format illegal")
	ErrStatementInferFailed error = errors.New("statement infer failed")
	ErrStatementTooMany     error = errors.New("statement too many")
	ErrIdentConflict        error = errors.New("ident conflict")
)
View Source
var (
	ErrVariableFormat         error = errors.New("variable format illegal")
	ErrVariableNameEmpty      error = errors.New("variable name is empty")
	ErrVariableNameDuplicated error = errors.New("variable name is duplicated")
	ErrVariableNotDefined     error = errors.New("variable not defined")
	ErrVariableHasCycle       error = errors.New("variable has cycle")
	ErrVariableValueType      error = errors.New("variable's value type illegal")
)

Functions

This section is empty.

Types

type AST

type AST struct {
	// contains filtered or unexported fields
}

AST store all blocks in the flowl

func New

func New(rd io.Reader) (*AST, error)

func (*AST) Desc

func (ast *AST) Desc() string

func (*AST) Foreach

func (ast *AST) Foreach(do func(*Block) error) error

func (*AST) GetBlocks

func (ast *AST) GetBlocks() (loads []*Block, fns []*Block, runs []*Block)

func (*AST) Global

func (ast *AST) Global() *Block

type Block

type Block struct {
	// contains filtered or unexported fields
}

func (*Block) AddField2Var

func (b *Block) AddField2Var(name, field, val string) error

func (*Block) Body

func (b *Block) Body() body

func (*Block) Child

func (b *Block) Child() []*Block

func (*Block) Debug

func (b *Block) Debug()

func (*Block) ExecCondition

func (b *Block) ExecCondition() bool

func (*Block) GetVarValue

func (b *Block) GetVarValue(name string) string

GetVarValue returns the value of the variable, the argument is the variable name

func (*Block) InFor

func (b *Block) InFor() bool

func (*Block) InIf

func (b *Block) InIf() bool

func (*Block) InSwitch

func (b *Block) InSwitch() bool

func (*Block) IsArgs

func (b *Block) IsArgs() bool

func (*Block) IsBtf

func (b *Block) IsBtf() bool

func (*Block) IsBuiltinDirective

func (b *Block) IsBuiltinDirective() (string, bool)

func (*Block) IsCase

func (b *Block) IsCase() bool

func (*Block) IsCo

func (b *Block) IsCo() bool

func (*Block) IsDefault

func (b *Block) IsDefault() bool

func (*Block) IsEvent

func (b *Block) IsEvent() bool

func (*Block) IsFn

func (b *Block) IsFn() bool

func (*Block) IsFor

func (b *Block) IsFor() bool

func (*Block) IsGlobal

func (b *Block) IsGlobal() bool

func (*Block) IsIf

func (b *Block) IsIf() bool

func (*Block) IsLoad

func (b *Block) IsLoad() bool

func (*Block) IsSwitch

func (b *Block) IsSwitch() bool

func (*Block) IsVar

func (b *Block) IsVar() bool

func (*Block) Iskind

func (b *Block) Iskind(s string) bool

func (*Block) Parent

func (b *Block) Parent() *Block

func (*Block) RewriteVar

func (b *Block) RewriteVar(stm *Statement) error

func (*Block) String

func (b *Block) String() string

func (*Block) Target1

func (b *Block) Target1() *Token

func (*Block) Target2

func (b *Block) Target2() *Token

type ListBody

type ListBody struct {
	// contains filtered or unexported fields
}

func (*ListBody) Append

func (l *ListBody) Append(o interface{}) error

func (*ListBody) Len

func (r *ListBody) Len() int

func (*ListBody) List

func (r *ListBody) List() []*Statement

func (*ListBody) ToSlice

func (l *ListBody) ToSlice() []string

func (*ListBody) Type

func (r *ListBody) Type() string

type MapBody

type MapBody struct {
	// contains filtered or unexported fields
}

func (*MapBody) Append

func (m *MapBody) Append(o interface{}) error

func (*MapBody) Len

func (r *MapBody) Len() int

func (*MapBody) List

func (r *MapBody) List() []*Statement

func (*MapBody) ToMap

func (m *MapBody) ToMap() map[string]string

func (*MapBody) Type

func (r *MapBody) Type() string

type Statement

type Statement struct {
	// contains filtered or unexported fields
}

func NewStatement

func NewStatement(desc string) *Statement

func (*Statement) Append

func (s *Statement) Append(t *Token) *Statement

func (*Statement) Copy

func (s *Statement) Copy() *Statement

func (*Statement) FormatString

func (s *Statement) FormatString() string

type Token

type Token struct {
	// contains filtered or unexported fields
}

func (*Token) FormatString

func (t *Token) FormatString() string

func (*Token) IsEmpty

func (t *Token) IsEmpty() bool

func (*Token) String

func (t *Token) String() string

func (*Token) StringEqual

func (t *Token) StringEqual(t1 *Token) bool

func (*Token) TypeEqual

func (t *Token) TypeEqual(ts ...TokenType) bool

func (*Token) Value

func (t *Token) Value() string

Value will calcuate the variable's Value, if the token contain some variables

type TokenType

type TokenType int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL