cleanup
This commit is contained in:
parent
1b21b8fde2
commit
59d0a333ed
39
char.go
39
char.go
@ -68,22 +68,6 @@ func (p *charParser) match(t rune) bool {
|
||||
return p.not
|
||||
}
|
||||
|
||||
func (p *charParser) matchBuild(t rune) bool {
|
||||
for _, ci := range p.chars {
|
||||
if ci == t {
|
||||
return !p.not
|
||||
}
|
||||
}
|
||||
|
||||
for _, ri := range p.ranges {
|
||||
if t >= ri[0] && t <= ri[1] {
|
||||
return !p.not
|
||||
}
|
||||
}
|
||||
|
||||
return p.not
|
||||
}
|
||||
|
||||
func (p *charParser) parse(t Trace, c *context) {
|
||||
// t = t.Extend(p.name)
|
||||
// t.Out1("parsing", c.offset)
|
||||
@ -102,17 +86,18 @@ func (p *charParser) parse(t Trace, c *context) {
|
||||
}
|
||||
|
||||
func (p *charParser) build(c *context) ([]*Node, bool) {
|
||||
// TODO: how to remove this check
|
||||
t, ok := c.token()
|
||||
if !ok {
|
||||
panic("damaged parser context")
|
||||
}
|
||||
panic("called char build")
|
||||
// // TODO: how to remove this check
|
||||
// t, ok := c.token()
|
||||
// if !ok {
|
||||
// panic("damaged parser context")
|
||||
// }
|
||||
|
||||
if !p.matchBuild(t) {
|
||||
return nil, false
|
||||
}
|
||||
// if !p.match(t) {
|
||||
// return nil, false
|
||||
// }
|
||||
|
||||
// always alias
|
||||
c.offset++
|
||||
return nil, true
|
||||
// // always alias
|
||||
// c.offset++
|
||||
// return nil, true
|
||||
}
|
||||
|
5
store.go
5
store.go
@ -1,10 +1,5 @@
|
||||
package treerack
|
||||
|
||||
// TODO:
|
||||
// - store it similarly to the excluded ones? sorted by offset?
|
||||
// - use a helper field for the last accessed position to walk from there? for every offset?
|
||||
// - use a helper field to store the largest value and its index, too? for an offset?
|
||||
|
||||
type store struct {
|
||||
noMatch []*idSet
|
||||
match [][]int
|
||||
|
Loading…
Reference in New Issue
Block a user