func Memoize(b bool) Option {
	return func(p *parser) Option {
		old := p.memoize
		p.memoize = b
		return Memoize(old)
	}
}
Memoize creates an Option to set the memoize flag to b. When set to true,
the parser will cache all results so each expression is evaluated only
once. This guarantees linear parsing time even for pathological cases,
at the expense of more memory and slower times for typical cases.

The default is false.
package shorthand
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"unicode"
	"unicode/utf8"
)
var g = &grammar{
	rules: []*rule{
		{
			name: "ShortHand",
			pos:  position{line: 7, col: 1, offset: 131},
			expr: &actionExpr{
				pos: position{line: 7, col: 13, offset: 145},
				run: (*parser).callonShortHand1,
				expr: &seqExpr{
					pos: position{line: 7, col: 13, offset: 145},
					exprs: []interface{}{
						&labeledExpr{
							pos:   position{line: 7, col: 13, offset: 145},
							label: "val",
							expr: &ruleRefExpr{
								pos:  position{line: 7, col: 17, offset: 149},
								name: "Object",
							},
						},
						&ruleRefExpr{
							pos:  position{line: 7, col: 24, offset: 156},
							name: "EOF",
						},
					},
				},
			},
		},
		{
			name: "Object",
			pos:  position{line: 11, col: 1, offset: 183},
			expr: &actionExpr{
				pos: position{line: 11, col: 10, offset: 194},
				run: (*parser).callonObject1,
				expr: &seqExpr{
					pos: position{line: 11, col: 10, offset: 194},
					exprs: []interface{}{
						&ruleRefExpr{
							pos:  position{line: 11, col: 10, offset: 194},
							name: "_",
						},
						&labeledExpr{
							pos:   position{line: 11, col: 12, offset: 196},
							label: "vals",
							expr: &seqExpr{
								pos: position{line: 11, col: 18, offset: 202},
								exprs: []interface{}{
									&ruleRefExpr{
										pos:  position{line: 11, col: 18, offset: 202},
										name: "KeyValue",
									},
									&zeroOrMoreExpr{
										pos: position{line: 11, col: 27, offset: 211},
										expr: &seqExpr{
											pos: position{line: 11, col: 28, offset: 212},
											exprs: []interface{}{
												&litMatcher{
													pos:        position{line: 11, col: 28, offset: 212},
													val:        ",",
													ignoreCase: false,
												},
												&ruleRefExpr{
													pos:  position{line: 11, col: 32, offset: 216},
													name: "_",
												},
												&ruleRefExpr{
													pos:  position{line: 11, col: 34, offset: 218},
													name: "KeyValue",
												},
											},
										},
									},
								},
							},
						},
						&ruleRefExpr{
							pos:  position{line: 11, col: 46, offset: 230},
							name: "_",
						},
					},
				},
			},
		},
		{
			name: "KeyValue",
			pos:  position{line: 28, col: 1, offset: 547},
			expr: &actionExpr{
				pos: position{line: 28, col: 12, offset: 560},
				run: (*parser).callonKeyValue1,
				expr: &seqExpr{
					pos: position{line: 28, col: 12, offset: 560},
					exprs: []interface{}{
						&labeledExpr{
							pos:   position{line: 28, col: 12, offset: 560},
							label: "k",
							expr: &ruleRefExpr{
								pos:  position{line: 28, col: 14, offset: 562},
								name: "Key",
							},
						},
						&labeledExpr{
							pos:   position{line: 28, col: 18, offset: 566},
							label: "v",
							expr: &choiceExpr{
								pos: position{line: 28, col: 21, offset: 569},
								alternatives: []interface{}{
									&seqExpr{
										pos: position{line: 28, col: 22, offset: 570},
										exprs: []interface{}{
											&litMatcher{
												pos:        position{line: 28, col: 22, offset: 570},
												val:        ":",
												ignoreCase: false,
											},
											&zeroOrOneExpr{
												pos: position{line: 28, col: 26, offset: 574},
												expr: &ruleRefExpr{
													pos:  position{line: 28, col: 26, offset: 574},
													name: "Modifier",
												},
											},
											&ruleRefExpr{
												pos:  position{line: 28, col: 36, offset: 584},
												name: "_",
											},
											&ruleRefExpr{
												pos:  position{line: 28, col: 38, offset: 586},
												name: "Value",
											},
											&zeroOrMoreExpr{
												pos: position{line: 28, col: 44, offset: 592},
												expr: &seqExpr{
													pos: position{line: 28, col: 45, offset: 593},
													exprs: []interface{}{
														&litMatcher{
															pos:        position{line: 28, col: 45, offset: 593},
															val:        ",",
															ignoreCase: false,
														},
														&ruleRefExpr{
															pos:  position{line: 28, col: 49, offset: 597},
															name: "_",
														},
														&ruleRefExpr{
															pos:  position{line: 28, col: 51, offset: 599},
															name: "ArrayValue",
														},
														&andExpr{
															pos: position{line: 28, col: 62, offset: 610},
															expr: &choiceExpr{
																pos: position{line: 28, col: 64, offset: 612},
																alternatives: []interface{}{
																	&charClassMatcher{
																		pos:        position{line: 28, col: 64, offset: 612},
																		val:        "[^:]",
																		chars:      []rune{':'},
																		ignoreCase: false,
																		inverted:   true,
																	},
																	&notExpr{
																		pos: position{line: 28, col: 71, offset: 619},
																		expr: &anyMatcher{
																			line: 28, col: 72, offset: 620,
																		},
																	},
																},
															},
														},
													},
												},
											},
										},
									},
									&seqExpr{
										pos: position{line: 28, col: 81, offset: 629},
										exprs: []interface{}{
											&litMatcher{
												pos:        position{line: 28, col: 81, offset: 629},
												val:        "{",
												ignoreCase: false,
											},
											&ruleRefExpr{
												pos:  position{line: 28, col: 85, offset: 633},
												name: "Object",
											},
											&litMatcher{
												pos:        position{line: 28, col: 92, offset: 640},
												val:        "}",
												ignoreCase: false,
											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		{
			name: "Key",
			pos:  position{line: 77, col: 1, offset: 1607},
			expr: &actionExpr{
				pos: position{line: 77, col: 7, offset: 1615},
				run: (*parser).callonKey1,
				expr: &labeledExpr{
					pos:   position{line: 77, col: 7, offset: 1615},
					label: "parts",
					expr: &seqExpr{
						pos: position{line: 77, col: 14, offset: 1622},
						exprs: []interface{}{
							&zeroOrOneExpr{
								pos: position{line: 77, col: 14, offset: 1622},
								expr: &litMatcher{
									pos:        position{line: 77, col: 14, offset: 1622},
									val:        ".",
									ignoreCase: false,
								},
							},
							&zeroOrMoreExpr{
								pos: position{line: 77, col: 19, offset: 1627},
								expr: &seqExpr{
									pos: position{line: 77, col: 20, offset: 1628},
									exprs: []interface{}{
										&ruleRefExpr{
											pos:  position{line: 77, col: 20, offset: 1628},
											name: "KeyPart",
										},
										&litMatcher{
											pos:        position{line: 77, col: 28, offset: 1636},
											val:        ".",
											ignoreCase: false,
										},
									},
								},
							},
							&ruleRefExpr{
								pos:  position{line: 77, col: 34, offset: 1642},
								name: "KeyPart",
							},
						},
					},
				},
			},
		},
		{
			name: "KeyPart",
			pos:  position{line: 95, col: 1, offset: 1939},
			expr: &actionExpr{
				pos: position{line: 95, col: 11, offset: 1951},
				run: (*parser).callonKeyPart1,
				expr: &seqExpr{
					pos: position{line: 95, col: 11, offset: 1951},
					exprs: []interface{}{
						&labeledExpr{
							pos:   position{line: 95, col: 11, offset: 1951},
							label: "label",
							expr: &ruleRefExpr{
								pos:  position{line: 95, col: 17, offset: 1957},
								name: "KeyName",
							},
						},
						&labeledExpr{
							pos:   position{line: 95, col: 25, offset: 1965},
							label: "index",
							expr: &zeroOrMoreExpr{
								pos: position{line: 95, col: 31, offset: 1971},
								expr: &seqExpr{
									pos: position{line: 95, col: 32, offset: 1972},
									exprs: []interface{}{
										&litMatcher{
											pos:        position{line: 95, col: 32, offset: 1972},
											val:        "[",
											ignoreCase: false,
										},
										&zeroOrOneExpr{
											pos: position{line: 95, col: 36, offset: 1976},
											expr: &ruleRefExpr{
												pos:  position{line: 95, col: 36, offset: 1976},
												name: "Int",
											},
										},
										&litMatcher{
											pos:        position{line: 95, col: 41, offset: 1981},
											val:        "]",
											ignoreCase: false,
										},
									},
								},
							},
						},
					},
				},
			},
		},
		{
			name: "KeyName",
			pos:  position{line: 113, col: 1, offset: 2251},
			expr: &actionExpr{
				pos: position{line: 113, col: 11, offset: 2263},
				run: (*parser).callonKeyName1,
				expr: &zeroOrMoreExpr{
					pos: position{line: 113, col: 11, offset: 2263},
					expr: &charClassMatcher{
						pos:        position{line: 113, col: 11, offset: 2263},
						val:        "[^.:[{]",
						chars:      []rune{'.', ':', '[', '{'},
						ignoreCase: false,
						inverted:   true,
					},
				},
			},
		},
		{
			name: "Modifier",
			pos:  position{line: 117, col: 1, offset: 2325},
			expr: &actionExpr{
				pos: position{line: 117, col: 12, offset: 2338},
				run: (*parser).callonModifier1,
				expr: &charClassMatcher{
					pos:        position{line: 117, col: 12, offset: 2338},
					val:        "[~]",
					chars:      []rune{'~'},
					ignoreCase: false,
					inverted:   false,
				},
			},
		},
		{
			name: "ArrayValue",
			pos:  position{line: 126, col: 1, offset: 2487},
			expr: &choiceExpr{
				pos: position{line: 126, col: 14, offset: 2502},
				alternatives: []interface{}{
					&ruleRefExpr{
						pos:  position{line: 126, col: 14, offset: 2502},
						name: "Null",
					},
					&ruleRefExpr{
						pos:  position{line: 126, col: 21, offset: 2509},
						name: "Bool",
					},
					&ruleRefExpr{
						pos:  position{line: 126, col: 28, offset: 2516},
						name: "Float",
					},
					&ruleRefExpr{
						pos:  position{line: 126, col: 36, offset: 2524},
						name: "Int",
					},
					&ruleRefExpr{
						pos:  position{line: 126, col: 42, offset: 2530},
						name: "ArrayString",
					},
				},
			},
		},
		{
			name: "ArrayString",
			pos:  position{line: 128, col: 1, offset: 2543},
			expr: &actionExpr{
				pos: position{line: 128, col: 15, offset: 2559},
				run: (*parser).callonArrayString1,
				expr: &seqExpr{
					pos: position{line: 128, col: 15, offset: 2559},
					exprs: []interface{}{
						&ruleRefExpr{
							pos:  position{line: 128, col: 15, offset: 2559},
							name: "_",
						},
						&charClassMatcher{
							pos:        position{line: 128, col: 17, offset: 2561},
							val:        "[^[]",
							chars:      []rune{'['},
							ignoreCase: false,
							inverted:   true,
						},
						&zeroOrMoreExpr{
							pos: position{line: 128, col: 22, offset: 2566},
							expr: &charClassMatcher{
								pos:        position{line: 128, col: 22, offset: 2566},
								val:        "[^,:}]",
								chars:      []rune{',', ':', '}'},
								ignoreCase: false,
								inverted:   true,
							},
						},
					},
				},
			},
		},
		{
			name: "Value",
			pos:  position{line: 132, col: 1, offset: 2627},
			expr: &choiceExpr{
				pos: position{line: 132, col: 9, offset: 2637},
				alternatives: []interface{}{
					&ruleRefExpr{
						pos:  position{line: 132, col: 9, offset: 2637},
						name: "Null",
					},
					&ruleRefExpr{
						pos:  position{line: 132, col: 16, offset: 2644},
						name: "Bool",
					},
					&ruleRefExpr{
						pos:  position{line: 132, col: 23, offset: 2651},
						name: "Float",
					},
					&ruleRefExpr{
						pos:  position{line: 132, col: 31, offset: 2659},
						name: "Int",
					},
					&ruleRefExpr{
						pos:  position{line: 132, col: 37, offset: 2665},
						name: "String",
					},
				},
			},
		},
		{
			name: "ValueEnd",
			pos:  position{line: 134, col: 1, offset: 2673},
			expr: &choiceExpr{
				pos: position{line: 134, col: 12, offset: 2686},
				alternatives: []interface{}{
					&seqExpr{
						pos: position{line: 134, col: 12, offset: 2686},
						exprs: []interface{}{
							&ruleRefExpr{
								pos:  position{line: 134, col: 12, offset: 2686},
								name: "_",
							},
							&charClassMatcher{
								pos:        position{line: 134, col: 14, offset: 2688},
								val:        "[,}\\]]",
								chars:      []rune{',', '}', ']'},
								ignoreCase: false,
								inverted:   false,
							},
						},
					},
					&ruleRefExpr{
						pos:  position{line: 134, col: 23, offset: 2697},
						name: "EOF",
					},
				},
			},
		},
		{
			name: "Null",
			pos:  position{line: 136, col: 1, offset: 2702},
			expr: &actionExpr{
				pos: position{line: 136, col: 8, offset: 2711},
				run: (*parser).callonNull1,
				expr: &litMatcher{
					pos:        position{line: 136, col: 8, offset: 2711},
					val:        "null",
					ignoreCase: false,
				},
			},
		},
		{
			name: "Bool",
			pos:  position{line: 138, col: 1, offset: 2739},
			expr: &choiceExpr{
				pos: position{line: 138, col: 8, offset: 2748},
				alternatives: []interface{}{
					&actionExpr{
						pos: position{line: 138, col: 8, offset: 2748},
						run: (*parser).callonBool2,
						expr: &litMatcher{
							pos:        position{line: 138, col: 8, offset: 2748},
							val:        "true",
							ignoreCase: false,
						},
					},
					&actionExpr{
						pos: position{line: 138, col: 38, offset: 2778},
						run: (*parser).callonBool4,
						expr: &litMatcher{
							pos:        position{line: 138, col: 38, offset: 2778},
							val:        "false",
							ignoreCase: false,
						},
					},
				},
			},
		},
		{
			name: "Float",
			pos:  position{line: 140, col: 1, offset: 2809},
			expr: &actionExpr{
				pos: position{line: 140, col: 9, offset: 2819},
				run: (*parser).callonFloat1,
				expr: &seqExpr{
					pos: position{line: 140, col: 9, offset: 2819},
					exprs: []interface{}{
						&oneOrMoreExpr{
							pos: position{line: 140, col: 9, offset: 2819},
							expr: &charClassMatcher{
								pos:        position{line: 140, col: 9, offset: 2819},
								val:        "[0-9]",
								ranges:     []rune{'0', '9'},
								ignoreCase: false,
								inverted:   false,
							},
						},
						&litMatcher{
							pos:        position{line: 140, col: 16, offset: 2826},
							val:        ".",
							ignoreCase: false,
						},
						&oneOrMoreExpr{
							pos: position{line: 140, col: 20, offset: 2830},
							expr: &charClassMatcher{
								pos:        position{line: 140, col: 20, offset: 2830},
								val:        "[0-9]",
								ranges:     []rune{'0', '9'},
								ignoreCase: false,
								inverted:   false,
							},
						},
						&andExpr{
							pos: position{line: 140, col: 27, offset: 2837},
							expr: &ruleRefExpr{
								pos:  position{line: 140, col: 28, offset: 2838},
								name: "ValueEnd",
							},
						},
					},
				},
			},
		},
		{
			name: "Int",
			pos:  position{line: 144, col: 1, offset: 2900},
			expr: &actionExpr{
				pos: position{line: 144, col: 7, offset: 2908},
				run: (*parser).callonInt1,
				expr: &seqExpr{
					pos: position{line: 144, col: 7, offset: 2908},
					exprs: []interface{}{
						&oneOrMoreExpr{
							pos: position{line: 144, col: 7, offset: 2908},
							expr: &charClassMatcher{
								pos:        position{line: 144, col: 7, offset: 2908},
								val:        "[0-9]",
								ranges:     []rune{'0', '9'},
								ignoreCase: false,
								inverted:   false,
							},
						},
						&andExpr{
							pos: position{line: 144, col: 14, offset: 2915},
							expr: &ruleRefExpr{
								pos:  position{line: 144, col: 15, offset: 2916},
								name: "ValueEnd",
							},
						},
					},
				},
			},
		},
		{
			name: "String",
			pos:  position{line: 148, col: 1, offset: 2968},
			expr: &actionExpr{
				pos: position{line: 148, col: 10, offset: 2979},
				run: (*parser).callonString1,
				expr: &zeroOrMoreExpr{
					pos: position{line: 148, col: 10, offset: 2979},
					expr: &charClassMatcher{
						pos:        position{line: 148, col: 10, offset: 2979},
						val:        "[^,}]",
						chars:      []rune{',', '}'},
						ignoreCase: false,
						inverted:   true,
					},
				},
			},
		},
		{
			name:        "_",
			displayName: "\"whitespace\"",
			pos:         position{line: 152, col: 1, offset: 3039},
			expr: &zeroOrMoreExpr{
				pos: position{line: 152, col: 18, offset: 3058},
				expr: &charClassMatcher{
					pos:        position{line: 152, col: 18, offset: 3058},
					val:        "[ \\t\\r\\n]",
					chars:      []rune{' ', '\t', '\r', '\n'},
					ignoreCase: false,
					inverted:   false,
				},
			},
		},
		{
			name: "EOF",
			pos:  position{line: 154, col: 1, offset: 3070},
			expr: &notExpr{
				pos: position{line: 154, col: 7, offset: 3078},
				expr: &anyMatcher{
					line: 154, col: 8, offset: 3079,
				},
			},
		},
	},
}
func (c *current) onShortHand1(val interface{}) (interface{}, error) {
	return val, nil
}
func (p *parser) callonShortHand1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onShortHand1(stack["val"])
}
func (c *current) onObject1(vals interface{}) (interface{}, error) {
	ast := AST{}
	valsSl := toIfaceSlice(vals)
	ast = append(ast, valsSl[0].(*KeyValue))
	rest := toIfaceSlice(valsSl[1])
	for _, item := range rest {
		itemSl := toIfaceSlice(item)
		ast = append(ast, itemSl[2].(*KeyValue))
	}
	return ast, nil
}
func (p *parser) callonObject1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onObject1(stack["vals"])
}
func (c *current) onKeyValue1(k, v interface{}) (interface{}, error) {
	vSl := toIfaceSlice(v)
	var value interface{}
	modifier := modifierNone
	if vSl[0].([]byte)[0] == ':' {
		if vSl[1] != nil {
			modifier = vSl[1].(int)
		}
		value = vSl[3]
		if modifier == modifierString {
			if value == nil {
				value = "null"
			} else {
				value = fmt.Sprintf("%v", value)
			}
		}
		extra := toIfaceSlice(vSl[4])
		if len(extra) > 0 {
			values := &list{value}
			repeatedWithIndex(extra, 2, func(v interface{}) {
				if modifier == modifierString {
					v = fmt.Sprintf("%v", v)
				}
				values.Append(v)
			})
			value = values
		} else {
			if modifier == modifierString {
				if value == nil {
					value = "null"
				} else {
					value = fmt.Sprintf("%v", value)
				}
			}
		}
	} else {
		value = vSl[1]
	}
	return &KeyValue{
		PostProcess: modifier == modifierNone,
		Key:         k.(*Key),
		Value:       value,
	}, nil
}
func (p *parser) callonKeyValue1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onKeyValue1(stack["k"], stack["v"])
}
func (c *current) onKey1(parts interface{}) (interface{}, error) {
	var kps []*KeyPart
	pSl := toIfaceSlice(parts)
	for _, sub := range toIfaceSlice(pSl[1]) {
		kps = append(kps, toIfaceSlice(sub)[0].(*KeyPart))
	}
	kps = append(kps, pSl[2].(*KeyPart))
	key := &Key{
		ResetContext: pSl[0] == nil,
		Parts:        kps,
	}
	return key, nil
}
func (p *parser) callonKey1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onKey1(stack["parts"])
}
func (c *current) onKeyPart1(label, index interface{}) (interface{}, error) {
	idx := make([]int, 0)
	repeatedWithIndex(index, 1, func(v interface{}) {
		if v == nil {
			idx = append(idx, -1)
			return
		}
		idx = append(idx, v.(int))
	})
	kp := &KeyPart{
		Key:   label.(string),
		Index: idx,
	}
	return kp, nil
}
func (p *parser) callonKeyPart1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onKeyPart1(stack["label"], stack["index"])
}
func (c *current) onKeyName1() (interface{}, error) {
	return strings.TrimSpace(string(c.text)), nil
}
func (p *parser) callonKeyName1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onKeyName1()
}
func (c *current) onModifier1() (interface{}, error) {
	switch c.text[0] {
	case '~':
		return modifierString, nil
	default:
		return nil, fmt.Errorf("Unknown modifier %v", c.text[0])
	}
}
func (p *parser) callonModifier1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onModifier1()
}
func (c *current) onArrayString1() (interface{}, error) {
	return strings.TrimSpace(string(c.text)), nil
}
func (p *parser) callonArrayString1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onArrayString1()
}
func (c *current) onNull1() (interface{}, error) {
	return nil, nil
}
func (p *parser) callonNull1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onNull1()
}
func (c *current) onBool2() (interface{}, error) {
	return true, nil
}
func (p *parser) callonBool2() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onBool2()
}
func (c *current) onBool4() (interface{}, error) {
	return false, nil
}
func (p *parser) callonBool4() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onBool4()
}
func (c *current) onFloat1() (interface{}, error) {
	return strconv.ParseFloat(string(c.text), 64)
}
func (p *parser) callonFloat1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onFloat1()
}
func (c *current) onInt1() (interface{}, error) {
	return strconv.Atoi(string(c.text))
}
func (p *parser) callonInt1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onInt1()
}
func (c *current) onString1() (interface{}, error) {
	return strings.TrimSpace(string(c.text)), nil
}
func (p *parser) callonString1() (interface{}, error) {
	stack := p.vstack[len(p.vstack)-1]
	_ = stack
	return p.cur.onString1()
}
var (
	errNoRule = errors.New("grammar has no rule")
	errInvalidEntrypoint = errors.New("invalid entrypoint")
	errInvalidEncoding = errors.New("invalid encoding")
	errMaxExprCnt = errors.New("max number of expresssions parsed")
)
type Option func(*parser) Option
func MaxExpressions(maxExprCnt uint64) Option {
	return func(p *parser) Option {
		oldMaxExprCnt := p.maxExprCnt
		p.maxExprCnt = maxExprCnt
		return MaxExpressions(oldMaxExprCnt)
	}
}
func Entrypoint(ruleName string) Option {
	return func(p *parser) Option {
		oldEntrypoint := p.entrypoint
		p.entrypoint = ruleName
		if ruleName == "" {
			p.entrypoint = g.rules[0].name
		}
		return Entrypoint(oldEntrypoint)
	}
}
func Statistics(stats *Stats, choiceNoMatch string) Option {
	return func(p *parser) Option {
		oldStats := p.Stats
		p.Stats = stats
		oldChoiceNoMatch := p.choiceNoMatch
		p.choiceNoMatch = choiceNoMatch
		if p.Stats.ChoiceAltCnt == nil {
			p.Stats.ChoiceAltCnt = make(map[string]map[string]int)
		}
		return Statistics(oldStats, oldChoiceNoMatch)
	}
}
func Debug(b bool) Option {
	return func(p *parser) Option {
		old := p.debug
		p.debug = b
		return Debug(old)
	}
}