linehack

package module
v0.0.0-...-3dbd443 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition interface {
	// contains filtered or unexported methods
}

type ConditionChain

type ConditionChain interface {
	IsStillValid([]bool) bool
}

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

func (t *Else) ElseBehaviour() bool

func (*Else) ItsMe

func (t *Else) ItsMe(token ScanToken) bool

func (*Else) SetValue

func (t *Else) SetValue(token ScanToken)

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

func (*If) ItsMe

func (i *If) ItsMe(token ScanToken) bool

func (*If) SetValue

func (i *If) SetValue(token ScanToken)

type Parser

type Parser struct {
	PrintByFmt bool

	ConditionStartToken string
	ConditionEndToken   string
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

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) ConditionWithChain

func (p *Parser) ConditionWithChain(start int, end int) bool

func (*Parser) Copy

func (p *Parser) Copy(start int, end int) *Parser

func (*Parser) Execute

func (p *Parser) Execute(line string) (interface{}, error)

func (*Parser) GetTokenValue

func (p *Parser) GetTokenValue(token TokenSelfProvider) interface{}

func (*Parser) Parse

func (p *Parser) Parse(line string)

func (*Parser) Print

func (p *Parser) Print(i ...interface{})

func (*Parser) Printf

func (p *Parser) Printf(format string, i ...interface{})

func (*Parser) Println

func (p *Parser) Println(i ...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

func (p *Parser) SetVariableRequester(requester func(string) (interface{}, error))

type Runable

type Runable interface {
	Run(...interface{}) (interface{}, error) // run the token
	GetPos() int                             // returns the position of the token
}

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

func (t *TAnd) IsStillValid(args []bool) bool

func (*TAnd) ItsMe

func (t *TAnd) ItsMe(token ScanToken) bool

func (*TAnd) SetValue

func (t *TAnd) SetValue(token ScanToken)

type TAssign

type TAssign struct {
	Pos int
}

func (*TAssign) Copy

func (t *TAssign) Copy() TokenSelfProvider

func (*TAssign) ItsMe

func (t *TAssign) ItsMe(token ScanToken) bool

func (*TAssign) SetValue

func (t *TAssign) SetValue(token ScanToken)

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 TBool

type TBool struct {
	Value bool
	Pos   int
}

func (*TBool) Copy

func (t *TBool) Copy() TokenSelfProvider

func (*TBool) ItsMe

func (t *TBool) ItsMe(token ScanToken) bool

func (*TBool) SetValue

func (t *TBool) 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

func (*TDivide) ItsMe

func (t *TDivide) ItsMe(token ScanToken) bool

func (*TDivide) SetValue

func (t *TDivide) SetValue(token ScanToken)

type TEqual

type TEqual struct {
	Pos int
}

func (*TEqual) Copy

func (t *TEqual) Copy() TokenSelfProvider

func (*TEqual) ItsMe

func (t *TEqual) ItsMe(token ScanToken) bool

func (*TEqual) SetValue

func (t *TEqual) SetValue(token ScanToken)

type TFloat

type TFloat struct {
	Value float64
	Pos   int
}

func (*TFloat) Copy

func (t *TFloat) Copy() TokenSelfProvider

func (*TFloat) ItsMe

func (t *TFloat) ItsMe(token ScanToken) bool

func (*TFloat) SetValue

func (t *TFloat) SetValue(token ScanToken)

type TGreater

type TGreater struct {
	Pos int
}

func (*TGreater) Copy

func (t *TGreater) Copy() TokenSelfProvider

func (*TGreater) ItsMe

func (t *TGreater) ItsMe(token ScanToken) bool

func (*TGreater) SetValue

func (t *TGreater) SetValue(token ScanToken)

type TGreaterOrEqual

type TGreaterOrEqual struct {
	Pos int
}

func (*TGreaterOrEqual) Copy

func (*TGreaterOrEqual) ItsMe

func (t *TGreaterOrEqual) ItsMe(token ScanToken) bool

func (*TGreaterOrEqual) SetValue

func (t *TGreaterOrEqual) SetValue(token ScanToken)

type TInt

type TInt struct {
	Value int
	Pos   int
}

func (*TInt) Copy

func (t *TInt) Copy() TokenSelfProvider

func (*TInt) ItsMe

func (t *TInt) ItsMe(token ScanToken) bool

func (*TInt) SetValue

func (t *TInt) SetValue(token ScanToken)

type TLess

type TLess struct {
	Pos int
}

func (*TLess) Copy

func (t *TLess) Copy() TokenSelfProvider

func (*TLess) ItsMe

func (t *TLess) ItsMe(token ScanToken) bool

func (*TLess) SetValue

func (t *TLess) SetValue(token ScanToken)

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

func (*TMinus) ItsMe

func (t *TMinus) ItsMe(token ScanToken) bool

func (*TMinus) SetValue

func (t *TMinus) SetValue(token ScanToken)

type TModulo

type TModulo struct {
	Pos int
}

func (*TModulo) Copy

func (t *TModulo) Copy() TokenSelfProvider

func (*TModulo) ItsMe

func (t *TModulo) ItsMe(token ScanToken) bool

func (*TModulo) SetValue

func (t *TModulo) SetValue(token ScanToken)

type TMultiply

type TMultiply struct {
	Pos int
}

func (*TMultiply) Copy

func (t *TMultiply) Copy() TokenSelfProvider

func (*TMultiply) ItsMe

func (t *TMultiply) ItsMe(token ScanToken) bool

func (*TMultiply) SetValue

func (t *TMultiply) SetValue(token ScanToken)

type TNot

type TNot struct {
	Pos int
}

func (*TNot) Copy

func (t *TNot) Copy() TokenSelfProvider

func (*TNot) ItsMe

func (t *TNot) ItsMe(token ScanToken) bool

func (*TNot) SetValue

func (t *TNot) SetValue(token ScanToken)

type TNotEqual

type TNotEqual struct {
	Pos int
}

func (*TNotEqual) Copy

func (t *TNotEqual) Copy() TokenSelfProvider

func (*TNotEqual) ItsMe

func (t *TNotEqual) ItsMe(token ScanToken) bool

func (*TNotEqual) SetValue

func (t *TNotEqual) SetValue(token ScanToken)

type TOr

type TOr struct {
	Pos int
}

func (*TOr) Copy

func (t *TOr) Copy() TokenSelfProvider

func (*TOr) IsStillValid

func (t *TOr) IsStillValid(args []bool) bool

func (*TOr) ItsMe

func (t *TOr) ItsMe(token ScanToken) bool

func (*TOr) SetValue

func (t *TOr) SetValue(token ScanToken)

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

func (*TPlus) ItsMe

func (t *TPlus) ItsMe(token ScanToken) bool

func (*TPlus) SetValue

func (t *TPlus) SetValue(token ScanToken)

type TPrefixedVariable

type TPrefixedVariable struct {
	Value string
	Pos   int
}

func (*TPrefixedVariable) Copy

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

func (*TPrint) ItsMe

func (t *TPrint) ItsMe(token ScanToken) bool

func (*TPrint) SetValue

func (t *TPrint) SetValue(token ScanToken)

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

func (*TSet) ItsMe

func (t *TSet) ItsMe(token ScanToken) bool

func (*TSet) SetValue

func (t *TSet) SetValue(token ScanToken)

type TString

type TString struct {
	Value string
	Pos   int
}

func (*TString) Copy

func (t *TString) Copy() TokenSelfProvider

func (*TString) ItsMe

func (t *TString) ItsMe(token ScanToken) bool

func (*TString) SetValue

func (t *TString) SetValue(token ScanToken)

type TVar

type TVar struct {
	Value string
	Pos   int
}

func (*TVar) Copy

func (t *TVar) Copy() TokenSelfProvider

func (*TVar) ItsMe

func (t *TVar) ItsMe(token ScanToken) bool

func (*TVar) SetValue

func (t *TVar) SetValue(token ScanToken)

type TVariable

type TVariable struct {
	Value string
	Pos   int
}

func (*TVariable) Copy

func (t *TVariable) Copy() TokenSelfProvider

func (*TVariable) ItsMe

func (t *TVariable) ItsMe(token ScanToken) bool

func (*TVariable) SetValue

func (t *TVariable) SetValue(token ScanToken)

type TXor

type TXor struct {
	Pos int
}

func (*TXor) Copy

func (t *TXor) Copy() TokenSelfProvider

func (*TXor) IsStillValid

func (t *TXor) IsStillValid(args []bool) bool

func (*TXor) ItsMe

func (t *TXor) ItsMe(token ScanToken) bool

func (*TXor) SetValue

func (t *TXor) SetValue(token ScanToken)

type Then

type Then struct {
	Pos int
}

func (*Then) Copy

func (t *Then) Copy() TokenSelfProvider

func (*Then) ItsMe

func (t *Then) ItsMe(token ScanToken) bool

func (*Then) SetValue

func (t *Then) SetValue(token ScanToken)

func (*Then) ThenBehaviour

func (t *Then) ThenBehaviour() bool

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

Jump to

Keyboard shortcuts

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