With the debug flag, d
, the trace object is available for inspection.
We will see in other examples how to configure and display the trace information.
For now, we just demonstrate that the trace object can be made available with the d
flag.
flags = 'd';
exp = new ApgExp(grammar, flags);
console.log();
console.log(" : When the 'd' flag is set, the exp.trace object is available for use.");
console.log(` flags: '${exp.flags}'`);
console.log(`exp.trace: ${exp.trace}`);
flags = '';
exp = new ApgExp(grammar, flags);
console.log();
console.log(" : When the 'd' flag is not set, the exp.trace object is null.");
console.log(` flags: '${exp.flags}'`);
console.log(`exp.trace: ${exp.trace}`);
} catch (e) {
console.log(`EXCEPTION: ${e.message}`);
}
})();