This change allows operators (not just fields/member functions) as dependent
template expressions.
```cpp
auto x = y.template operator()<int>();
```
This syntax is used e.g. to call C++20 lambda expressions with a template head
where the template arguments are not function arguments and therefore cannot be
deduced.
```cpp
[]<typename> () {}.template operator()<int>();
```
This change allows commas inside subscripts.
```cpp
auto x = a[1, 2, 3];
```
From C++23, array subscripts work like arguments to `operator[]` as an n-ary
function.
Before C++23, `operator[]` must be a unary function, but before C++20, it's
possible to use the comma operator inside subscript expressions - and this is
done in libraries that use expression templates to achieve multidimensional
array syntax.
Use of the comma operator in subscript expressions was deprecated in C++20 to
make way for the C++23 change to n-ary `operator[]`.
breaking change: namespace_definition_name has been renamed to
nested_namespace_specifier and the nesting has been reversed to match
the way normal scope resolution works elsewhere.
identifiers that are part of a namespace_definition are now
namespace_identifier, which matches the identifier node type used in
scope resolution for qualified types.
namespace alias definitions use the new nested_namespace_specifier so
all identifiers are namespace_identifier nodes.
support for top-level "inline" namespace declarations (which are valid
if they are nested in another namespace body).
Include rawstring delimiters in the tree, use for injections
In raw-strings, the delimiter can be used to indicate embedded language:
R"css( body { background: red; } )css"
This patch adds the delimiter (if present) and raw-string content as
children of the raw_string_literal.
These can be used to parse the content with an injected grammar.
Fixes https://github.com/tree-sitter/tree-sitter-cpp/issues/159
Support for function-try-block implemented in #168/#169 was not correct:
member initializer list in constructor must appear between `try` and the
opening curly brace. Also some cases where try block is allowed were not
implemented.
Following changes are included:
* fix initializer list handling in try block in constructors,
* disallow initializer list in =default/=delete constructors,
* allow for try block in inline function definition,
* allow for try block in cast operator definition.
- Adds a named "init_statement" node for all applicable locations (if,
switch, while, and range-for)
- Adds alias declarations and typedef declarations to possible types of
init statements (c++20/c++23)
!! Breaking change due to restructuring and renaming of scoped identifiers !!
Scoped identifier rules have been renamed to "qualified_x_identifier"
and all variants are aliased so they appear as simply
"qualified_identifier" in the syntax tree. This name better reflects the
c++ standard's language describing this concept.
Qualified identifier rules are now always the "parent" with a right
associative rule that lets them nest indefinitely. Each rule terminates
with some kind of non-scope identifier.
This commit also adds support for the 'template' keyword where required
to disambiguate dependent template names. Field accessors (., ->) can be
followed by keyword template before a template method. The scope
resolution operator can be immediately followed by the 'template'
keyword to indicate the following dependent name with '<' is actually a
template and shouldn't be parsed as a binary operator. These keywords
are required for dependent names in these contexts.
* Add user-defined literals
* Simplify operator rule
* Tweak operator tests
* Remove precedence for user-defined literanl
* Define a rule for ud-suffix
* Use a more readable name for ud-suffix