Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycparser fails to parse extra semi-colons in structure declaration list #117

Closed
vijunag opened this issue Mar 16, 2016 · 1 comment
Closed

Comments

@vijunag
Copy link

vijunag commented Mar 16, 2016

Parser throws error if declarators inside of a structure have extra ";;" terminators. However, it works if the declarator is outside of a structure or an union declaration.

from pycparser import c_parser, c_ast p = c_parser.CParser() src="int a;;;" p.parse(src) p.parse(src).show()

FileAST:
Decl: a, [], [], []
TypeDecl: a, []
IdentifierType: ['int']

src="""struct foo { ... int a;; ... };""" p.parse(src).show()

Traceback (most recent call last):
File "", line 1, in
File "pycparser/c_parser.py", line 146, in parse
debug=debuglevel)
File "pycparser/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "pycparser/ply/yacc.py", line 1047, in parseopt_notrack
tok = self.errorfunc(errtoken)
File "pycparser/c_parser.py", line 1680, in p_error
column=self.clex.find_tok_column(p)))
File "pycparser/plyparser.py", line 55, in _parse_error
raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: :2:7: before: ;

@eliben eliben closed this as completed in 95e3b76 Mar 19, 2016
@eliben
Copy link
Owner

eliben commented Mar 19, 2016

Should be fixed now. Thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants