-
Notifications
You must be signed in to change notification settings - Fork 629
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
c++ parsing error #1750
Comments
It is not reproduced on my environment.
|
Not sure if this matters, but here is my ctags --version: |
Could you run Universal-crags with following command line?
|
Here is what I got: |
I can confirm the issue. @masatake your input file doesn't have the same line 3, because GitHub ate the So this means that it's the line 3's |
@b4n, thank you. Reproduced here. I have to update issue our issue template to let a report use tipple quotes for preformatting. |
@pragmaware, could you look at this issue? I've tried to minimize the reproducer. However, I cannot make it enough small. template <class _Comp0=less<float>,
class _Comp1=less<pair<long, double> > >
class Test : set<int> {
char c;
}; |
Template nastiness... hell of corner cases. This is one of the hard bits. Food for thoughts. How to figure out that the second
is actually an operator an not a template angle bracket? |
How does a real compiler handle this? |
It is one of the test cases we have. The compiler knows that i is a variable and not a (template) type, because it's declared just before... but in theory it could be defined anywhere else. |
One trick I've seen to make such things simpler to parse is to preprocess the tokens and insert special disambiguation tokens, like say the tokens were:
You scan the tokens looking for
Of course it's a dirty hack, and doesn't help with truly ambiguous stuff like this:
Where it's literally impossible to tell whether it's an expression statement comparing |
…nested triangle brackets in template) Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…nested triangle brackets in template) Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…nested triangle brackets in template) Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The input is recorded as a test case triggering the bug. See #1756. |
CXX: Fix #1750 (without breaking other unit tests)
(If you will report an issue about the result of parsing,
fill the following items. If you get the input file somewhere,
write the URL or something.)
The name of the parser:
c++
The command line you used to run ctags:
ctags -o tags bad.h
The content of input file:
The tags output you are not satisfied with:
The tags output you expect:
This is what Exuberant Ctags generates
The text was updated successfully, but these errors were encountered: