don't track terminals
This commit is contained in:
parent
fa14548297
commit
950eb2f2f6
11
sequence.go
11
sequence.go
@ -196,6 +196,7 @@ func (p *sequenceParser) parse(t Trace, c *context) {
|
||||
// return
|
||||
// }
|
||||
|
||||
if !p.allChars {
|
||||
if c.excluded(c.offset, p.id) {
|
||||
// t.Out1("fail, excluded")
|
||||
c.fail(c.offset)
|
||||
@ -203,6 +204,7 @@ func (p *sequenceParser) parse(t Trace, c *context) {
|
||||
}
|
||||
|
||||
c.exclude(c.offset, p.id)
|
||||
}
|
||||
|
||||
itemIndex := 0
|
||||
var currentCount int
|
||||
@ -217,7 +219,11 @@ func (p *sequenceParser) parse(t Trace, c *context) {
|
||||
if currentCount < p.ranges[itemIndex][0] {
|
||||
// c.store.setNoMatch(from, p.id)
|
||||
c.fail(from)
|
||||
|
||||
if !p.allChars {
|
||||
c.include(from, p.id)
|
||||
}
|
||||
|
||||
// t.Out1("fail, not enough items")
|
||||
return
|
||||
}
|
||||
@ -240,18 +246,23 @@ func (p *sequenceParser) parse(t Trace, c *context) {
|
||||
}
|
||||
}
|
||||
|
||||
if !p.allChars {
|
||||
for _, includedBy := range p.includedBy {
|
||||
if c.excluded(from, includedBy) {
|
||||
// t.Out1("storing included", includedBy)
|
||||
c.store.setMatch(from, includedBy, to)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// t.Out1("success")
|
||||
c.store.setMatch(from, p.id, to)
|
||||
c.success(to)
|
||||
|
||||
if !p.allChars {
|
||||
c.include(from, p.id)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *sequenceBuilder) nodeName() string { return b.name }
|
||||
func (b *sequenceBuilder) nodeID() int { return b.id }
|
||||
|
Loading…
Reference in New Issue
Block a user