The output of parse_file() is different when using the OpenCLCparser vs the pycparser default:
>>> parse_file("kernel.cl", use_cpp=True).children()
(('ext[0]', <pycparser.c_ast.FuncDef at 0x7f986ea2e2c8>),)
>>> parse_file("kernel.cl", use_cpp=True, parser=OpenCLCParser()).children()
(('ext[0]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986ea31240>]),
('ext[1]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986ea314e0>]),
('ext[2]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986ea271d0>]),
('ext[3]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986eacc898>]),
('ext[4]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986ea31470>]),
('ext[5]', [<pycparserext.ext_c_parser.PreprocessorLine at 0x7f986ea31128>]),
('ext[6]', <pycparser.c_ast.FuncDef at 0x7f986ed6b908>))
This breaks the behaviour of the show() method:
>>> parse_file("kernel.cl", use_cpp=True, parser=OpenCLCParser()).show()
Traceback (most recent call last)
...
AttributeError: 'list' object has no attribute 'show'
What is the meaning of the PreprocessorLine objects? Is there a way I can disable their creation, or have I misunderstood the API?
Hi,
given this simple test file:
The output of
parse_file()
is different when using the OpenCLCparser vs the pycparser default:This breaks the behaviour of the
show()
method:What is the meaning of the
PreprocessorLine
objects? Is there a way I can disable their creation, or have I misunderstood the API?