On Sat, Aug 13, 2011 at 12:50 AM, johnjbarton
> Hi. I need to track the positions of (at least) functions in the... and a toString() method, which means ast == "defun" will work both if
> Currently uglify has the embed_tokens option which replaces the syntax
ast is a NodeWithToken or a string. But this is an ugly hack, of
course. UglifyJS AST processors used to work with embed_tokens, but I'm not
sure this is the case anymore (using „switch” in some places, and that
involves strict equality).
> On my fork I made a small change to move the NodeWithToken from astDoes this mean that you turned all nodes into objects instead of arrays?
> to ast.loc. That way my parse tree analysis code written with
> embed_tokens off works with embed_tokens true.
Seems like a comprehensive change...
> Of course my test is very minimal. Does any one know whether thisI can't be sure about how safe your change is. But indeed, it would be
> should work or if not what problems it may cause? Or is there a way
> to achieve this goal without changing the parser source? (I guess I
> would parse with embed_tokens true and walk the tree to convert from
> inline to .loc versions.)
rather trivial to write an AST processor that walks the tree and returns
object nodes instead of arrays. I'd do this rather than modifying the
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.