Closed juanfgarcia closed 2 years ago
I'm getting an error when parsing '//' style comments and not with '/.../' style
I've been searching and I've found in pycparser/ply/ctokens.py
# Comment (C-Style) def t_COMMENT(t): r'/\*(.|\n)*?\*/' t.lexer.lineno += t.value.count('\n') return t # Comment (C++-Style) def t_CPPCOMMENT(t): r'//.*\n' t.lexer.lineno += 1 return t
But changing t_COMMENT(t) to the // style doesn't work.
Is there any option to compile with the C++ style? If not, do I need to run yacc or other tool to make it work?
The preprocessor is supposed to remove all comments. If you use a preprocessor that supports C++ style comments, this should work because pycparser itself is not aware of comments.
https://github.com/eliben/pycparser#31interaction-with-the-c-preprocessor
I'm getting an error when parsing '//' style comments and not with '/.../' style
I've been searching and I've found in pycparser/ply/ctokens.py
But changing t_COMMENT(t) to the // style doesn't work.
Is there any option to compile with the C++ style? If not, do I need to run yacc or other tool to make it work?