Update dependencies and regenerate CPP parser (#13)

Co-authored-by: mskelton <mskelton@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-07-24 08:39:40 -05:00
committed by GitHub
parent a99bb0d545
commit 931c278a2d
9 changed files with 472986 additions and 394641 deletions
+6 -6
View File
@@ -39,8 +39,8 @@
}
},
"node_modules/tree-sitter-c": {
"version": "0.20.2",
"resolved": "git+ssh://git@github.com/tree-sitter/tree-sitter-c.git#0906255f8de1d319b8ec682ac8c43e7d2524b4fa",
"version": "0.20.3",
"resolved": "git+ssh://git@github.com/tree-sitter/tree-sitter-c.git#fcd123005b7c0bf3b3a63c1dae85590ef4740464",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@@ -59,8 +59,8 @@
}
},
"node_modules/tree-sitter-cpp": {
"version": "0.20.0",
"resolved": "git+ssh://git@github.com/tree-sitter/tree-sitter-cpp.git#4c917d560572dc2b3704b041715b2729fa199963",
"version": "0.20.1",
"resolved": "git+ssh://git@github.com/tree-sitter/tree-sitter-cpp.git#2c7aff437deed72bbceceab95797b3909cc4627d",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@@ -82,7 +82,7 @@
"dev": true
},
"tree-sitter-c": {
"version": "git+ssh://git@github.com/tree-sitter/tree-sitter-c.git#0906255f8de1d319b8ec682ac8c43e7d2524b4fa",
"version": "git+ssh://git@github.com/tree-sitter/tree-sitter-c.git#fcd123005b7c0bf3b3a63c1dae85590ef4740464",
"dev": true,
"from": "tree-sitter-c@git://github.com/tree-sitter/tree-sitter-c.git",
"requires": {
@@ -96,7 +96,7 @@
"dev": true
},
"tree-sitter-cpp": {
"version": "git+ssh://git@github.com/tree-sitter/tree-sitter-cpp.git#4c917d560572dc2b3704b041715b2729fa199963",
"version": "git+ssh://git@github.com/tree-sitter/tree-sitter-cpp.git#2c7aff437deed72bbceceab95797b3909cc4627d",
"dev": true,
"from": "tree-sitter-cpp@git://github.com/tree-sitter/tree-sitter-cpp.git",
"requires": {
+1156 -129
View File
File diff suppressed because it is too large Load Diff
+510 -13
View File
@@ -139,6 +139,10 @@
"type": "generic_expression",
"named": true
},
{
"type": "gnu_asm_expression",
"named": true
},
{
"type": "identifier",
"named": true
@@ -156,11 +160,11 @@
"named": true
},
{
"type": "nullptr",
"type": "number_literal",
"named": true
},
{
"type": "number_literal",
"type": "offsetof_expression",
"named": true
},
{
@@ -377,6 +381,10 @@
"type": "pointer_declarator",
"named": true
},
{
"type": "primitive_type",
"named": true
},
{
"type": "type_identifier",
"named": true
@@ -1322,8 +1330,12 @@
"fields": {},
"children": {
"multiple": false,
"required": false,
"required": true,
"types": [
{
"type": "character",
"named": true
},
{
"type": "escape_sequence",
"named": true
@@ -2223,6 +2235,21 @@
}
}
},
{
"type": "else_clause",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "_statement",
"named": true
}
]
}
},
{
"type": "enum_specifier",
"named": true,
@@ -3180,6 +3207,217 @@
]
}
},
{
"type": "gnu_asm_clobber_list",
"named": true,
"fields": {
"register": {
"multiple": true,
"required": false,
"types": [
{
"type": "string_literal",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_expression",
"named": true,
"fields": {
"assembly_code": {
"multiple": false,
"required": true,
"types": [
{
"type": "concatenated_string",
"named": true
},
{
"type": "string_literal",
"named": true
}
]
},
"clobbers": {
"multiple": false,
"required": false,
"types": [
{
"type": "gnu_asm_clobber_list",
"named": true
}
]
},
"goto_labels": {
"multiple": false,
"required": false,
"types": [
{
"type": "gnu_asm_goto_list",
"named": true
}
]
},
"input_operands": {
"multiple": false,
"required": false,
"types": [
{
"type": "gnu_asm_input_operand_list",
"named": true
}
]
},
"output_operands": {
"multiple": false,
"required": false,
"types": [
{
"type": "gnu_asm_output_operand_list",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "gnu_asm_qualifier",
"named": true
}
]
}
},
{
"type": "gnu_asm_goto_list",
"named": true,
"fields": {
"label": {
"multiple": true,
"required": false,
"types": [
{
"type": "identifier",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_input_operand",
"named": true,
"fields": {
"constraint": {
"multiple": false,
"required": true,
"types": [
{
"type": "string_literal",
"named": true
}
]
},
"symbol": {
"multiple": false,
"required": false,
"types": [
{
"type": "identifier",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "_expression",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_input_operand_list",
"named": true,
"fields": {
"operand": {
"multiple": true,
"required": false,
"types": [
{
"type": "gnu_asm_input_operand",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_output_operand",
"named": true,
"fields": {
"constraint": {
"multiple": false,
"required": true,
"types": [
{
"type": "string_literal",
"named": true
}
]
},
"symbol": {
"multiple": false,
"required": false,
"types": [
{
"type": "identifier",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_output_operand_list",
"named": true,
"fields": {
"operand": {
"multiple": true,
"required": false,
"types": [
{
"type": "gnu_asm_output_operand",
"named": true
}
]
}
}
},
{
"type": "gnu_asm_qualifier",
"named": true,
"fields": {}
},
{
"type": "goto_statement",
"named": true,
@@ -3205,7 +3443,7 @@
"required": false,
"types": [
{
"type": "_statement",
"type": "else_clause",
"named": true
}
]
@@ -3727,6 +3965,37 @@
]
}
},
{
"type": "null",
"named": true,
"fields": {}
},
{
"type": "offsetof_expression",
"named": true,
"fields": {
"member": {
"multiple": false,
"required": true,
"types": [
{
"type": "field_identifier",
"named": true
}
]
},
"type": {
"multiple": false,
"required": true,
"types": [
{
"type": "type_descriptor",
"named": true
}
]
}
}
},
{
"type": "operator_cast",
"named": true,
@@ -4364,6 +4633,122 @@
]
}
},
{
"type": "preproc_elifdef",
"named": true,
"fields": {
"alternative": {
"multiple": false,
"required": false,
"types": [
{
"type": "preproc_elif",
"named": true
},
{
"type": "preproc_else",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "_statement",
"named": true
},
{
"type": "_type_specifier",
"named": true
},
{
"type": "alias_declaration",
"named": true
},
{
"type": "concept_definition",
"named": true
},
{
"type": "declaration",
"named": true
},
{
"type": "function_definition",
"named": true
},
{
"type": "linkage_specification",
"named": true
},
{
"type": "namespace_alias_definition",
"named": true
},
{
"type": "namespace_definition",
"named": true
},
{
"type": "preproc_call",
"named": true
},
{
"type": "preproc_def",
"named": true
},
{
"type": "preproc_function_def",
"named": true
},
{
"type": "preproc_if",
"named": true
},
{
"type": "preproc_ifdef",
"named": true
},
{
"type": "preproc_include",
"named": true
},
{
"type": "static_assert_declaration",
"named": true
},
{
"type": "template_declaration",
"named": true
},
{
"type": "template_instantiation",
"named": true
},
{
"type": "type_definition",
"named": true
},
{
"type": "using_declaration",
"named": true
}
]
}
},
{
"type": "preproc_else",
"named": true,
@@ -4671,6 +5056,10 @@
"type": "preproc_elif",
"named": true
},
{
"type": "preproc_elifdef",
"named": true
},
{
"type": "preproc_else",
"named": true
@@ -5193,6 +5582,10 @@
{
"type": "escape_sequence",
"named": true
},
{
"type": "string_content",
"named": true
}
]
}
@@ -5672,10 +6065,6 @@
"multiple": true,
"required": false,
"types": [
{
"type": "_statement",
"named": true
},
{
"type": "_type_specifier",
"named": true
@@ -5684,18 +6073,74 @@
"type": "alias_declaration",
"named": true
},
{
"type": "attributed_statement",
"named": true
},
{
"type": "break_statement",
"named": true
},
{
"type": "case_statement",
"named": true
},
{
"type": "co_return_statement",
"named": true
},
{
"type": "co_yield_statement",
"named": true
},
{
"type": "compound_statement",
"named": true
},
{
"type": "concept_definition",
"named": true
},
{
"type": "continue_statement",
"named": true
},
{
"type": "declaration",
"named": true
},
{
"type": "do_statement",
"named": true
},
{
"type": "expression_statement",
"named": true
},
{
"type": "for_range_loop",
"named": true
},
{
"type": "for_statement",
"named": true
},
{
"type": "function_definition",
"named": true
},
{
"type": "goto_statement",
"named": true
},
{
"type": "if_statement",
"named": true
},
{
"type": "labeled_statement",
"named": true
},
{
"type": "linkage_specification",
"named": true
@@ -5732,10 +6177,18 @@
"type": "preproc_include",
"named": true
},
{
"type": "return_statement",
"named": true
},
{
"type": "static_assert_declaration",
"named": true
},
{
"type": "switch_statement",
"named": true
},
{
"type": "template_declaration",
"named": true
@@ -5744,6 +6197,14 @@
"type": "template_instantiation",
"named": true
},
{
"type": "throw_statement",
"named": true
},
{
"type": "try_statement",
"named": true
},
{
"type": "type_definition",
"named": true
@@ -5751,6 +6212,10 @@
{
"type": "using_declaration",
"named": true
},
{
"type": "while_statement",
"named": true
}
]
}
@@ -6244,6 +6709,14 @@
"type": "#elif",
"named": false
},
{
"type": "#elifdef",
"named": false
},
{
"type": "#elifndef",
"named": false
},
{
"type": "#else",
"named": false
@@ -6440,6 +6913,10 @@
"type": "LR\"",
"named": false
},
{
"type": "NULL",
"named": false
},
{
"type": "R\"",
"named": false
@@ -6496,6 +6973,10 @@
"type": "_Noreturn",
"named": false
},
{
"type": "__asm__",
"named": false
},
{
"type": "__attribute__",
"named": false
@@ -6552,6 +7033,10 @@
"type": "and_eq",
"named": false
},
{
"type": "asm",
"named": false
},
{
"type": "auto",
"named": true
@@ -6576,6 +7061,10 @@
"type": "catch",
"named": false
},
{
"type": "character",
"named": true
},
{
"type": "class",
"named": false
@@ -6744,6 +7233,10 @@
"type": "noexcept",
"named": false
},
{
"type": "noreturn",
"named": false
},
{
"type": "not",
"named": false
@@ -6752,18 +7245,18 @@
"type": "not_eq",
"named": false
},
{
"type": "null",
"named": true
},
{
"type": "nullptr",
"named": true
"named": false
},
{
"type": "number_literal",
"named": true
},
{
"type": "offsetof",
"named": false
},
{
"type": "operator",
"named": false
@@ -6852,6 +7345,10 @@
"type": "static_assert",
"named": false
},
{
"type": "string_content",
"named": true
},
{
"type": "struct",
"named": false
+469309 -393493
View File
File diff suppressed because it is too large Load Diff
+1003 -478
View File
File diff suppressed because it is too large Load Diff
+117 -50
View File
@@ -1,30 +1,38 @@
=====================================
================================================================================
Scoped function definitions
=====================================
================================================================================
int T::foo() { return 1; }
int T::foo() const { return 0; }
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(primitive_type)
(function_declarator
(qualified_identifier (namespace_identifier) (identifier))
(qualified_identifier
(namespace_identifier)
(identifier))
(parameter_list))
(compound_statement (return_statement (number_literal))))
(compound_statement
(return_statement
(number_literal))))
(function_definition
(primitive_type)
(function_declarator
(qualified_identifier (namespace_identifier) (identifier))
(qualified_identifier
(namespace_identifier)
(identifier))
(parameter_list)
(type_qualifier))
(compound_statement (return_statement (number_literal)))))
(compound_statement
(return_statement
(number_literal)))))
=====================================
================================================================================
Constructor definitions
=====================================
================================================================================
T::T() {}
@@ -36,32 +44,52 @@ T::T() : Base<T>() {}
T::T() try : f1(0) {} catch(...) {}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(function_declarator
(qualified_identifier (namespace_identifier) (identifier))
(qualified_identifier
(namespace_identifier)
(identifier))
(parameter_list))
(compound_statement))
(function_definition
(function_declarator
(qualified_identifier (namespace_identifier) (identifier))
(qualified_identifier
(namespace_identifier)
(identifier))
(parameter_list))
(field_initializer_list
(field_initializer (field_identifier) (argument_list (number_literal)))
(field_initializer (field_identifier) (argument_list (number_literal) (number_literal))))
(field_initializer
(field_identifier)
(argument_list
(number_literal)))
(field_initializer
(field_identifier)
(argument_list
(number_literal)
(number_literal))))
(compound_statement
(expression_statement (call_expression (identifier) (argument_list (string_literal))))))
(expression_statement
(call_expression
(identifier)
(argument_list
(string_literal
(string_content)))))))
(function_definition
(function_declarator
(qualified_identifier (namespace_identifier) (identifier))
(qualified_identifier
(namespace_identifier)
(identifier))
(parameter_list))
(field_initializer_list
(field_initializer
(template_method
(field_identifier)
(template_argument_list (type_descriptor (type_identifier))))
(template_argument_list
(type_descriptor
(type_identifier))))
(argument_list)))
(compound_statement))
(function_definition
@@ -81,9 +109,9 @@ T::T() try : f1(0) {} catch(...) {}
(parameter_list)
(compound_statement)))))
=====================================
================================================================================
Explicit constructor definitions
=====================================
================================================================================
class C {
explicit C(int f) : f_(f) {}
@@ -92,7 +120,7 @@ class C {
int f_;
};
---
--------------------------------------------------------------------------------
(translation_unit
(class_specifier
@@ -102,23 +130,31 @@ class C {
(explicit_function_specifier)
(function_declarator
(identifier)
(parameter_list (parameter_declaration (primitive_type) (identifier))))
(parameter_list
(parameter_declaration
(primitive_type)
(identifier))))
(field_initializer_list
(field_initializer (field_identifier) (argument_list (identifier))))
(field_initializer
(field_identifier)
(argument_list
(identifier))))
(compound_statement))
(access_specifier)
(field_declaration (primitive_type) (field_identifier)))))
(field_declaration
(primitive_type)
(field_identifier)))))
=====================================
================================================================================
Explicit constructor declaration
=====================================
================================================================================
class C {
explicit C(int f);
explicit(true) C(long f);
};
---
--------------------------------------------------------------------------------
(translation_unit
(class_specifier
@@ -126,14 +162,25 @@ class C {
(field_declaration_list
(declaration
(explicit_function_specifier)
(function_declarator (identifier) (parameter_list (parameter_declaration (primitive_type) (identifier)))))
(function_declarator
(identifier)
(parameter_list
(parameter_declaration
(primitive_type)
(identifier)))))
(declaration
(explicit_function_specifier (true))
(function_declarator (identifier) (parameter_list (parameter_declaration (sized_type_specifier) (identifier))))))))
(explicit_function_specifier
(true))
(function_declarator
(identifier)
(parameter_list
(parameter_declaration
(sized_type_specifier)
(identifier))))))))
=====================================
================================================================================
Default and deleted methods
=====================================
================================================================================
class A : public B {
A() = default;
@@ -143,7 +190,7 @@ class A : public B {
A& operator=(A&&) = delete;
};
---
--------------------------------------------------------------------------------
(translation_unit
(class_specifier
@@ -153,56 +200,78 @@ class A : public B {
(type_identifier))
(field_declaration_list
(function_definition
(function_declarator (identifier) (parameter_list))
(function_declarator
(identifier)
(parameter_list))
(default_method_clause))
(function_definition
(function_declarator
(identifier)
(parameter_list (parameter_declaration (type_identifier) (abstract_reference_declarator))))
(parameter_list
(parameter_declaration
(type_identifier)
(abstract_reference_declarator))))
(delete_method_clause))
(function_definition
(primitive_type)
(function_declarator (field_identifier) (parameter_list)) (delete_method_clause))
(function_declarator
(field_identifier)
(parameter_list))
(delete_method_clause))
(function_definition
(type_identifier)
(reference_declarator
(function_declarator
(operator_name)
(parameter_list (parameter_declaration (type_qualifier) (type_identifier) (abstract_reference_declarator)))))
(parameter_list
(parameter_declaration
(type_qualifier)
(type_identifier)
(abstract_reference_declarator)))))
(default_method_clause))
(function_definition
(type_identifier)
(reference_declarator
(function_declarator
(operator_name)
(parameter_list (parameter_declaration (type_identifier) (abstract_reference_declarator)))))
(parameter_list
(parameter_declaration
(type_identifier)
(abstract_reference_declarator)))))
(delete_method_clause)))))
=====================================
================================================================================
Destructor definitions
=====================================
================================================================================
~T() {}
T::~T() {}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(function_declarator (destructor_name (identifier)) (parameter_list))
(function_declarator
(destructor_name
(identifier))
(parameter_list))
(compound_statement))
(function_definition
(function_declarator
(qualified_identifier (namespace_identifier) (destructor_name (identifier))) (parameter_list))
(qualified_identifier
(namespace_identifier)
(destructor_name
(identifier)))
(parameter_list))
(compound_statement)))
=====================================
================================================================================
Function-try-block definitions
=====================================
================================================================================
void foo() try {} catch(...) {}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -216,14 +285,13 @@ void foo() try {} catch(...) {}
(parameter_list)
(compound_statement)))))
=====================================
================================================================================
Conversion operator definitions
=====================================
================================================================================
T::operator int() try { throw 1; } catch (...) { return 2; }
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -242,4 +310,3 @@ T::operator int() try { throw 1; } catch (...) { return 2; }
(compound_statement
(return_statement
(number_literal)))))))
File diff suppressed because it is too large Load Diff
+308 -133
View File
@@ -1,23 +1,28 @@
===========================================
================================================================================
Returning braced initializer lists
===========================================
================================================================================
T main() {
return {0, 5};
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(type_identifier)
(function_declarator (identifier) (parameter_list))
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(return_statement (initializer_list (number_literal) (number_literal))))))
(return_statement
(initializer_list
(number_literal)
(number_literal))))))
===========================================
================================================================================
Range-based for loops
===========================================
================================================================================
T main() {
for (Value &value : values) {
@@ -41,7 +46,7 @@ T main() {
}
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -52,34 +57,46 @@ T main() {
body: (compound_statement
(for_range_loop
type: (type_identifier)
declarator: (reference_declarator (identifier))
declarator: (reference_declarator
(identifier))
right: (identifier)
body: (compound_statement
(expression_statement (binary_expression
left: (identifier)
right: (identifier)))))
(expression_statement
(binary_expression
left: (identifier)
right: (identifier)))))
(for_range_loop
(type_qualifier)
type: (placeholder_type_specifier (auto))
declarator: (reference_declarator (identifier))
type: (placeholder_type_specifier
(auto))
declarator: (reference_declarator
(identifier))
right: (identifier)
body: (compound_statement
(expression_statement (binary_expression
left: (identifier)
right: (identifier)))))
(expression_statement
(binary_expression
left: (identifier)
right: (identifier)))))
(for_range_loop
(type_qualifier)
type: (placeholder_type_specifier (auto))
declarator: (reference_declarator (identifier))
right: (initializer_list (number_literal) (number_literal) (number_literal))
type: (placeholder_type_specifier
(auto))
declarator: (reference_declarator
(identifier))
right: (initializer_list
(number_literal)
(number_literal)
(number_literal))
body: (compound_statement
(expression_statement (binary_expression
left: (identifier)
right: (identifier)))))
(expression_statement
(binary_expression
left: (identifier)
right: (identifier)))))
(for_range_loop
initializer: (init_statement
(declaration
type: (placeholder_type_specifier (auto))
type: (placeholder_type_specifier
(auto))
declarator: (init_declarator
declarator: (identifier)
value: (call_expression
@@ -87,7 +104,8 @@ T main() {
argument: (identifier)
field: (field_identifier))
arguments: (argument_list)))))
type: (placeholder_type_specifier (auto))
type: (placeholder_type_specifier
(auto))
declarator: (identifier)
right: (identifier)
body: (compound_statement
@@ -99,7 +117,8 @@ T main() {
left: (update_expression
argument: (identifier))
right: (identifier)))
right: (char_literal)))))
right: (char_literal
(character))))))
(for_range_loop
initializer: (init_statement
(alias_declaration
@@ -120,11 +139,12 @@ T main() {
left: (update_expression
argument: (identifier))
right: (identifier)))
right: (char_literal))))))))
right: (char_literal
(character)))))))))
===========================================
================================================================================
Constexpr if statements
===========================================
================================================================================
T f() {
if constexpr (std::is_pointer_v<T>)
@@ -133,7 +153,7 @@ T f() {
return t;
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -149,14 +169,18 @@ T f() {
name: (template_function
name: (identifier)
arguments: (template_argument_list
(type_descriptor type: (type_identifier))))))
(type_descriptor
type: (type_identifier))))))
consequence: (return_statement
(pointer_expression argument: (identifier)))
alternative: (return_statement (identifier))))))
(pointer_expression
argument: (identifier)))
alternative: (else_clause
(return_statement
(identifier)))))))
=====================================
================================================================================
If statements with declarations
====================================
================================================================================
void f() {
if (const int x = foo()) { }
@@ -164,7 +188,7 @@ void f() {
if (const int x = foo(); x != 0) { }
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -189,7 +213,10 @@ void f() {
(type_qualifier)
type: (primitive_type)
declarator: (identifier)
value: (initializer_list (call_expression function: (identifier) arguments: (argument_list)))))
value: (initializer_list
(call_expression
function: (identifier)
arguments: (argument_list)))))
consequence: (compound_statement))
(if_statement
condition: (condition_clause
@@ -199,13 +226,17 @@ void f() {
type: (primitive_type)
declarator: (init_declarator
declarator: (identifier)
value: (call_expression function: (identifier) arguments: (argument_list)))))
value: (binary_expression left: (identifier) right: (number_literal)))
value: (call_expression
function: (identifier)
arguments: (argument_list)))))
value: (binary_expression
left: (identifier)
right: (number_literal)))
consequence: (compound_statement)))))
===========================================
================================================================================
Try/catch statements
===========================================
================================================================================
void main() {
try {
@@ -219,37 +250,7 @@ void main() {
}
}
---
(translation_unit
(function_definition
(primitive_type)
(function_declarator (identifier) (parameter_list))
(compound_statement
(try_statement
(compound_statement
(expression_statement (call_expression (identifier) (argument_list))))
(catch_clause
(parameter_list (parameter_declaration (type_qualifier) (qualified_identifier (namespace_identifier) (type_identifier))))
(compound_statement (comment)))
(catch_clause
(parameter_list (parameter_declaration (type_qualifier) (type_identifier) (reference_declarator (identifier))))
(compound_statement (comment)))
(catch_clause
(parameter_list)
(compound_statement (comment)))))))
===========================================
Throw statements
===========================================
void main() {
throw e;
throw x + 1;
throw "exception";
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition
@@ -257,78 +258,161 @@ void main() {
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(throw_statement (identifier))
(throw_statement (binary_expression (identifier) (number_literal)))
(throw_statement (string_literal)))))
(compound_statement
(try_statement
(compound_statement
(expression_statement
(call_expression
(identifier)
(argument_list))))
(catch_clause
(parameter_list
(parameter_declaration
(type_qualifier)
(qualified_identifier
(namespace_identifier)
(type_identifier))))
(compound_statement
(comment)))
(catch_clause
(parameter_list
(parameter_declaration
(type_qualifier)
(type_identifier)
(reference_declarator
(identifier))))
(compound_statement
(comment)))
(catch_clause
(parameter_list)
(compound_statement
(comment)))))))
===========================================
================================================================================
Throw statements
================================================================================
void main() {
throw e;
throw x + 1;
throw "exception";
}
--------------------------------------------------------------------------------
(translation_unit
(function_definition
(primitive_type)
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(throw_statement
(identifier))
(throw_statement
(binary_expression
(identifier)
(number_literal)))
(throw_statement
(string_literal
(string_content))))))
================================================================================
Noexcept specifier
===========================================
================================================================================
void foo() noexcept;
void foo() noexcept(true);
template<class T> T foo() noexcept(sizeof(T) < 4);
---
--------------------------------------------------------------------------------
(translation_unit
(declaration
(primitive_type)
(function_declarator (identifier) (parameter_list)
(function_declarator
(identifier)
(parameter_list)
(noexcept)))
(declaration
(primitive_type)
(function_declarator (identifier) (parameter_list)
(noexcept (true))))
(function_declarator
(identifier)
(parameter_list)
(noexcept
(true))))
(template_declaration
(template_parameter_list
(type_parameter_declaration (type_identifier)))
(type_parameter_declaration
(type_identifier)))
(declaration
(type_identifier)
(function_declarator (identifier) (parameter_list)
(function_declarator
(identifier)
(parameter_list)
(noexcept
(binary_expression (sizeof_expression (parenthesized_expression (identifier))) (number_literal)))))))
(binary_expression
(sizeof_expression
(parenthesized_expression
(identifier)))
(number_literal)))))))
===========================================
================================================================================
Throw specifier
===========================================
================================================================================
void foo() throw();
void foo() throw(int);
void foo() throw(std::string, char *);
void foo() throw(float) { }
---
--------------------------------------------------------------------------------
(translation_unit
(declaration
(primitive_type)
(function_declarator (identifier) (parameter_list)
(function_declarator
(identifier)
(parameter_list)
(throw_specifier)))
(declaration
(primitive_type)
(function_declarator (identifier) (parameter_list)
(throw_specifier (type_descriptor (primitive_type)))))
(primitive_type)
(function_declarator
(identifier)
(parameter_list)
(throw_specifier
(type_descriptor
(primitive_type)))))
(declaration
(primitive_type)
(function_declarator (identifier) (parameter_list)
(function_declarator
(identifier)
(parameter_list)
(throw_specifier
(type_descriptor (qualified_identifier (namespace_identifier) (type_identifier)))
(type_descriptor (primitive_type) (abstract_pointer_declarator)))))
(type_descriptor
(qualified_identifier
(namespace_identifier)
(type_identifier)))
(type_descriptor
(primitive_type)
(abstract_pointer_declarator)))))
(function_definition
(primitive_type)
(function_declarator (identifier) (parameter_list)
(throw_specifier (type_descriptor (primitive_type))))
(compound_statement)))
(function_declarator
(identifier)
(parameter_list)
(throw_specifier
(type_descriptor
(primitive_type))))
(compound_statement)))
===========================================
================================================================================
Assignment
===========================================
================================================================================
a::b::c = 1;
---
--------------------------------------------------------------------------------
(translation_unit
(expression_statement
@@ -340,9 +424,9 @@ a::b::c = 1;
(identifier)))
(number_literal))))
=========================================
================================================================================
Attributes
=========================================
================================================================================
void f() {
[[a]] switch (b) {
@@ -359,37 +443,101 @@ void f() {
[[a]] goto label;
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition (primitive_type)
(function_declarator (identifier) (parameter_list))
(function_definition
(primitive_type)
(function_declarator
(identifier)
(parameter_list))
(compound_statement
(attributed_statement (attribute_declaration (attribute (identifier)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(switch_statement
(condition_clause (identifier))
(condition_clause
(identifier))
(compound_statement
(attributed_statement (attribute_declaration (attribute (identifier)))
(case_statement (number_literal) (compound_statement))))))
(attributed_statement (attribute_declaration (attribute (identifier))) (while_statement (condition_clause (true)) (compound_statement)))
(attributed_statement (attribute_declaration (attribute (identifier))) (if_statement (condition_clause (true)) (compound_statement)))
(attributed_statement (attribute_declaration (attribute (identifier))) (for_range_loop (placeholder_type_specifier (auto)) (identifier) (identifier) (compound_statement)))
(attributed_statement (attribute_declaration (attribute (identifier))) (for_statement (compound_statement)))
(attributed_statement (attribute_declaration (attribute (identifier))) (return_statement))
(attributed_statement (attribute_declaration (attribute (identifier))) (expression_statement (identifier)))
(attributed_statement (attribute_declaration (attribute (identifier))) (expression_statement))
(attributed_statement (attribute_declaration (attribute (identifier))) (labeled_statement (statement_identifier) (compound_statement)))
(attributed_statement (attribute_declaration (attribute (identifier))) (goto_statement (statement_identifier))))))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(case_statement
(number_literal)
(compound_statement))))))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(while_statement
(condition_clause
(true))
(compound_statement)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(if_statement
(condition_clause
(true))
(compound_statement)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(for_range_loop
(placeholder_type_specifier
(auto))
(identifier)
(identifier)
(compound_statement)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(for_statement
(compound_statement)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(return_statement))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(expression_statement
(identifier)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(expression_statement))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(labeled_statement
(statement_identifier)
(compound_statement)))
(attributed_statement
(attribute_declaration
(attribute
(identifier)))
(goto_statement
(statement_identifier))))))
===========================================
================================================================================
Coroutines
===========================================
================================================================================
co_return 1;
co_return;
co_yield 1;
---
--------------------------------------------------------------------------------
(translation_unit
(co_return_statement
@@ -398,10 +546,9 @@ co_yield 1;
(co_yield_statement
(number_literal)))
===========================================
================================================================================
Switch statements
===========================================
================================================================================
void foo(int a) {
switch (a) {
@@ -419,15 +566,43 @@ void foo(int a) {
}
}
---
--------------------------------------------------------------------------------
(translation_unit
(function_definition (primitive_type)
(function_declarator (identifier) (parameter_list (parameter_declaration (primitive_type) (identifier))))
(function_definition
(primitive_type)
(function_declarator
(identifier)
(parameter_list
(parameter_declaration
(primitive_type)
(identifier))))
(compound_statement
(switch_statement (condition_clause (identifier))
(switch_statement
(condition_clause
(identifier))
(compound_statement
(case_statement (number_literal) (for_range_loop (placeholder_type_specifier (auto)) (identifier) (identifier) (compound_statement)))
(case_statement (number_literal) (try_statement (compound_statement (comment)) (catch_clause (parameter_list) (compound_statement))) (throw_statement (number_literal)))
(case_statement (number_literal) (co_return_statement))
(case_statement (co_yield_statement (identifier))))))))
(case_statement
(number_literal)
(for_range_loop
(placeholder_type_specifier
(auto))
(identifier)
(identifier)
(compound_statement)))
(case_statement
(number_literal)
(try_statement
(compound_statement
(comment))
(catch_clause
(parameter_list)
(compound_statement)))
(throw_statement
(number_literal)))
(case_statement
(number_literal)
(co_return_statement))
(case_statement
(co_yield_statement
(identifier))))))))