Skip to content

Commit 42c459a

Browse files
committed
#138 - fix property name & add offsets
1 parent 5798739 commit 42c459a

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

dist/php-parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4766,7 +4766,7 @@ parser.prototype.parse = function (code, filename) {
47664766
}
47674767
}
47684768
}
4769-
return program(childs, this._errors, this._docs, this._tokens);
4769+
return program(childs, this._errors, this._docs, null, this._tokens);
47704770
};
47714771

47724772
/**
@@ -4938,7 +4938,9 @@ parser.prototype.lex = function () {
49384938
if (this.extractTokens && this.token !== this.EOF) {
49394939
var entry = this.lexer.yytext;
49404940
if (this.lexer.engine.tokens.values.hasOwnProperty(this.token)) {
4941-
entry = [this.lexer.engine.tokens.values[this.token], entry, this.lexer.yylloc.first_line];
4941+
entry = [this.lexer.engine.tokens.values[this.token], entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset];
4942+
} else {
4943+
entry = [null, entry, this.lexer.yylloc.first_line, this.lexer.yylloc.first_offset];
49424944
}
49434945
this._tokens.push(entry);
49444946
}

dist/php-parser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/php-parser.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parser.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ parser.prototype.parse = function(code, filename) {
277277
}
278278
}
279279
}
280-
return program(childs, this._errors, this._docs, this._tokens);
280+
return program(childs, this._errors, this._docs, null, this._tokens);
281281
};
282282

283283
/**
@@ -478,7 +478,15 @@ parser.prototype.lex = function() {
478478
entry = [
479479
this.lexer.engine.tokens.values[this.token],
480480
entry,
481-
this.lexer.yylloc.first_line
481+
this.lexer.yylloc.first_line,
482+
this.lexer.yylloc.first_offset
483+
];
484+
} else {
485+
entry = [
486+
null,
487+
entry,
488+
this.lexer.yylloc.first_line,
489+
this.lexer.yylloc.first_offset
482490
];
483491
}
484492
this._tokens.push(entry);

0 commit comments

Comments
 (0)