Unused functions in generated source
ralekna opened this issue · 2 comments
ralekna commented
Hi,
it seems that this generator adds some unused functions to parser source and my TS compiler is shouting on me.
function location(): IFileRange {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description: string, location1?: IFileRange) {
location1 = location1 !== undefined
? location1
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location1
);
}
function error(message: string, location1?: IFileRange) {
location1 = location1 !== undefined
? location1
: peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location1);
}
function peg$anyExpectation(): IAnyExpectation {
return { type: "any" };
}
ralekna commented
I removed those functions from code and it didn't have any bad effect.
pjmolina commented
It is up to you (opt-in) to use this functions or not when consuming the generated parser.
For some grammars they are pretty useful. We cannot remove them.
As a work-around you can configure that ts-lint to avoid marking this as an error.