Commit Graph

49 Commits (862f6f2841371f922276d1455070ef57656a12cb)

Author SHA1 Message Date
John Drouhard 862f6f2841 alias decltype_auto to decltype 2022-01-16 17:00:14 +07:00
John Drouhard 6800b65532 Add support for constraints on placeholder type specifiers 2022-01-16 16:12:28 +07:00
Stephan Seitz 4af61b769e Make simple_requirement an alias for expression_statement 2022-01-16 20:33:16 +07:00
Stephan Seitz 4014e212eb Add support for concepts 2021-11-28 17:59:11 +07:00
John Drouhard e8dcc9d2b4 Support attributes on class/struct/union declarations 2021-10-28 08:16:36 +07:00
BigRedEye 724b93bac0 feat: Support namespace aliases 2021-10-25 23:27:38 +07:00
John Drouhard 30b9a2f6b4 Overhaul scoped identifier rules and add dependent name support
!! 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.
2021-09-23 22:59:30 +07:00
cynix 977dc3a960
Add user-defined literals (#115)
* 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
2021-09-23 15:38:55 +07:00
John Drouhard ca00ce9629 Refactor virtual_function_specifier to simply be a declaration modifier so it can appear in any order in the decl-specifier-seq 2021-09-20 14:08:48 +07:00
John Drouhard d0730bb0c3 Update tree-sitter-c dependency to 0.20.1 2021-09-20 14:08:46 +07:00
John Drouhard 46befa3f34 Add template_method to field_initializer rule 2021-09-20 09:56:58 +07:00
Alois Wohlschlager 01b9eb2ee5
Ref-qualifiers on functions
Add support for the C++11 ref-qualifier syntax to the grammar. Add tests
that ref-qualifiers are parsed properly on both declarations and
definitions.
2021-09-18 14:46:33 +07:00
Andrew He 2889d93330 Add support for initializer lists in subscript operator
See https://en.cppreference.com/w/cpp/language/operator_member_access

Fixes #100
2021-09-17 11:11:07 +07:00
John Drouhard 6cc73d72fd All cpp-specific statements are valid under case statements. Fixes #97 2021-09-17 08:02:55 +07:00
John Drouhard 5d46d3a5fb Add thread_local to storage_class_specifiers (fixes #101) 2021-09-16 12:35:05 +07:00
John Drouhard 99e287a435 Utilize tree-sitter-c for [[attribute]] grammar 2021-09-15 22:54:12 +07:00
Calixte Denizet 25d65aa70c Add c++20 attributes on statements 2021-09-15 08:33:07 +07:00
Alois Wohlschlager 42c8fd32c1
Support C++20 coroutines
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.
2021-09-15 11:35:15 +07:00
Calixte Denizet f503c2a0d7 Namespace names for definition can be scoped and contain inline keyword 2021-08-13 10:46:30 +07:00
Max Brunsfeld 8074ba8944 Bump tree-sitter-cli to 0.19 2021-03-04 10:01:28 +07:00
jdrouhard fb8250eef8
Fixes for constructor declarations (#89)
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.
2020-11-02 09:46:58 +07:00
Max Brunsfeld 20dc2e4301 ⬆️ tree-sitter-cli 2020-05-14 11:46:45 +07:00
Mathieu Nayrolles 72348197be
Add support for Microsoft-specific modifiers (#79)
* 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
2020-04-01 09:18:50 +07:00
jdrouhard 4da6618567
Non-type template parameters can be variadic as well (#76) 2020-03-20 13:12:24 +07:00
jdrouhard 0c605b92d1
Improve parsing of friend declarations when using c++11 simple type specifier (#77)
Also resolves possible erroneous parsing of a friend declaration
attempting to define a new class.
2020-03-20 09:28:38 +07:00
jdrouhard 4d511d9a92
Identifiers in variadic declarators should be optional like other parameter declarators (#75) 2020-03-19 10:05:59 +07:00
calixteman 9570367528
Add operator conversion (#73) 2020-03-19 09:54:18 +07:00
Max Brunsfeld 100b014501 ⬆️ tree-sitter-cli 2020-03-02 13:35:59 +07:00
Max Brunsfeld c7b767ac5f Fix issue with function types in expression position 2019-12-17 13:43:08 +07:00
calixteman f2e0cd5e3b Fix declaration in if/switch/while conditions (#54)
* Fix declaration in if/switch/while conditions

* Simplify structure of if/while/switch conditions
2019-12-17 12:58:55 +07:00
Max Brunsfeld 89c68a5548 Tweak rules to reduce parse state count 2019-12-17 12:13:27 +07:00
calixteman 9ba0c978c0 Fix explicit ctor declaration and support explicit with condition (c++20) (#70) 2019-12-17 11:16:54 +07:00
calixteman ba21308963 Primitive types have ctors (#66) 2019-12-17 11:13:34 +07:00
calixteman 2987cba279 Trailing return type can have a type specifier (#71) 2019-12-17 11:09:06 +07:00
calixteman 86f1e6ca02 static_assert can have raw strings or concatenated strings as 2nd arg (#69) 2019-12-17 11:03:20 +07:00
calixteman 279b973a92 Handle decltype (#67) 2019-12-17 10:54:35 +07:00
calixteman a426194b36 Concatenated strings can contain raw string literals (#65)
* Concatenated strings can contain raw string literals

* Restore require path for tree-sitter-c
2019-12-17 10:49:33 +07:00
calixteman 565244b6f6 Assignment LHS can be a scoped identifier (#68)
* Assignment LHS can be a scoped identifier

* Bad path in grammar

* Forgot test and parser

* Update for latest tree-sitter-c
2019-12-17 10:40:22 +07:00
Max Brunsfeld b583491d42 Parse 'this' as a distinct node type 2019-12-10 12:04:20 +07:00
Max Brunsfeld a0bcddc3b1 ⬆️ tree-sitter-cli 2019-12-02 17:01:53 +07:00
jdrouhard 7263d5bdb8 Add support for static_assert declarations (#61) 2019-10-30 10:58:36 +07:00
jdrouhard 9ad3202e7d Support for parameter pack expansions and improvements to lambda expressions (#60)
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
2019-10-30 10:53:21 +07:00
jdrouhard 5ba6c37d72 Add support for alias templates (#59) 2019-10-04 14:21:07 +07:00
johnmiked15 7e00ca7c74 Various improvements to template parsing (#58)
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
2019-09-30 19:38:40 +07:00
johnmiked15 e21d7ff7d8 Add default_method_clause to inline_method_definition (#57)
Fixes #48
2019-09-30 19:23:51 +07:00
calixteman f5afa0ee48 Add a base type for enums (#55)
* Add a base type for enums

* Add scoped type identifiers and handle enum class/struct
2019-08-06 17:23:46 +07:00
Max Brunsfeld 944036401e ⬆️ tree-sitter-c 2019-07-02 15:50:03 +07:00
Max Brunsfeld 42dcb72c28 Add node fields 2019-06-24 12:06:48 +07:00
Max Brunsfeld 0712d17674 Update tree-sitter-cli to 0.15.3 2019-06-07 14:37:45 +07:00