@@ -65,11 +65,12 @@ def parse():
65
65
if opts .profile :
66
66
import cProfile
67
67
import pstats
68
- cProfile .runctx ("run(parseMethod, f, encoding)" , None ,
68
+ cProfile .runctx ("run(parseMethod, f, encoding, scripting )" , None ,
69
69
{"run" : run ,
70
70
"parseMethod" : parseMethod ,
71
71
"f" : f ,
72
- "encoding" : encoding },
72
+ "encoding" : encoding ,
73
+ "scripting" : opts .scripting },
73
74
"stats.prof" )
74
75
# XXX - We should use a temp file here
75
76
stats = pstats .Stats ('stats.prof' )
@@ -79,7 +80,7 @@ def parse():
79
80
elif opts .time :
80
81
import time
81
82
t0 = time .time ()
82
- document = run (parseMethod , f , encoding )
83
+ document = run (parseMethod , f , encoding , opts . scripting )
83
84
t1 = time .time ()
84
85
if document :
85
86
printOutput (p , document , opts )
@@ -88,13 +89,13 @@ def parse():
88
89
else :
89
90
sys .stderr .write ("\n \n Run took: %fs" % (t1 - t0 ))
90
91
else :
91
- document = run (parseMethod , f , encoding )
92
+ document = run (parseMethod , f , encoding , opts . scripting )
92
93
if document :
93
94
printOutput (p , document , opts )
94
95
95
- def run (parseMethod , f , encoding ):
96
+ def run (parseMethod , f , encoding , scripting ):
96
97
try :
97
- document = parseMethod (f , encoding = encoding )
98
+ document = parseMethod (f , encoding = encoding , scripting = scripting )
98
99
except :
99
100
document = None
100
101
traceback .print_exc ()
@@ -168,6 +169,9 @@ def getOptParser():
168
169
parser .add_option ("-f" , "--fragment" , action = "store_true" , default = False ,
169
170
dest = "fragment" , help = "Parse as a fragment" )
170
171
172
+ parser .add_option ("-s" , "--scripting" , action = "store_true" , default = False ,
173
+ dest = "scripting" , help = "Handle noscript tags as if scripting was enabled" )
174
+
171
175
parser .add_option ("" , "--tree" , action = "store_true" , default = False ,
172
176
dest = "tree" , help = "Output as debug tree" )
173
177
0 commit comments