-
Notifications
You must be signed in to change notification settings - Fork 86
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
Weird parsing results with nested template argument list #192
Comments
@maxbrunsfeld - if you have a bit of time to spare to look at this, I'd really appreciate it. This is completely baffling to me: map<string, vector<vector<string>>> v; produces:
But, putting the same exact code as a field declaration makes it work: struct Foo {
map<string, vector<vector<string>>> v;
};
The only difference is the grandparent node of the Here's the template_type: $ => seq(
field('name', $._type_identifier),
field('arguments', $.template_argument_list)
),
template_argument_list: $ => seq(
'<',
commaSep(choice(
prec.dynamic(3, $.type_descriptor),
prec.dynamic(2, alias($.type_parameter_pack_expansion, $.parameter_pack_expansion)),
prec.dynamic(1, $._expression)
)),
alias(token(prec(1, '>')), '>')
), When the |
setting |
I have a similar example, although it produces a hard error, not just a misclassified node: optional<tuple<A<W>,B<X>,C<Y>,D<Z>>> f; This produces:
It appears to give precedence to a The change that @amaanq mentions above (to set the dynamic precedence of
Well, this is not an incorrect parse, that could indeed be a To have a shot in the dark, I wonder whether line 155 has something to do with the precedences resolving this way, but have not found an alternative that keeps other tests working: type_descriptor: (_, original) => prec.right(original), |
A further update: setting the precedence of |
This example gives weird/inconsistent results leading me to believe there's an issue with parsing nested templates:
I expect to see all types highlighted, but the last line fails to highlight
string
in the first index tomap
; instead parsing it as anidentifier
when I expecttype_identifier
:The text was updated successfully, but these errors were encountered: