1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1 1 479 479 1 57305 182442 9568 9568 172874 1 1971 1971 1347 624 | module.exports = Position; function Position() { this.line = 1; this.column = 0; } Position.prototype.push = function (str) { for (var i = 0; i < str.length; i++) { if (str[i] === "\n") { this.line++; this.column = 0; } else { this.column++; } } }; Position.prototype.unshift = function (str) { for (var i = 0; i < str.length; i++) { if (str[i] === "\n") { this.line--; } else { this.column--; } } }; |