Documentation ¶
Index ¶
- type Capture
- func (c *Capture) Child(n int) *Capture
- func (c *Capture) ChildIterator(start int) func() *Capture
- func (c *Capture) Dummy() bool
- func (c *Capture) End() int
- func (c *Capture) Id() int
- func (c *Capture) Len() int
- func (c *Capture) NumChildren() int
- func (c *Capture) Start() int
- func (c *Capture) String() string
- type Edit
- type Entry
- type NoneTable
- type Table
- type TreeTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capture ¶
type Capture struct {
// contains filtered or unexported fields
}
func NewCaptureDummy ¶
func (*Capture) ChildIterator ¶
func (*Capture) NumChildren ¶
type Edit ¶
An Edit represents a modification to the subject string where the interval [Start, End) is modified to be Len bytes. If Len = 0, this is equivalent to deleting the interval, and if Start = End this is an insertion.
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
An Entry represents a memoized parse result. It stores the non-terminal memoized, the start position of the parse result, the length, and the number of characters examined to make the parse determination. If the length is -1, the non-terminal failed to match at this location (but still may have examined a non-zero number of characters).
func (*Entry) Captures ¶
Captures returns the captures that occurred within this memoized parse result.
type NoneTable ¶
type NoneTable struct{}
NoneTable implements a memoization table that does nothing.
type Table ¶
type Table interface { // Get returns the entry associated with the given position and ID. If // there are multiple entries with the same ID at that position, the // largest entry is returned (determined by matched length). Get(id, pos int) (*Entry, bool) // Put adds a new entry to the table. Put(id, start, length, examined, count int, captures []*Capture) // ApplyEdit updates the table as necessary when an edit occurs. This // operation invalidates all entries within the range of the edit and // shifts entries that are to the right of the edit as necessary. ApplyEdit(Edit) AllValues() []*Entry // Size returns the number of entries in the table. Size() int }
A Table is an interface for a memoization table data structure. The memoization table tracks memoized parse results corresponding to a non-terminal parsed at a certain location. The table interface defines the ApplyEdit function which is crucial for incremental parsing.
type TreeTable ¶
TreeTable implements a memoization table using an interval tree (augmented to support efficient shifting).