[javascriptlint-commit] SF.net SVN: javascriptlint: [160] trunk/pyjsl/parse.py
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2008-03-03 22:53:16
|
Revision: 160
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=160&view=rev
Author: matthiasmiller
Date: 2008-03-03 14:53:12 -0800 (Mon, 03 Mar 2008)
Log Message:
-----------
change --dump to output opcodes
Modified Paths:
--------------
trunk/pyjsl/parse.py
Modified: trunk/pyjsl/parse.py
===================================================================
--- trunk/pyjsl/parse.py 2008-03-03 22:49:59 UTC (rev 159)
+++ trunk/pyjsl/parse.py 2008-03-03 22:53:12 UTC (rev 160)
@@ -11,6 +11,10 @@
[getattr(tok, prop) for prop in dir(tok)],
['tok.%s' % prop for prop in dir(tok)]
))
+_op_names = dict(zip(
+ [getattr(op, prop) for prop in dir(op)],
+ ['op.%s' % prop for prop in dir(op)]
+))
class NodePos():
def __init__(self, line, col):
@@ -223,7 +227,7 @@
if node is None:
print '(none)'
else:
- print '%s\t%s, %s' % (_tok_names[node.kind], node.start_pos(), node.end_pos())
+ print '%s, %s\tfrom %s to %s' % (_tok_names[node.kind], _op_names[node.opcode], node.start_pos(), node.end_pos())
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.
|