!! 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
C++20 introduces language support for coroutines, using three new
keywords and related language constructions.
* co_await is a unary operator.
* co_return introduces a statement, and works just like return or throw.
* co_yield similarly introduces a statement, but cannot stand for
itself.
Add support for these facilities to the parser and highlighter.
Constructor declarations can have the same decl-specifiers as
constructor definitions. This adds a new rule to match as many
"constructor specifiers" that are present in any order before the
function decl itself, and adds the rule to constructor declarations and
constructor definitions.
The cast operator can also have any of these specifiers in any order
before the declaration, so this commit also changes the cast operator
declaration and definition to use the new rule as well.
Finally, constructor declarations and cast operator declarations can be
part of a template declaration in addition to the definitions, so add
them both to the template_declaration rule.
* Add support for Microsoft-specific modifiers
Microsoft-specific modifiers are keywords can be used to modify declarators to form derived types.
The specification for the modifiers themselves is here:
https://docs.microsoft.com/en-us/cpp/cpp/microsoft-specific-modifiers?view=vs-2019
This commit updates tree-sitter-c to ^0.16.1 that supports the modifiers
, updates the grammar.js to reflect the changes and add tests.
* 0.16.1
* Fix array assignment expressions so they don't parse as structured bindings
Array assignment expressions were broken in df7bc44 which added more
support for structured binding declarators. We need to add a dynamic
precedence that is lower than that of an assignment expression so that
code is parsed as an assignment expression before it's parsed as a
structured binding.
* Just use -1 for structured binding dynamic precedence
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
For information about parameter packs, see
https://en.cppreference.com/w/cpp/language/parameter_pack
Most expansion loci should work with this commit since it is implemented
as an expression, so anywhere an expression is valid, parameter pack
expansions will be parsed.
This commit also adds support for:
* The sizeof... operator (as an alternative to sizeof)
* Lambda captures can optionally start with a default capture along with
other captures
* Lambda function declarators (the parameter list) are optional
Tests added for the following parameter pack expansion loci:
* Function parameter and argument lists
* Template argument lists
* Brace-enclosed initializers
* Base class specifiers and member initializer lists
* Lambda captures
This implements support for the following:
* Template constructors defined outside class definition (Fixes#50)
* Nested template function definitions outside class definition
* Template template parameters
* Name-specifiers are now (correctly) optional in template parameters