Charly Dante
2014-03-11 14:28:26 UTC
Hello,
I currently have a problem with my lexer and I don't really know how to
solve it. The thing is I am writing this lexer for a language that supports *Nested
Block-Comments*. This means that each comment that is opened by a /* has to
be closed by another */, even if it was opened inside another
block-comment. The problem is, that this works in both directions: forwards
*and* backwards. To provide an example:
int myfunction(int n)
{
return n;
}
If I now add a normal opening block-comment at the top of that function
everything beyond it gets highlighted green. This is also the way how it
works in C++, which would look like this:
/* int myfunction(int n)
{
return n;
}
However, in languages that support nested block-comments, the other way
round is also possible and adding a */ at the *end* of the code will also
comment out everything before, just like this:
int myfunction(int n)
{
return n;
} */
This doesn't work in C++ obviously as C++ doesn't have nested
block-comments. The highlighting there for this case will look like this:
int myfunction(int n)
{
return n;
} */
And thats exactly my problem now, that the highlighting is not applied in
this case because it would require the lexer to iterate bi-directional.
There are several languages supproting nested block-comments and at the
moment I see no way to provide reliable highlighting for them? Especially
when having multiple nested statements its very confusing that one cannot
see if all comments are closed now or not because the highlighting bugs....
How can I solve this issue?
Best Regards,
CD
I currently have a problem with my lexer and I don't really know how to
solve it. The thing is I am writing this lexer for a language that supports *Nested
Block-Comments*. This means that each comment that is opened by a /* has to
be closed by another */, even if it was opened inside another
block-comment. The problem is, that this works in both directions: forwards
*and* backwards. To provide an example:
int myfunction(int n)
{
return n;
}
If I now add a normal opening block-comment at the top of that function
everything beyond it gets highlighted green. This is also the way how it
works in C++, which would look like this:
/* int myfunction(int n)
{
return n;
}
However, in languages that support nested block-comments, the other way
round is also possible and adding a */ at the *end* of the code will also
comment out everything before, just like this:
int myfunction(int n)
{
return n;
} */
This doesn't work in C++ obviously as C++ doesn't have nested
block-comments. The highlighting there for this case will look like this:
int myfunction(int n)
{
return n;
} */
And thats exactly my problem now, that the highlighting is not applied in
this case because it would require the lexer to iterate bi-directional.
There are several languages supproting nested block-comments and at the
moment I see no way to provide reliable highlighting for them? Especially
when having multiple nested statements its very confusing that one cannot
see if all comments are closed now or not because the highlighting bugs....
How can I solve this issue?
Best Regards,
CD
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.