Documentation ¶
Index ¶
- type Condition
- type ConditionChain
- type ConditionalChain
- type ConditionalCheck
- type Else
- type ElseBehaviour
- type IdentPrefixes
- type If
- type Parser
- func (p *Parser) AddUseToken(token ...TokenSelfProvider)
- func (p *Parser) AddUseTokenFirst(token ...TokenSelfProvider)
- func (p *Parser) ConditionWithChain(start int, end int) bool
- func (p *Parser) Copy(start int, end int) *Parser
- func (p *Parser) Execute(line string) (interface{}, error)
- func (p *Parser) GetTokenValue(token TokenSelfProvider) interface{}
- func (p *Parser) Parse(line string)
- func (p *Parser) Print(i ...interface{})
- func (p *Parser) Printf(format string, i ...interface{})
- func (p *Parser) Println(i ...interface{})
- func (p *Parser) SetExecCallBack(callback func(TokenSelfProvider, []TokenSelfProvider) (interface{}, error))
- func (p *Parser) SetNeighborTokens(tokens []TokenSelfProvider)
- func (p *Parser) SetUseTokens(tokens []TokenSelfProvider)
- func (p *Parser) SetVariableRequester(requester func(string) (interface{}, error))
- type Runable
- type ScanToken
- type TAnd
- type TAssign
- type TAssignPlus
- type TBool
- type TBracketClose
- type TBracketOpen
- type TCurlyClose
- type TCurlyOpen
- type TDivide
- type TEqual
- type TFloat
- type TGreater
- type TGreaterOrEqual
- type TInt
- type TLess
- type TLessOrEqual
- type TMinus
- type TModulo
- type TMultiply
- type TNot
- type TNotEqual
- type TOr
- type TOrPrecedence
- type TPlus
- type TPrefixedVariable
- type TPrint
- type TSemiColon
- type TSet
- type TString
- type TVar
- type TVariable
- type TXor
- type Then
- type ThenBehaviour
- type TokenSelfProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConditionChain ¶
type ConditionalChain ¶
type ConditionalChain struct {
// contains filtered or unexported fields
}
type ConditionalCheck ¶
type ConditionalCheck interface {
// contains filtered or unexported methods
}
this is the interface that all token types must implement that is ment for start any conditional check. like IF, WHILE, FOR, SWITCH, CASE, DEFAULT
type Else ¶
type Else struct {
Pos int
}
func (*Else) Copy ¶
func (t *Else) Copy() TokenSelfProvider
func (*Else) ElseBehaviour ¶
type ElseBehaviour ¶
type ElseBehaviour interface {
ElseBehaviour() bool
}
type IdentPrefixes ¶
type IdentPrefixes struct { Rune rune CallBack func(TokenSelfProvider, interface{}) (interface{}, error) }
type If ¶
type If struct {
Pos int
}
the conditional IF token
func (*If) Copy ¶
func (i *If) Copy() TokenSelfProvider
type Parser ¶
type Parser struct { PrintByFmt bool ConditionStartToken string ConditionEndToken string // contains filtered or unexported fields }
func (*Parser) AddUseToken ¶
func (p *Parser) AddUseToken(token ...TokenSelfProvider)
AddUseToken adds a token that is used in the line
func (*Parser) AddUseTokenFirst ¶
func (p *Parser) AddUseTokenFirst(token ...TokenSelfProvider)
AddUseToken adds a token that is used in the line
func (*Parser) GetTokenValue ¶
func (p *Parser) GetTokenValue(token TokenSelfProvider) interface{}
func (*Parser) SetExecCallBack ¶
func (p *Parser) SetExecCallBack(callback func(TokenSelfProvider, []TokenSelfProvider) (interface{}, error))
func (*Parser) SetNeighborTokens ¶
func (p *Parser) SetNeighborTokens(tokens []TokenSelfProvider)
SetNeighborTokens sets the tokens that are required to recheck if they are assigned, but depending on neighbors, it turns out they are are other tokens ment. like == and =, or > and >=
func (*Parser) SetUseTokens ¶
func (p *Parser) SetUseTokens(tokens []TokenSelfProvider)
SetUseTokens sets the tokens that are used in the line and have to be parsed.
func (*Parser) SetVariableRequester ¶
type ScanToken ¶
type ScanToken struct { Pos int //reported position in line Value string // the value of the token }
this is the basic token type it is used to scan the input string
type TAnd ¶
type TAnd struct {
Pos int
}
func (*TAnd) Copy ¶
func (t *TAnd) Copy() TokenSelfProvider
func (*TAnd) IsStillValid ¶
type TAssign ¶
type TAssign struct {
Pos int
}
func (*TAssign) Copy ¶
func (t *TAssign) Copy() TokenSelfProvider
type TAssignPlus ¶
type TAssignPlus struct {
Pos int
}
func (*TAssignPlus) Copy ¶
func (t *TAssignPlus) Copy() TokenSelfProvider
func (*TAssignPlus) ItsMe ¶
func (t *TAssignPlus) ItsMe(token ScanToken) bool
func (*TAssignPlus) SetValue ¶
func (t *TAssignPlus) SetValue(token ScanToken)
type TBracketClose ¶
type TBracketClose struct {
Pos int
}
func (*TBracketClose) Copy ¶
func (t *TBracketClose) Copy() TokenSelfProvider
func (*TBracketClose) ItsMe ¶
func (t *TBracketClose) ItsMe(token ScanToken) bool
func (*TBracketClose) SetValue ¶
func (t *TBracketClose) SetValue(token ScanToken)
type TBracketOpen ¶
type TBracketOpen struct {
Pos int
}
func (*TBracketOpen) Copy ¶
func (t *TBracketOpen) Copy() TokenSelfProvider
func (*TBracketOpen) ItsMe ¶
func (t *TBracketOpen) ItsMe(token ScanToken) bool
func (*TBracketOpen) SetValue ¶
func (t *TBracketOpen) SetValue(token ScanToken)
type TCurlyClose ¶
type TCurlyClose struct {
Pos int
}
func (*TCurlyClose) Copy ¶
func (t *TCurlyClose) Copy() TokenSelfProvider
func (*TCurlyClose) ItsMe ¶
func (t *TCurlyClose) ItsMe(token ScanToken) bool
func (*TCurlyClose) SetValue ¶
func (t *TCurlyClose) SetValue(token ScanToken)
type TCurlyOpen ¶
type TCurlyOpen struct {
Pos int
}
func (*TCurlyOpen) Copy ¶
func (t *TCurlyOpen) Copy() TokenSelfProvider
func (*TCurlyOpen) ItsMe ¶
func (t *TCurlyOpen) ItsMe(token ScanToken) bool
func (*TCurlyOpen) SetValue ¶
func (t *TCurlyOpen) SetValue(token ScanToken)
type TDivide ¶
type TDivide struct {
Pos int
}
func (*TDivide) Copy ¶
func (t *TDivide) Copy() TokenSelfProvider
type TEqual ¶
type TEqual struct {
Pos int
}
func (*TEqual) Copy ¶
func (t *TEqual) Copy() TokenSelfProvider
type TGreater ¶
type TGreater struct {
Pos int
}
func (*TGreater) Copy ¶
func (t *TGreater) Copy() TokenSelfProvider
type TGreaterOrEqual ¶
type TGreaterOrEqual struct {
Pos int
}
func (*TGreaterOrEqual) Copy ¶
func (t *TGreaterOrEqual) Copy() TokenSelfProvider
func (*TGreaterOrEqual) ItsMe ¶
func (t *TGreaterOrEqual) ItsMe(token ScanToken) bool
func (*TGreaterOrEqual) SetValue ¶
func (t *TGreaterOrEqual) SetValue(token ScanToken)
type TLess ¶
type TLess struct {
Pos int
}
func (*TLess) Copy ¶
func (t *TLess) Copy() TokenSelfProvider
type TLessOrEqual ¶
type TLessOrEqual struct {
Pos int
}
func (*TLessOrEqual) Copy ¶
func (t *TLessOrEqual) Copy() TokenSelfProvider
func (*TLessOrEqual) ItsMe ¶
func (t *TLessOrEqual) ItsMe(token ScanToken) bool
func (*TLessOrEqual) SetValue ¶
func (t *TLessOrEqual) SetValue(token ScanToken)
type TMinus ¶
type TMinus struct {
Pos int
}
func (*TMinus) Copy ¶
func (t *TMinus) Copy() TokenSelfProvider
type TModulo ¶
type TModulo struct {
Pos int
}
func (*TModulo) Copy ¶
func (t *TModulo) Copy() TokenSelfProvider
type TMultiply ¶
type TMultiply struct {
Pos int
}
func (*TMultiply) Copy ¶
func (t *TMultiply) Copy() TokenSelfProvider
type TNot ¶
type TNot struct {
Pos int
}
func (*TNot) Copy ¶
func (t *TNot) Copy() TokenSelfProvider
type TNotEqual ¶
type TNotEqual struct {
Pos int
}
func (*TNotEqual) Copy ¶
func (t *TNotEqual) Copy() TokenSelfProvider
type TOr ¶
type TOr struct {
Pos int
}
func (*TOr) Copy ¶
func (t *TOr) Copy() TokenSelfProvider
func (*TOr) IsStillValid ¶
type TOrPrecedence ¶
type TOrPrecedence struct {
Pos int
}
func (*TOrPrecedence) Copy ¶
func (t *TOrPrecedence) Copy() TokenSelfProvider
func (*TOrPrecedence) ItsMe ¶
func (t *TOrPrecedence) ItsMe(token ScanToken) bool
func (*TOrPrecedence) SetValue ¶
func (t *TOrPrecedence) SetValue(token ScanToken)
type TPlus ¶
type TPlus struct {
Pos int
}
func (*TPlus) Copy ¶
func (t *TPlus) Copy() TokenSelfProvider
type TPrefixedVariable ¶
func (*TPrefixedVariable) Copy ¶
func (t *TPrefixedVariable) Copy() TokenSelfProvider
func (*TPrefixedVariable) ItsMe ¶
func (t *TPrefixedVariable) ItsMe(token ScanToken) bool
func (*TPrefixedVariable) SetValue ¶
func (t *TPrefixedVariable) SetValue(token ScanToken)
type TPrint ¶
type TPrint struct {
Pos int
}
func (*TPrint) Copy ¶
func (t *TPrint) Copy() TokenSelfProvider
type TSemiColon ¶
type TSemiColon struct {
Pos int
}
func (*TSemiColon) Copy ¶
func (t *TSemiColon) Copy() TokenSelfProvider
func (*TSemiColon) ItsMe ¶
func (t *TSemiColon) ItsMe(token ScanToken) bool
func (*TSemiColon) SetValue ¶
func (t *TSemiColon) SetValue(token ScanToken)
type TSet ¶
type TSet struct {
Pos int
}
func (*TSet) Copy ¶
func (t *TSet) Copy() TokenSelfProvider
type TXor ¶
type TXor struct {
Pos int
}
func (*TXor) Copy ¶
func (t *TXor) Copy() TokenSelfProvider
func (*TXor) IsStillValid ¶
type Then ¶
type Then struct {
Pos int
}
func (*Then) Copy ¶
func (t *Then) Copy() TokenSelfProvider
func (*Then) ThenBehaviour ¶
type ThenBehaviour ¶
type ThenBehaviour interface {
ThenBehaviour() bool
}
type TokenSelfProvider ¶
type TokenSelfProvider interface { ItsMe(token ScanToken) bool // check if the token is of this type SetValue(token ScanToken) // set the value of the token Copy() TokenSelfProvider // copy the token }
this is the interface that all token types must implement it is used to check if a token is of a certain type
func BasicTokens ¶
func BasicTokens() []TokenSelfProvider