niklasvh / php.js

PHP to JavaScript converter and VM written in JavaScript
http://phpjs.hertzen.com
MIT License
860 stars 115 forks source link

Add extra info into PHP.Parser #64

Closed maxvyaznikov closed 9 years ago

maxvyaznikov commented 9 years ago

Now after var AST = new PHP.Parser(PHP.Lexer(code)); we can see array of objects with description of line it is:

attributes: {
  startLine: 4
  endLine: 4
}

But what if code is dirty and there are multiple things in one line (if (a > b) { return a; } else { return b; }, for example)? Where is information about position into line?

may be you can help me to add it by myself?

As I can see, I should start from PHP.Lexer