1 |
|
2 |
|
3 |
|
4 |
|
5 | "use strict";
|
6 |
|
7 | exports.__esModule = true;
|
8 |
|
9 |
|
10 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11 |
|
12 | var Position = (function () {
|
13 | function Position() {
|
14 | _classCallCheck(this, Position);
|
15 |
|
16 | this.line = 1;
|
17 | this.column = 0;
|
18 | }
|
19 |
|
20 | |
21 |
|
22 |
|
23 |
|
24 | Position.prototype.push = function push(str) {
|
25 | for (var i = 0; i < str.length; i++) {
|
26 | if (str[i] === "\n") {
|
27 | this.line++;
|
28 | this.column = 0;
|
29 | } else {
|
30 | this.column++;
|
31 | }
|
32 | }
|
33 | };
|
34 |
|
35 | |
36 |
|
37 |
|
38 |
|
39 | Position.prototype.unshift = function unshift(str) {
|
40 | for (var i = 0; i < str.length; i++) {
|
41 | if (str[i] === "\n") {
|
42 | this.line--;
|
43 | } else {
|
44 | this.column--;
|
45 | }
|
46 | }
|
47 | };
|
48 |
|
49 | return Position;
|
50 | })();
|
51 |
|
52 | exports["default"] = Position;
|
53 | module.exports = exports["default"]; |
\ | No newline at end of file |