|
|
|
|
@ -1190,7 +1190,6 @@ func newParser(filename string, b []byte, opts ...Option) *parser {
|
|
|
|
|
Stats: &stats,
|
|
|
|
|
// start rule is rule [0] unless an alternate entrypoint is specified
|
|
|
|
|
entrypoint: g.rules[0].name,
|
|
|
|
|
emptyState: make(storeDict),
|
|
|
|
|
}
|
|
|
|
|
p.setOptions(opts)
|
|
|
|
|
|
|
|
|
|
@ -1279,9 +1278,6 @@ type parser struct {
|
|
|
|
|
choiceNoMatch string
|
|
|
|
|
// recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse
|
|
|
|
|
recoveryStack []map[string]interface{}
|
|
|
|
|
|
|
|
|
|
// emptyState contains an empty storeDict, which is used to optimize cloneState if global "state" store is not used.
|
|
|
|
|
emptyState storeDict
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// push a variable set on the vstack.
|
|
|
|
|
@ -1455,13 +1451,6 @@ func (p *parser) cloneState() storeDict {
|
|
|
|
|
defer p.out(p.in("cloneState"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(p.cur.state) == 0 {
|
|
|
|
|
if len(p.emptyState) > 0 {
|
|
|
|
|
p.emptyState = make(storeDict)
|
|
|
|
|
}
|
|
|
|
|
return p.emptyState
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state := make(storeDict, len(p.cur.state))
|
|
|
|
|
for k, v := range p.cur.state {
|
|
|
|
|
if c, ok := v.(Cloner); ok {
|
|
|
|
|
|