// MustParseStatement returns exactly one statement.
// If an error occurs during parsing, panic.
344818
func MustParseStatement(input string) Statement {
	parsed, err := ParseStatement(input)
	if err != nil {
		panic(err)
	}
	return parsed
}
223513
func MustParse(command string, err error) string {
	if err != nil {
		Fatalf("%s, try --help", err)
	}
	return command
}
992302
func mustReadFull(r io.Reader, b []byte) (int, error) {
	n, err := tryReadFull(r, b)
	if err == io.EOF {
		err = io.ErrUnexpectedEOF
	}
	return n, err
}
824377
func (p *Parser) parseExplainStatement() (*ExplainStatement, error) {
	stmt := &ExplainStatement{}

	if tok, _, _ := p.ScanIgnoreWhitespace(); tok == ANALYZE {
		stmt.Analyze = true
	} else {
		p.Unscan()
	}

	if tok, pos, lit := p.ScanIgnoreWhitespace(); tok != SELECT {
		return nil, newParseError(tokstr(tok, lit), []string{"SELECT"}, pos)
	}

	s, err := p.parseSelectStatement(targetNotRequired)
	if err != nil {
		return nil, err
	}
	stmt.Statement = s
	return stmt, nil
}
713786
func MustParseInt(s string, base, bitSize int) int64 {
	// nolint: gosec
	i, _ := strconv.ParseInt(s, base, bitSize)
	return i
}
73916
func (p *parser) parseStatement() ast.Node {
	var result ast.Node

	tok := p.next()

	switch tok.Kind {
	case lexer.TokenOpen, lexer.TokenOpenUnescaped:
		// mustache
		result = p.parseMustache()
	case lexer.TokenOpenBlock:
		// block
		result = p.parseBlock()
	case lexer.TokenOpenInverse:
		// block
		result = p.parseInverse()
	case lexer.TokenOpenRawBlock:
		// rawBlock
		result = p.parseRawBlock()
	case lexer.TokenOpenPartial:
		// partial
		result = p.parsePartial()
	case lexer.TokenContent:
		// content
		result = p.parseContent()
	case lexer.TokenComment:
		// COMMENT
		result = p.parseComment()
	}

	return result
}
972625
func MustParseCIDR(str string) *CIDR {
	c, err := ParseCIDR(str)
	if err != nil {
		panic(fmt.Sprintf("Unable to parse CIDR '%s': %s", str, err))
	}
	return c
}
194110
func MustParseExpression(in string) threshold.Predicate {
	e, err := ParseExpression(in)
	if err != nil {
		panic(err)
	}
	return e
}
228438
func ParseStatements(filename, input string) ([]Statement, []*Comment, error) {

	bs := []byte(input)

	parsed, err := Parse(filename, bs, GlobalStore(filenameKey, filename), CommentsOption())
	if err != nil {
		return nil, nil, formatParserErrors(filename, bs, err)
	}

	var comments []*Comment
	var sl []interface{}
	if p, ok := parsed.(program); ok {
		sl = p.buf
		commentMap := p.comments.(map[commentKey]*Comment)
		commentKeys := []commentKey{}
		for k := range commentMap {
			commentKeys = append(commentKeys, k)
		}
		sort.Slice(commentKeys, func(i, j int) bool {
			return commentKeys[i].Compare(commentKeys[j]) < 0
		})
		for _, k := range commentKeys {
			comments = append(comments, commentMap[k])
		}
	} else {
		sl = parsed.([]interface{})
	}
	stmts := make([]Statement, 0, len(sl))

	for _, x := range sl {
		if rules, ok := x.([]*Rule); ok {
			for _, rule := range rules {
				stmts = append(stmts, rule)
			}
		} else {
			// Unchecked cast should be safe. A panic indicates grammar is
			// out-of-sync.
			stmts = append(stmts, x.(Statement))
		}
	}

	return stmts, comments, postProcess(filename, stmts)
}
757992
func MustCompile(sel string) Selector {
	compiled, err := Compile(sel)
	if err != nil {
		panic(err)
	}
	return compiled
}
496267
func (p *Parser) parseGrantStatement() (Statement, error) {
	// Parse the privilege to be granted.
	priv, err := p.parsePrivilege()
	if err != nil {
		return nil, err
	}

	// Check for ON or TO clauses.
	tok, pos, lit := p.ScanIgnoreWhitespace()
	if tok == ON {
		stmt, err := p.parseGrantOnStatement()
		if err != nil {
			return nil, err
		}
		stmt.Privilege = priv
		return stmt, nil
	} else if tok == TO {
		// Admin privilege is only granted on ALL PRIVILEGES.
		if priv != AllPrivileges {
			return nil, newParseError(tokstr(tok, lit), []string{"ON"}, pos)
		}
		return p.parseGrantAdminStatement()
	}

	// Only ON or TO clauses are allowed after privilege.
	if priv == AllPrivileges {
		return nil, newParseError(tokstr(tok, lit), []string{"ON", "TO"}, pos)
	}
	return nil, newParseError(tokstr(tok, lit), []string{"ON"}, pos)
}
878658
func MustParseCIDR(s string) *CIDR {
	cidr, err := ParseCIDR(s)
	if err != nil {
		panic(err)
	}

	return cidr
}
687526
func (d multiValidator) MustValidate(s interface{}) {
	if err := d.Validate(s); err != nil {
		panic(err)
	}
}
419857
func MustParseModule(input string) *Module {
	parsed, err := ParseModule("", input)
	if err != nil {
		panic(err)
	}
	return parsed
}
1216915
func MustParseRule(input string) *Rule {
	parsed, err := ParseRule(input)
	if err != nil {
		panic(err)
	}
	return parsed
}
1122717
func MustParse(s string) time.Time {
	d, err := Parse(s)
	if err != nil {
		panic(err)
	}
	return d
}
521980
func MustParseUUID(s string) *UUID {
	u, e := ParseUUID(s)
	if e != nil {
		panic(e)
	}
	return u
}