Revision: 153
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=153&view=rev
Author: matthiasmiller
Date: 2008-03-01 19:30:04 -0800 (Sat, 01 Mar 2008)
Log Message:
-----------
show tok.TOKENNAME when printing tokens
Modified Paths:
--------------
trunk/pyjsl/parse.py
Modified: trunk/pyjsl/parse.py
===================================================================
--- trunk/pyjsl/parse.py 2008-03-01 19:05:07 UTC (rev 152)
+++ trunk/pyjsl/parse.py 2008-03-02 03:30:04 UTC (rev 153)
@@ -7,6 +7,11 @@
import pyspidermonkey
from pyspidermonkey import tok, op
+_tok_names = dict(zip(
+ [getattr(tok, prop) for prop in dir(tok)],
+ ['tok.%s' % prop for prop in dir(tok)]
+))
+
class NodePos():
def __init__(self, line, col):
self.line = line
@@ -118,7 +123,7 @@
kind = self.kind
if not kind:
kind = '(none)'
- return '%s>%s' % (kind, str(self.kids))
+ return '%s>%s' % (_tok_names[kind], str(self.kids))
def is_equivalent(self, other, are_functions_equiv=False):
if not other:
@@ -242,7 +247,7 @@
if node is None:
print '(none)'
else:
- print node.kind, '\t', node.args
+ print _tok_names[node.kind], '\t', node.args
for node in node.kids:
_dump_node(node, depth+1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|