Exemple #1
0
// errorf stops the evaluator. Its panic is supposed to be caught by recover.
func (ev *Evaluator) errorf(format string, args ...interface{}) {
	if n := len(ev.nodes); n > 0 {
		ev.errorfNode(ev.nodes[n-1], format, args...)
	} else {
		util.Panic(fmt.Errorf(format, args...))
	}
}
Exemple #2
0
// errorf formats the error and terminates processing.
func (p *Parser) errorf(pos int, format string, args ...interface{}) {
	p.Root = nil
	util.Panic(util.NewContextualError(p.Name, p.text, pos, format, args...))
}
Exemple #3
0
func (cp *Compiler) errorf(n parse.Node, format string, args ...interface{}) {
	util.Panic(util.NewContextualError(cp.name, cp.text, int(n.Position()), format, args...))
}
Exemple #4
0
func (ev *Evaluator) errorfNode(n parse.Node, format string, args ...interface{}) {
	util.Panic(util.NewContextualError(ev.name, ev.text, int(n.Position()), format, args...))
}
Exemple #5
0
func (rd *Reader) badEscSeq(msg string) {
	util.Panic(newBadEscSeq(rd.currentSeq, msg))
}