diff --git a/char.go b/char.go index 1514e0c..9a74523 100644 --- a/char.go +++ b/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 } diff --git a/store.go b/store.go index 3bc5660..a2e224b 100644 --- a/store.go +++ b/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