@@ -21,7 +21,9 @@ def dumpmain() -> None:
21
21
)
22
22
parser .add_argument ("-v" , "--verbose" , default = False , action = "store_true" )
23
23
parser .add_argument (
24
- "--mode" , choices = ["json" , "pprint" , "repr" , "brepr" ], default = "pprint"
24
+ "--mode" ,
25
+ choices = ["json" , "pprint" , "repr" , "brepr" , "pponly" ],
26
+ default = "pprint" ,
25
27
)
26
28
parser .add_argument (
27
29
"--pcpp" , default = False , action = "store_true" , help = "Use pcpp preprocessor"
@@ -33,11 +35,17 @@ def dumpmain() -> None:
33
35
args = parser .parse_args ()
34
36
35
37
preprocessor = None
36
- if args .pcpp :
38
+ if args .pcpp or args . mode == "pponly" :
37
39
from .preprocessor import make_pcpp_preprocessor
38
40
39
41
preprocessor = make_pcpp_preprocessor (encoding = args .encoding )
40
42
43
+ if args .mode == "pponly" :
44
+ with open (args .header , "r" , encoding = args .encoding ) as fp :
45
+ pp_content = preprocessor (args .header , fp .read ())
46
+ sys .stdout .write (pp_content )
47
+ sys .exit (0 )
48
+
41
49
options = ParserOptions (verbose = args .verbose , preprocessor = preprocessor )
42
50
data = parse_file (args .header , encoding = args .encoding , options = options )
43
51
0 commit comments