regex

package
v0.0.0-...-fa1654f Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONCATENATION_RE_SIMPLE_RE = iota
	NEW_AXIOM                  = iota
	RE_SIMPLE_RE               = iota
	RE_UNION                   = iota
	SET_ITEMS                  = iota
)

Variables

View Source
var Stats parsingStats

Stats contains some statistics that may be checked after a call to ParseString or ParseFile

Functions

func ParseFile

func ParseFile(filename string, numThreads int) (bool, *symbol)

ParseFile parses a file in parallel using an operator precedence grammar. It takes as input a filename and the number of threads, and returns a boolean representing the success or failure of the parsing and the symbol at the root of the syntactic tree (if successful).

func ParseString

func ParseString(str []byte, numThreads int) (bool, *symbol)

ParseString parses a string in parallel using an operator precedence grammar. It takes as input a string as a slice of bytes and the number of threads, and returns a boolean representing the success or failure of the parsing and the symbol at the root of the syntactic tree (if successful).

func SetCPUProfileFile

func SetCPUProfileFile(file *os.File)

Types

type Dfa

type Dfa struct {
	Initial   *DfaState
	Final     []*DfaState
	NumStates int
}

func (*Dfa) GetStates

func (dfa *Dfa) GetStates() []*DfaState

GetStates returns a slice containing all the states of the dfa. The states are sorted by their state number.

type DfaState

type DfaState struct {
	Num             int
	Transitions     [256]*DfaState
	IsFinal         bool
	AssociatedRules []int
}

type LOS

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

LOS is a list of stacks containing symbols. When the current stack is full a new one is automatically obtained and linked to it.

func (*LOS) HeadIterator

func (l *LOS) HeadIterator() iterator

HeadIterator returns an iterator initialized to point before the first element of the list.

func (*LOS) Length

func (l *LOS) Length() int

Length returns the number of symbols contained in the LOS

func (*LOS) Merge

func (l *LOS) Merge(l2 LOS)

Merge merges a LOS to another by linking their stacks.

func (*LOS) NumStacks

func (l *LOS) NumStacks() int

NumStacks returns the number of stacks contained in the LOS

func (*LOS) Pop

func (l *LOS) Pop() *symbol

Pop pops a symbol from the stack and returns a pointer to it.

func (*LOS) Println

func (l *LOS) Println()

Println prints the content of the LOS.

func (*LOS) Push

func (l *LOS) Push(sym *symbol) *symbol

Push pushes a symbol in the LOS. It returns a pointer to the pushed symbol.

func (*LOS) Split

func (l *LOS) Split(numSplits int) []LOS

Split splits a LOS into a number of lists equal to numSplits, which are returned as a slice of LOS. If there are not at least numSplits stacks in the LOS it panics. The original LOS should not be used after this operation.

func (*LOS) TailIterator

func (l *LOS) TailIterator() iterator

TailIterator returns an iterator initialized to point after the last element of the list.

type Nfa

type Nfa struct {
	Initial   *NfaState
	Final     *NfaState
	NumStates int
}

func NewEmptyStringNfa

func NewEmptyStringNfa() Nfa

func (*Nfa) AddAssociatedRule

func (nfa *Nfa) AddAssociatedRule(ruleNum int)

func (*Nfa) Concatenate

func (nfa *Nfa) Concatenate(nfa2 Nfa)

func (*Nfa) KleenePlus

func (nfa *Nfa) KleenePlus()

KleenePlus Operator +

func (*Nfa) KleeneStar

func (nfa *Nfa) KleeneStar()

KleeneStar Operator *

func (*Nfa) ToDfa

func (nfa *Nfa) ToDfa() Dfa

func (*Nfa) Unite

func (nfa *Nfa) Unite(nfa2 Nfa)

Unite Operator |

func (*Nfa) ZeroOrOne

func (nfa *Nfa) ZeroOrOne()

ZeroOrOne Operator ?

type NfaState

type NfaState struct {
	Transitions     [256][]*NfaState
	AssociatedRules []int
}

func (*NfaState) AddTransition

func (state *NfaState) AddTransition(char byte, ptr *NfaState)

func (*NfaState) EpsilonClosure

func (state *NfaState) EpsilonClosure() []*NfaState

Directories

Path Synopsis
Code generated by Gopapageno; DO NOT EDIT.
Code generated by Gopapageno; DO NOT EDIT.

Jump to

Keyboard shortcuts

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