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