-// Generated by Peggy 2.0.1.
+// Generated by Peggy 3.0.2.
//
// https://peggyjs.org/
}
}
var s = this.location.start;
- var loc = this.location.source + ":" + s.line + ":" + s.column;
+ var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
+ ? this.location.source.offset(s)
+ : s;
+ var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
if (src) {
var e = this.location.end;
- var filler = peg$padEnd("", s.line.toString().length, ' ');
+ var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
var line = src[s.line - 1];
var last = s.line === e.line ? e.column : line.length + 1;
var hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
- + s.line + " | " + line + "\n"
+ + offset_s.line + " | " + line + "\n"
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
+ peg$padEnd("", hatLen, "^");
} else {
}
}
- function peg$computeLocation(startPos, endPos) {
+ function peg$computeLocation(startPos, endPos, offset) {
var startPosDetails = peg$computePosDetails(startPos);
var endPosDetails = peg$computePosDetails(endPos);
- return {
+ var res = {
source: peg$source,
start: {
offset: startPos,
column: endPosDetails.column
}
};
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
+ res.start = peg$source.offset(res.start);
+ res.end = peg$source.offset(res.end);
+ }
+ return res;
}
function peg$fail(expected) {