inducer / pycparserext

Extensions for Eli Bendersky's pycparser
http://pypi.python.org/pypi/pycparserext
Other
83 stars 28 forks source link

NotImplementedError: cannot attach asm or attributes to nodes of type '<class 'pycparser.c_ast.PtrDecl'>' #66

Open MaggieCwj opened 2 years ago

MaggieCwj commented 2 years ago

When i want to generate AST of a function, it displays the following error mesages:

Traceback (most recent call last): File "slice_uniq.py", line 227, in <module> split_if(path) File "slice_uniq.py", line 131, in split_if ast = parser.parse(cont, filename='<none>')#, debuglevel=1) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 33, in parse File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1118, in parseopt_notrack p.callable(pslice) File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 126, in param_rule func(self, p) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 427, in p_xxx_declarator_2 NotImplementedError: cannot attach asm or attributes to nodes of type '<class 'pycparser.c_ast.PtrDecl'>'

I guess it's because the return value of the function is a pointer. I want to define it in the command line like "-D'char*=char'"

However, another error occurred:

Traceback (most recent call last): File "slice_uniq.py", line 227, in <module> split_if(path) File "slice_uniq.py", line 131, in split_if ast = parser.parse(cont, filename='<none>')#, debuglevel=1) File "/usr/local/lib/python3.6/dist-packages/pycparserext-2021.1-py3.6.egg/pycparserext/ext_c_parser.py", line 33, in parse File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack tok = call_errorfunc(self.errorfunc, errtoken, self) File "/usr/local/lib/python3.6/dist-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc r = errorfunc(token) File "/usr/local/lib/python3.6/dist-packages/pycparser/c_parser.py", line 1934, in p_error column=self.clex.find_tok_column(p))) File "/usr/local/lib/python3.6/dist-packages/pycparser/plyparser.py", line 67, in _parse_error raise ParseError("%s: %s" % (coord, msg)) pycparser.plyparser.ParseError: /home/nkamg/ifcut/pycparser/utils/fake_libc_include/_fake_typedefs.h:176:17: before: *

How can I solve this problem?