Skip to content

Conversation

@thejh
Copy link
Contributor

@thejh thejh commented Dec 20, 2011

See #241 - this at least sticks tokens on every single AST node in https://github.com/thejh/node-astjourney/blob/c8b5c7eb6d498100a5eaeba452ce245b2b5fa7fb/index.js (test at https://github.com/thejh/node-astjourney/blob/c8b5c7eb6d498100a5eaeba452ce245b2b5fa7fb/test/token-locations.js#L23-35 ).

Note that I didn't verify whether all the tokens are the right ones.

@thejh
Copy link
Contributor Author

thejh commented Dec 20, 2011

Hmm, actually, looks like some of the token data is messed up. :(

> ast.statements[1].stat.rvalue
{ parent: null,
  type: 'num',
  scope: null,
  children: [Getter],
  rawNode: 
   [ { name: 'num',
       start: [Object],
       end: [Object] },
     4 ],
  position: 
   { startToken: 
      { type: 'num',
        value: 4,
        line: 1,
        col: 2,
        pos: 6,
        endpos: 7,
        nlb: false,
        comments_before: [] },
     endToken: 
      { type: 'operator',
        value: '+',
        line: 1,
        col: 1,
        pos: 5,
        endpos: 6,
        nlb: false,
        comments_before: [] } },
  value: 4 }

@thejh
Copy link
Contributor Author

thejh commented Jan 22, 2012

It works now. Example (it was highlighted by itself): http://thejh.github.com/boxednodes.html
@mishoo Are you going to merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant