Skip to content

Commit a823777

Browse files
committed
add simple_parser.py back... (sorry for messing things up)
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40283
1 parent be2106e commit a823777

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/simple_parser.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
import os
3+
4+
from test_parser import *
5+
6+
os.chdir(os.path.split(os.path.abspath(__file__))[0])
7+
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, "src")))
8+
import parser
9+
10+
if __name__ == "__main__":
11+
p = parser.HTMLParser()
12+
if len(sys.argv) > 1:
13+
x = sys.argv[1]
14+
if len(sys.argv) > 2:
15+
import hotshot
16+
import hotshot.stats
17+
prof = hotshot.Profile('stats.prof')
18+
prof.runcall(p.parse, x, False)
19+
prof.close()
20+
stats = hotshot.stats.load('stats.prof')
21+
stats.strip_dirs()
22+
stats.sort_stats('time')
23+
stats.print_stats()
24+
else:
25+
document = p.parse(x)
26+
print convertTreeDump(document.printTree())
27+
else:
28+
print """Pass one argument to parse the document and two to get an
29+
indication on what's going on.
30+
"""

0 commit comments

Comments
 (0)