dfa

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const InitDFASize = 3

Variables

This section is empty.

Functions

func ConvertStringActionToFlag

func ConvertStringActionToFlag(aa string) (rv int)

func KeyIntMapStringSort

func KeyIntMapStringSort(in map[int]string) []int

func KeyIntSort

func KeyIntSort(in []int) (rv []int)

Types

type DFA_PoolType

type DFA_PoolType struct {
	Pool      []DFA_Type     //
	Cur       int            //
	Top       int            //
	NextFree  int            //
	InitState int            //
	Sigma     string         //
	MTab      *dfaTable      //
	TokList   *tok.TokenList // ATokBuffer TokenBuffer // Output Token Stuff
	MachineId int
}

func NewDFA_Pool

func NewDFA_Pool() *DFA_PoolType

----------------------------------------------------------------------------------------------------------------------------------------------- Create a new DFA pool

func (*DFA_PoolType) AddEdge

func (dfa *DFA_PoolType) AddEdge(fr, to int, on string)

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) ConvNDA_to_DFA

func (dfa *DFA_PoolType) ConvNDA_to_DFA(nn *nfa.NFA_PoolType)

func (*DFA_PoolType) ConvertToTable

func (dfa *DFA_PoolType) ConvertToTable() (rv dfaTable)

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) DiscardPool

func (dfa *DFA_PoolType) DiscardPool()

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) DumpPool

func (dfa *DFA_PoolType) DumpPool(all bool)

func (*DFA_PoolType) DumpPoolJSON

func (dfa *DFA_PoolType) DumpPoolJSON(fo io.Writer, td string, tn int)

func (*DFA_PoolType) DumpPoolOneState

func (dfa *DFA_PoolType) DumpPoolOneState(ii int) string

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) DumpTokenBuffer

func (dfa *DFA_PoolType) DumpTokenBuffer()

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) EdgeExists

func (dfa *DFA_PoolType) EdgeExists(fr, to int, on string) bool

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) FindNotVisited

func (dfa *DFA_PoolType) FindNotVisited() int

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) FinializeDFA

func (dfa *DFA_PoolType) FinializeDFA()

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) FreeDFA

func (dfa *DFA_PoolType) FreeDFA(ii int)

----------------------------------------------------------------------------------------------------------------------------------------------- Free an DFA tree node

func (*DFA_PoolType) GenerateGVFile

func (dfa *DFA_PoolType) GenerateGVFile(fo io.Writer, td string, tn int)

func (*DFA_PoolType) GetDFA

func (dfa *DFA_PoolType) GetDFA() int

----------------------------------------------------------------------------------------------------------------------------------------------- Allocate an DFA tree node

func (*DFA_PoolType) GetDFAName

func (dfa *DFA_PoolType) GetDFAName(StateSet []int) int

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) HaveStateAlready

func (dfa *DFA_PoolType) HaveStateAlready(inputSet []int) (loc int)

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) NoneVisited

func (dfa *DFA_PoolType) NoneVisited()

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) NumberOfStates

func (dfa *DFA_PoolType) NumberOfStates() (N_States int)

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) OutputInFormat

func (dfa *DFA_PoolType) OutputInFormat(fo io.Writer, format string)

-----------------------------------------------------------------------------------------------------------------------------------------------

func (*DFA_PoolType) Pos0Start

func (dfa *DFA_PoolType) Pos0Start() int

----------------------------------------------------------------------------------------------------------------------------------------------- Return the start state number

func (*DFA_PoolType) VerifyMachine

func (dfa *DFA_PoolType) VerifyMachine()

---------------------------------------------------------------------------------------------------------------------------------------------------------------

  1. Input Parsing Issues/Errors/Warnings
  2. Can not have A_Pop and A_Push at same time - Check for this.
  3. A_Pop must be a hard match -
  4. A_Pop must be a terminal! - Return() must have a Rv()
  5. A_Push, A_Pop, A_Reset can not be ambiguous tokens, can not {% POP and {%= Return a value, won't work ( At least not yet )

type DFA_Type

type DFA_Type struct {
	Next2      []nfa.TransitionType //
	Rv         int                  // 0 indicates not assigned, non-terminal
	Is0Ch      bool                 //	Tau
	Info       nfa.InfoType         //
	TRuleMatch int                  // may be a non-terminal that you want to know matched. -- A set of these is returned on matches or can be retrieved on fails too.
	NextFree   int                  //		For free list
	IsUsed     bool                 //		For Free list
	A_IAm      int                  //		Debug Usage
	LineNo     string               // LineNo where added
	StateName  string               // Used in NFA -> DFA
	StateSet   []int                //
	Visited    bool                 //
}

type Lexie

type Lexie struct {
	IsCompiled bool // Is it currently compiled into a DFA
	NFA        []*nfa.NFA_PoolType
	DFA        []*DFA_PoolType
	Machines   []int

	NFA_Machine []*nfa.NFA_PoolType
	DFA_Machine []*DFA_PoolType

	TokList *tok.TokenList // ATokBuffer TokenBuffer // Output Token Stuff

	Im *in.ImType

	InputReader  *pbread.PBReadType
	StartMachine string

	// Channel to return data on
	SendOnChanel bool
	Message      chan LexieChanelType
}

func NewLexie

func NewLexie() *Lexie

---------------------------------------------------------------------------------------------------------------------------------------------------------------

func (*Lexie) DumpTokenBuffer

func (lex *Lexie) DumpTokenBuffer(fo io.Writer)

lex .DumpTokenBuffer()

func (*Lexie) DumpTokenBuffer2

func (lex *Lexie) DumpTokenBuffer2(fo io.Writer)

func (*Lexie) FinializeMachines

func (lex *Lexie) FinializeMachines()

---------------------------------------------------------------------------------------------------------------------------------------------------------------

func (*Lexie) GetToken

func (lex *Lexie) GetToken() (AToken tok.Token)

---------------------------------------------------------------------------------------------------------------------------------------------------------------

func (*Lexie) InitGetToken

func (lex *Lexie) InitGetToken(rrr *pbread.PBReadType, sm string) (AToken tok.Token)

---------------------------------------------------------------------------------------------------------------------------------------------------------------

func (*Lexie) MatcherLexieTable

func (lex *Lexie) MatcherLexieTable(rrr *pbread.PBReadType, s_init string)

func (*Lexie) NewReadFile

func (lex *Lexie) NewReadFile(path string)

func (*Lexie) OutputActionFlags

func (lex *Lexie) OutputActionFlags(dfa *DFA_PoolType)

func (*Lexie) SetChanelOnOff

func (lex *Lexie) SetChanelOnOff(flag bool)

---------------------------------------------------------------------------------------------------------------------------------------------------------------

type LexieChanelType

type LexieChanelType struct {
	Token tok.Token
}

type LexieStackType

type LexieStackType struct {
	St int // Current State in
}

type MachineStatesType

type MachineStatesType struct {
	Rv   int          //
	Tau  bool         //
	Info nfa.InfoType //
	To   []int        //
}

type MatchContextType

type MatchContextType struct {
	St  int
	Dfa *DFA_PoolType
}

---------------------------------------------------------------------------------------------------------------------------------------------------------------

func NewContext

func NewContext(InitState int, dfa *DFA_PoolType) (rv *MatchContextType)

Jump to

Keyboard shortcuts

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