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

parsing error: Token(u'#include <set>\\\n', xxx, yyy) #147

Open
TomerJLevy opened this issue Sep 19, 2019 · 0 comments
Open

parsing error: Token(u'#include <set>\\\n', xxx, yyy) #147

TomerJLevy opened this issue Sep 19, 2019 · 0 comments

Comments

@TomerJLevy
Copy link
Contributor

First of all - Awesome project!

I noticed my code has a line like this:
#include <set>\

Which compile but fails in your parser here - https://github.com/myint/cppclean/blob/master/cpp/ast.py#L786

if name[0] in '<"':
    assert_parse(name[-1] in '>"', token)

I think that if the compiler enables to do so, so it shouldn't fail the parsing. Even though it's a weird way of writing code...
I would check if it's endswith('\') as well.

A naive and simple solution could be:

if name[0] in '<"':
    if name.endswith('\\'):
        name = name[:-1].strip()
    assert_parse(name[-1] in '>"', token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants