diff --git a/char.go b/char.go index db4a0e7..25204bf 100644 --- a/char.go +++ b/char.go @@ -48,9 +48,9 @@ func (p *charParser) commitType() CommitType { } func (p *charParser) setIncludedBy(includedBy parser, parsers *idSet) { - if parsers.has(p.id) { - panic(cannotIncludeParsers(p.name)) - } + // if parsers.has(p.id) { + // panic(cannotIncludeParsers(p.name)) + // } p.includedBy = append(p.includedBy, includedBy) } diff --git a/choice.go b/choice.go index 522e9e3..4d75a52 100644 --- a/choice.go +++ b/choice.go @@ -78,9 +78,9 @@ func (p *choiceParser) nodeName() string { return p.name } func (p *choiceParser) nodeID() int { return p.id } func (p *choiceParser) setIncludedBy(includedBy parser, parsers *idSet) { - if parsers.has(p.id) { - return - } + // if parsers.has(p.id) { + // return + // } p.includedBy = append(p.includedBy, includedBy) } @@ -100,22 +100,22 @@ func (p *choiceParser) storeIncluded(c *context, n *Node) { } 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) if p.commit&Documentation != 0 { - // t.Out1("fail, doc") + t.Out1("fail, doc") c.fail(c.offset) return } - if _, ok := c.fromStore(p.id); ok { - // t.Out1("found in store, match:", m) + if m, ok := c.fromStore(p.id); ok { + t.Out1("found in store, match:", m) return } if c.excluded(c.offset, p.id) { - // t.Out1("excluded") + t.Out1("excluded") c.fail(c.offset) return } @@ -156,13 +156,13 @@ func (p *choiceParser) parse(t Trace, c *context) { } if match { - // t.Out1("choice, success") + t.Out1("choice, success") c.success(node) c.include(initialOffset, p.id) return } - // t.Out1("fail") + t.Out1("fail") c.store.set(node.From, p.id, nil) c.fail(node.From) c.include(initialOffset, p.id) diff --git a/mml_test.go b/mml_test.go index 554a0eb..fb519a5 100644 --- a/mml_test.go +++ b/mml_test.go @@ -9,7 +9,7 @@ import ( ) func TestMML(t *testing.T) { - test(t, "mml.parser", "mml", []testItem{{ + testTrace(t, "mml.parser", "mml", 1, []testItem{{ msg: "empty", node: &Node{Name: "mml"}, }, { diff --git a/sequence.go b/sequence.go index de54591..d27d394 100644 --- a/sequence.go +++ b/sequence.go @@ -99,9 +99,9 @@ func (p *sequenceParser) nodeName() string { return p.name } func (p *sequenceParser) nodeID() int { return p.id } func (p *sequenceParser) setIncludedBy(includedBy parser, parsers *idSet) { - if parsers.has(p.id) { - return - } + // if parsers.has(p.id) { + // return + // } p.includedBy = append(p.includedBy, includedBy) } @@ -121,17 +121,17 @@ func (p *sequenceParser) storeIncluded(c *context, n *Node) { } func (p *sequenceParser) parse(t Trace, c *context) { - // t = t.Extend(p.name) - // t.Out1("parsing sequence", c.offset) + t = t.Extend(p.name) + t.Out1("parsing sequence", c.offset) 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("excluded") + t.Out1("excluded") c.fail(c.offset) return } @@ -157,7 +157,7 @@ func (p *sequenceParser) parse(t Trace, c *context) { if !m { if currentCount < ranges[0][0] { - // t.Out1("fail, item failed") + t.Out1("fail, item failed") // c.store.set(node.From, p.id, nil) c.fail(node.From) c.include(initialOffset, p.id) @@ -186,7 +186,7 @@ func (p *sequenceParser) parse(t Trace, c *context) { } } - // t.Out1("success, items parsed") + t.Out1("success, items parsed") // c.store.set(node.From, p.id, node) for _, includedBy := range p.includedBy {