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

Add full support for line continuations #39

Open
fingolfin opened this issue Dec 18, 2019 · 0 comments
Open

Add full support for line continuations #39

fingolfin opened this issue Dec 18, 2019 · 0 comments

Comments

@fingolfin
Copy link

Right now, I don't think C line continuations are fully supported. Sure, PR #29 added line continuation to extras, and there is code in place to support line continuations in string literals and comments. But that only captures a tiny fraction of all possible uses. For example, this is valid C code for a function that returns 42:

i\
n\
t
bar(void){
    return 4\
2;
}

I don't know if it is even possible to do this in tree-sitter (at least with basic methods); when implementing a C parser "by hand" the easiest way to handle it usually is to deal with it in the code which reads the input stream before passing the data to the tokenizer/lexer (of course care has to be taken to preserve line/column information).

Of course one can also consciously decide to not support this (most syntax highlighters out there don't seem to deal with this at all). Though then I think it'd be a good idea to document this explicitly.

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

1 participant