disable tracing

This commit is contained in:
Arpad Ryszka 2017-07-29 23:26:08 +02:00
parent ad025586f2
commit a592d1b4a5
3 changed files with 21 additions and 19 deletions

View File

@ -69,16 +69,16 @@ func (p *charParser) match(t rune) bool {
}
func (p *charParser) parse(t Trace, c *context) {
t = t.Extend(p.name)
t.Out1("parsing", c.offset)
// t = t.Extend(p.name)
// t.Out1("parsing", c.offset)
if tok, ok := c.token(); !ok || !p.match(tok) {
t.Out1("fail")
// t.Out1("fail")
c.fail(c.offset)
return
}
t.Out1("success")
// t.Out1("success")
c.success(c.offset + 1)
for _, includedBy := range p.includedBy {
c.store.setMatch(c.offset, includedBy, c.offset+1)

View File

@ -144,23 +144,23 @@ func (p *choiceParser) nodeName() string { return p.name }
func (p *choiceParser) nodeID() int { return p.id }
func (p *choiceParser) parse(t Trace, c *context) {
t = t.Extend(p.name)
t.Out1("parsing choice", c.offset)
// t = t.Extend(p.name)
// t.Out1("parsing choice", c.offset)
// TODO: don't add documentation
if p.commit&Documentation != 0 {
t.Out1("fail, doc")
// t.Out1("fail, doc")
c.fail(c.offset)
return
}
if m, ok := c.fromStore(p.id); ok {
t.Out1("found in store, match:", m)
if _, ok := c.fromStore(p.id); ok {
// t.Out1("found in store, match:", m)
return
}
if c.excluded(c.offset, p.id) {
t.Out1("fail, excluded")
// t.Out1("fail, excluded")
c.fail(c.offset)
return
}
@ -194,7 +194,7 @@ func (p *choiceParser) parse(t Trace, c *context) {
c.store.setMatch(from, p.id, to)
for _, includedBy := range p.includedBy {
if c.excluded(from, includedBy) {
t.Out1("storing included", includedBy)
// t.Out1("storing included", includedBy)
c.store.setMatch(from, includedBy, to)
}
}
@ -208,11 +208,11 @@ func (p *choiceParser) parse(t Trace, c *context) {
if match {
c.success(to)
c.include(from, p.id)
t.Out1("choice, success")
// t.Out1("choice, success")
return
}
t.Out1("fail")
// t.Out1("fail")
c.store.setNoMatch(from, p.id)
c.fail(from)
c.include(from, p.id)

View File

@ -171,15 +171,17 @@ func (p *sequenceParser) nodeName() string { return p.name }
func (p *sequenceParser) nodeID() int { return p.id }
func (p *sequenceParser) parse(t Trace, c *context) {
t = t.Extend(p.name)
// t = t.Extend(p.name)
// t.Out1("parsing sequence")
if p.commit&Documentation != 0 {
t.Out1("fail, doc")
// t.Out1("fail, doc")
c.fail(c.offset)
return
}
if c.excluded(c.offset, p.id) {
t.Out1("fail, excluded")
// t.Out1("fail, excluded")
c.fail(c.offset)
return
}
@ -203,7 +205,7 @@ func (p *sequenceParser) parse(t Trace, c *context) {
// c.store.setNoMatch(from, p.id)
c.fail(from)
c.include(from, p.id)
t.Out1("fail, not enough items")
// t.Out1("fail, not enough items")
return
}
@ -227,12 +229,12 @@ func (p *sequenceParser) parse(t Trace, c *context) {
for _, includedBy := range p.includedBy {
if c.excluded(from, includedBy) {
t.Out1("storing included", includedBy)
// t.Out1("storing included", includedBy)
c.store.setMatch(from, includedBy, to)
}
}
t.Out1("success")
// t.Out1("success")
c.store.setMatch(from, p.id, to)
c.success(to)
c.include(from, p.id)