antlr-ng
Version:
Next generation ANTLR Tool
40 lines (39 loc) • 1.03 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
class ToolListener {
constructor(errorManager) {
this.errorManager = errorManager;
}
static {
__name(this, "ToolListener");
}
info(msg) {
if (this.errorManager.formatWantsSingleLineMessage()) {
msg = msg.replaceAll("\n", " ");
}
console.log(msg);
}
error(msg) {
const msgST = this.errorManager.getMessageTemplate(msg);
if (msgST) {
let outputMsg = msgST.render();
if (this.errorManager.formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
console.log(outputMsg);
}
}
warning(msg) {
const msgST = this.errorManager.getMessageTemplate(msg);
if (msgST) {
let outputMsg = msgST.render();
if (this.errorManager.formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
console.log(outputMsg);
}
}
}
export {
ToolListener
};