func NewZeroOrMoreExpr(p Pos) *ZeroOrMoreExpr {
	return &ZeroOrMoreExpr{p: p}
}
NewZeroOrMoreExpr creates a new zero or more expression at the specified
position.
package ast
import (
	"bytes"
	"fmt"
	"strconv"
	"strings"
)
type Pos struct {
	Filename string
	Line     int
	Col      int
	Off      int
}
func (p Pos) String() string {
	if p.Filename != "" {
		return fmt.Sprintf("%s:%d:%d (%d)", p.Filename, p.Line, p.Col, p.Off)
	}
	return fmt.Sprintf("%d:%d (%d)", p.Line, p.Col, p.Off)
}
type Grammar struct {
	p     Pos
	Init  *CodeBlock
	Rules []*Rule
}
func NewGrammar(p Pos) *Grammar {
	return &Grammar{p: p}
}
func (g *Grammar) Pos() Pos { return g.p }
func (g *Grammar) String() string {
	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%s: %T{Init: %v, Rules: [\n",
		g.p, g, g.Init))
	for _, r := range g.Rules {
		buf.WriteString(fmt.Sprintf("%s,\n", r))
	}
	buf.WriteString("]}")
	return buf.String()
}
type Rule struct {
	p           Pos
	Name        *Identifier
	DisplayName *StringLit
	Expr        Expression
}
func NewRule(p Pos, name *Identifier) *Rule {
	return &Rule{p: p, Name: name}
}
func (r *Rule) Pos() Pos { return r.p }
func (r *Rule) String() string {
	return fmt.Sprintf("%s: %T{Name: %v, DisplayName: %v, Expr: %v}",
		r.p, r, r.Name, r.DisplayName, r.Expr)
}
type Expression interface {
	Pos() Pos
}
type ChoiceExpr struct {
	p            Pos
	Alternatives []Expression
}
func NewChoiceExpr(p Pos) *ChoiceExpr {
	return &ChoiceExpr{p: p}
}
func (c *ChoiceExpr) Pos() Pos { return c.p }
func (c *ChoiceExpr) String() string {
	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%s: %T{Alternatives: [\n", c.p, c))
	for _, e := range c.Alternatives {
		buf.WriteString(fmt.Sprintf("%s,\n", e))
	}
	buf.WriteString("]}")
	return buf.String()
}
type FailureLabel string
type RecoveryExpr struct {
	p           Pos
	Expr        Expression
	RecoverExpr Expression
	Labels      []FailureLabel
}
func NewRecoveryExpr(p Pos) *RecoveryExpr {
	return &RecoveryExpr{p: p}
}
func (r *RecoveryExpr) Pos() Pos { return r.p }
func (r *RecoveryExpr) String() string {
	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%s: %T{Expr: %v, RecoverExpr: %v", r.p, r, r.Expr, r.RecoverExpr))
	buf.WriteString(fmt.Sprintf(", Labels: [\n"))
	for _, e := range r.Labels {
		buf.WriteString(fmt.Sprintf("%s,\n", e))
	}
	buf.WriteString("]}")
	return buf.String()
}
type ActionExpr struct {
	p      Pos
	Expr   Expression
	Code   *CodeBlock
	FuncIx int
}
func NewActionExpr(p Pos) *ActionExpr {
	return &ActionExpr{p: p}
}
func (a *ActionExpr) Pos() Pos { return a.p }
func (a *ActionExpr) String() string {
	return fmt.Sprintf("%s: %T{Expr: %v, Code: %v}", a.p, a, a.Expr, a.Code)
}
type ThrowExpr struct {
	p     Pos
	Label string
}
func NewThrowExpr(p Pos) *ThrowExpr {
	return &ThrowExpr{p: p}
}
func (t *ThrowExpr) Pos() Pos { return t.p }
func (t *ThrowExpr) String() string {
	return fmt.Sprintf("%s: %T{Label: %v}", t.p, t, t.Label)
}
type SeqExpr struct {
	p     Pos
	Exprs []Expression
}
func NewSeqExpr(p Pos) *SeqExpr {
	return &SeqExpr{p: p}
}
func (s *SeqExpr) Pos() Pos { return s.p }
func (s *SeqExpr) String() string {
	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%s: %T{Exprs: [\n", s.p, s))
	for _, e := range s.Exprs {
		buf.WriteString(fmt.Sprintf("%s,\n", e))
	}
	buf.WriteString("]}")
	return buf.String()
}
type LabeledExpr struct {
	p     Pos
	Label *Identifier
	Expr  Expression
}
func NewLabeledExpr(p Pos) *LabeledExpr {
	return &LabeledExpr{p: p}
}
func (l *LabeledExpr) Pos() Pos { return l.p }
func (l *LabeledExpr) String() string {
	return fmt.Sprintf("%s: %T{Label: %v, Expr: %v}", l.p, l, l.Label, l.Expr)
}
type AndExpr struct {
	p    Pos
	Expr Expression
}
func NewAndExpr(p Pos) *AndExpr {
	return &AndExpr{p: p}
}
func (a *AndExpr) Pos() Pos { return a.p }
func (a *AndExpr) String() string {
	return fmt.Sprintf("%s: %T{Expr: %v}", a.p, a, a.Expr)
}
type NotExpr struct {
	p    Pos
	Expr Expression
}
func NewNotExpr(p Pos) *NotExpr {
	return &NotExpr{p: p}
}
func (n *NotExpr) Pos() Pos { return n.p }
func (n *NotExpr) String() string {
	return fmt.Sprintf("%s: %T{Expr: %v}", n.p, n, n.Expr)
}
type ZeroOrOneExpr struct {
	p    Pos
	Expr Expression
}
func NewZeroOrOneExpr(p Pos) *ZeroOrOneExpr {
	return &ZeroOrOneExpr{p: p}
}
func (z *ZeroOrOneExpr) Pos() Pos { return z.p }
func (z *ZeroOrOneExpr) String() string {
	return fmt.Sprintf("%s: %T{Expr: %v}", z.p, z, z.Expr)
}
type ZeroOrMoreExpr struct {
	p    Pos
	Expr Expression
}