我试图创建AST usinfg pyCparser,打印了以下错误:
Traceback (most recent call last):
File "C:\Work\RE\Tools\VarsExporter\BuildExportedDb.py", line 1076, in
main()
File "C:\Work\RE\Tools\VarsExporter\BuildExportedDb.py", line 1032, in main
ast = parse_file(i_file)
File "C:\Python27\lib\site-packages\pycparser_init_.py", line 93, in
parse_file
return parser.parse(text, filename)
File "C:\Python27\lib\site-packages\pycparser\c_parser.py", line 152, in
parse
debug=debuglevel)
File "C:\Python27\lib\site-packages\pycparser\ply\yacc.py", line 331, in
parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "C:\Python27\lib\site-packages\pycparser\ply\yacc.py", line 1199, in
parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "C:\Python27\lib\site-packages\pycparser\ply\yacc.py", line 193, in
call_errorfunc
r = errorfunc(token)
File "C:\Python27\lib\site-packages\pycparser\c_parser.py", line 1761, in
p_error
column=self.clex.find_tok_column(p)))
File "C:\Python27\lib\site-packages\pycparser\plyparser.py", line 67, in _
parse_error
raise ParseError("%s: %s" % (coord, msg))
ParseError: Objectffly\SerDb.i:43:18: before: __loff_t造成上述问题的原因是什么?我该怎么处理呢?有什么建议,我如何调试它,并找出是怎么回事?
发布于 2018-03-08 14:09:44
来自pyCparser git常见问题解答:
C代码几乎总是包括标准C库中的各种头文件,比如stdio.h。虽然(通过一定的努力) the解析器可以解析来自任何C编译器的标准标头,但使用utils/ parse _libc_include中提供的“假”标准要简单得多。这些是标准的C头文件,其中只包含允许对使用它们的文件进行有效解析的最基本需求。
为了解决这个问题,我成功地使用了描述这里的方法。
https://stackoverflow.com/questions/49128661
复制相似问题