jison-gho
Version:
A parser generator with a Bison/YACC-similar API (derived off zaach/jison repo)
18 lines (16 loc) • 477 B
JavaScript
function parseError(str, hash, ExceptionClass) {
if (hash.recoverable) {
if (typeof this.trace === 'function') {
this.trace(str);
}
hash.destroy(); // destroy... well, *almost*!
} else {
if (typeof this.trace === 'function') {
this.trace(str);
}
if (!ExceptionClass) {
ExceptionClass = this.JisonParserError;
}
throw new ExceptionClass(str, hash);
}
}