Skip to content

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

Open

Description

@TomerJLevy

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions