don't track terminals

This commit is contained in:
Arpad Ryszka 2017-08-06 03:42:35 +02:00
parent fa14548297
commit 950eb2f2f6

View File

@ -196,6 +196,7 @@ func (p *sequenceParser) parse(t Trace, c *context) {
// return // return
// } // }
if !p.allChars {
if c.excluded(c.offset, p.id) { if c.excluded(c.offset, p.id) {
// t.Out1("fail, excluded") // t.Out1("fail, excluded")
c.fail(c.offset) c.fail(c.offset)
@ -203,6 +204,7 @@ func (p *sequenceParser) parse(t Trace, c *context) {
} }
c.exclude(c.offset, p.id) c.exclude(c.offset, p.id)
}
itemIndex := 0 itemIndex := 0
var currentCount int var currentCount int
@ -217,7 +219,11 @@ func (p *sequenceParser) parse(t Trace, c *context) {
if currentCount < p.ranges[itemIndex][0] { if currentCount < p.ranges[itemIndex][0] {
// c.store.setNoMatch(from, p.id) // c.store.setNoMatch(from, p.id)
c.fail(from) c.fail(from)
if !p.allChars {
c.include(from, p.id) c.include(from, p.id)
}
// t.Out1("fail, not enough items") // t.Out1("fail, not enough items")
return return
} }
@ -240,17 +246,22 @@ func (p *sequenceParser) parse(t Trace, c *context) {
} }
} }
if !p.allChars {
for _, includedBy := range p.includedBy { for _, includedBy := range p.includedBy {
if c.excluded(from, includedBy) { if c.excluded(from, includedBy) {
// t.Out1("storing included", includedBy) // t.Out1("storing included", includedBy)
c.store.setMatch(from, includedBy, to) c.store.setMatch(from, includedBy, to)
} }
} }
}
// t.Out1("success") // t.Out1("success")
c.store.setMatch(from, p.id, to) c.store.setMatch(from, p.id, to)
c.success(to) c.success(to)
if !p.allChars {
c.include(from, p.id) c.include(from, p.id)
}
} }
func (b *sequenceBuilder) nodeName() string { return b.name } func (b *sequenceBuilder) nodeName() string { return b.name }