diff --git a/unified/AGENTS.md b/unified/AGENTS.md index 44cb74372883..488a94f44bd4 100644 --- a/unified/AGENTS.md +++ b/unified/AGENTS.md @@ -5,6 +5,21 @@ This is a CodeQL extractor based on tree-sitter. ## Building To build the extractor, run `scripts/create-extractor-pack.sh` +## Editing the Swift grammar +The vendored tree-sitter-swift grammar lives at +`extractor/tree-sitter-swift/`. After editing `grammar.js` (or any other +grammar source), run `scripts/regenerate-grammar.sh` to: +- regenerate `extractor/tree-sitter-swift/src/{parser.c, grammar.json, + node-types.json}` (and the `src/tree_sitter/*.h` headers) via + `tree-sitter generate`; and +- refresh `extractor/tree-sitter-swift/node-types.yml`, the + human-readable companion to `src/node-types.json` produced by yeast's + `node_types_yaml` binary. + +`node-types.yml` is the recommended review surface for grammar changes — +it shows the impact of a grammar tweak on the named node kinds, fields, +and child types in a form much easier to read than the raw JSON. + ## Testing - If you changed the extractor code, always rebuild it before running tests. diff --git a/unified/extractor/tree-sitter-swift/grammar.js b/unified/extractor/tree-sitter-swift/grammar.js index 5f4e85547ad4..5dbfd7fdbbf2 100644 --- a/unified/extractor/tree-sitter-swift/grammar.js +++ b/unified/extractor/tree-sitter-swift/grammar.js @@ -84,18 +84,26 @@ if (tree_sitter_version_supports_emoji()) { module.exports = grammar({ name: "swift", + supertypes: ($) => [ + $.expression, + $.unannotated_type, + $.global_declaration, + $.type_level_declaration, + $.local_declaration, + $.protocol_member_declaration, + ], conflicts: ($) => [ // @Type(... could either be an annotation constructor invocation or an annotated expression [$.attribute], [$._attribute_argument], // Is `foo { ... }` a constructor invocation or function invocation? - [$._simple_user_type, $._expression], + [$._simple_user_type, $.expression], // To support nested types A.B not being interpreted as `(navigation_expression ... (type_identifier)) (navigation_suffix)` [$.user_type], // How to tell the difference between Foo.bar(with:and:), and Foo.bar(with: smth, and: other)? You need GLR [$.value_argument], // { (foo, bar) ... - [$._expression, $.lambda_parameter], + [$.expression, $.lambda_parameter], [$._primary_expression, $.lambda_parameter], // (start: start, end: end) [$._tuple_type_item_identifier, $.tuple_expression], @@ -105,10 +113,10 @@ module.exports = grammar({ // `+(...)` is ambigously either "call the function produced by a reference to the operator `+`" or "use the unary // operator `+` on the result of the parenthetical expression." [$._additive_operator, $._prefix_unary_operator], - [$._referenceable_operator, $._prefix_unary_operator], + [$.referenceable_operator, $._prefix_unary_operator], // `{ [self, b, c] ...` could be a capture list or an array literal depending on what else happens. - [$.capture_list_item, $._expression], - [$.capture_list_item, $._expression, $._simple_user_type], + [$.capture_list_item, $.expression], + [$.capture_list_item, $.expression, $._simple_user_type], [$._primary_expression, $.capture_list_item], // a ? b : c () could be calling c(), or it could be calling a function that's produced by the result of // `(a ? b : c)`. We have a small hack to force it to be the former of these by intentionally introducing a @@ -119,10 +127,10 @@ module.exports = grammar({ // `if try foo { } ...` should award its braces to the `if`. In order to make this actually happen, we need to parse // all the options and pick the best one that doesn't error out. [$.try_expression, $._unary_expression], - [$.try_expression, $._expression], + [$.try_expression, $.expression], // await {expression} has the same special cases as `try`. [$.await_expression, $._unary_expression], - [$.await_expression, $._expression], + [$.await_expression, $.expression], // In a computed property, when you see an @attribute, it's not yet clear if that's going to be for a // locally-declared class or a getter / setter specifier. [ @@ -400,13 +408,15 @@ module.exports = grammar({ type_annotation: ($) => seq(":", field("type", $._possibly_implicitly_unwrapped_type)), _possibly_implicitly_unwrapped_type: ($) => - seq($._type, optional(token.immediate("!"))), - _type: ($) => + choice($.type, $.implicitly_unwrapped_type), + implicitly_unwrapped_type: ($) => + seq($.type, token.immediate("!")), + type: ($) => prec.right( PRECS.ty, - seq(optional($.type_modifiers), field("name", $._unannotated_type)) + seq(field("modifiers", optional($.type_modifiers)), field("name", $.unannotated_type)) ), - _unannotated_type: ($) => + unannotated_type: ($) => prec.right( PRECS.ty, choice( @@ -450,7 +460,7 @@ module.exports = grammar({ seq( optional($._tuple_type_item_identifier), optional($.parameter_modifiers), - field("type", $._type) + field("type", $.type) ) ), _tuple_type_item_identifier: ($) => @@ -464,15 +474,15 @@ module.exports = grammar({ ), function_type: ($) => seq( - field("params", choice($.tuple_type, $._unannotated_type)), + field("params", choice($.tuple_type, $.unannotated_type)), optional($._async_keyword), optional(choice($.throws_clause, $.throws)), $._arrow_operator, - field("return_type", $._type) + field("return_type", $.type) ), - array_type: ($) => seq("[", field("element", $._type), "]"), + array_type: ($) => seq("[", field("element", $.type), "]"), dictionary_type: ($) => - seq("[", field("key", $._type), ":", field("value", $._type), "]"), + seq("[", field("key", $.type), ":", field("value", $.type), "]"), optional_type: ($) => prec.left( seq( @@ -483,18 +493,18 @@ module.exports = grammar({ repeat1(alias($._immediate_quest, "?")) ) ), - metatype: ($) => seq($._unannotated_type, ".", choice("Type", "Protocol")), + metatype: ($) => seq($.unannotated_type, ".", choice("Type", "Protocol")), _quest: ($) => "?", _immediate_quest: ($) => token.immediate("?"), - opaque_type: ($) => prec.right(seq("some", $._unannotated_type)), - existential_type: ($) => prec.right(seq("any", $._unannotated_type)), - type_parameter_pack: ($) => prec.left(seq("each", $._unannotated_type)), - type_pack_expansion: ($) => prec.left(seq("repeat", $._unannotated_type)), + opaque_type: ($) => prec.right(seq("some", $.unannotated_type)), + existential_type: ($) => prec.right(seq("any", $.unannotated_type)), + type_parameter_pack: ($) => prec.left(seq("each", $.unannotated_type)), + type_pack_expansion: ($) => prec.left(seq("repeat", $.unannotated_type)), protocol_composition_type: ($) => prec.left( seq( - $._unannotated_type, - repeat1(seq("&", prec.right($._unannotated_type))) + $.unannotated_type, + repeat1(seq("&", prec.right($.unannotated_type))) ) ), suppressed_constraint: ($) => @@ -507,7 +517,7 @@ module.exports = grammar({ //////////////////////////////// // Expressions - https://docs.swift.org/swift-book/ReferenceManual/Expressions.html //////////////////////////////// - _expression: ($) => + expression: ($) => prec( PRECS.expr, choice( @@ -521,9 +531,11 @@ module.exports = grammar({ $.assignment, $.value_parameter_pack, $.value_pack_expansion, - seq($._expression, alias($._immediate_quest, "?")) + $.optional_chain_marker ) ), + optional_chain_marker: ($) => + seq($.expression, alias($._immediate_quest, "?")), // Unary expressions _unary_expression: ($) => choice( @@ -544,7 +556,7 @@ module.exports = grammar({ prec.left( PRECS.postfix_operations, seq( - field("target", $._expression), + field("target", $.expression), field("operation", $._postfix_unary_operator) ) ), @@ -562,10 +574,7 @@ module.exports = grammar({ _parenthesized_type: ($) => seq( "(", - field( - "element", - choice($.opaque_type, $.existential_type, $.dictionary_type) - ), + choice($.opaque_type, $.existential_type, $.dictionary_type), ")" ), navigation_expression: ($) => @@ -576,7 +585,7 @@ module.exports = grammar({ "target", choice( $._navigable_type_expression, - $._expression, + $.expression, $._parenthesized_type ) ), @@ -590,7 +599,7 @@ module.exports = grammar({ PRECS.range, seq( $._range_operator, - prec.right(PRECS.range_suffix, field("end", $._expression)) + prec.right(PRECS.range_suffix, field("end", $.expression)) ) ), _range_operator: ($) => @@ -598,7 +607,7 @@ module.exports = grammar({ open_end_range_expression: ($) => prec.right( PRECS.range, - seq(field("start", $._expression), $._three_dot_operator) + seq(field("start", $.expression), $._three_dot_operator) ), prefix_expression: ($) => prec.left( @@ -608,8 +617,8 @@ module.exports = grammar({ field( "target", choice( - $._expression, - alias(choice("async", "if", "switch"), $._expression) + $.expression, + alias(choice("async", "if", "switch"), $.expression) ) ) ) @@ -617,7 +626,7 @@ module.exports = grammar({ as_expression: ($) => prec.left( PRECS.as, - seq(field("expr", $._expression), $.as_operator, field("type", $._type)) + seq(field("expr", $.expression), $.as_operator, field("type", $.type)) ), selector_expression: ($) => seq( @@ -625,7 +634,7 @@ module.exports = grammar({ "selector", "(", optional(choice("getter:", "setter:")), - $._expression, + $.expression, ")" ), // Binary expressions @@ -647,25 +656,25 @@ module.exports = grammar({ prec.left( PRECS.multiplication, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._multiplicative_operator), - field("rhs", $._expression) + field("rhs", $.expression) ) ), additive_expression: ($) => prec.left( PRECS.addition, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._additive_operator), - field("rhs", $._expression) + field("rhs", $.expression) ) ), range_expression: ($) => prec.right( PRECS.range, seq( - field("start", $._expression), + field("start", $.expression), field("op", $._range_operator), field("end", $._expr_hack_at_ternary_binary_suffix) ) @@ -674,7 +683,7 @@ module.exports = grammar({ prec.left( PRECS.infix_operations, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $.custom_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -683,7 +692,7 @@ module.exports = grammar({ prec.right( PRECS.nil_coalescing, seq( - field("value", $._expression), + field("value", $.expression), $._nil_coalescing_operator, field("if_nil", $._expr_hack_at_ternary_binary_suffix) ) @@ -692,15 +701,15 @@ module.exports = grammar({ prec.left( PRECS.check, seq( - field("target", $._expression), + field("target", $.expression), field("op", $._is_operator), - field("type", $._type) + field("type", $.type) ) ), comparison_expression: ($) => prec.left( seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._comparison_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -709,7 +718,7 @@ module.exports = grammar({ prec.left( PRECS.equality, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._equality_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -718,7 +727,7 @@ module.exports = grammar({ prec.left( PRECS.conjunction, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._conjunction_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -727,7 +736,7 @@ module.exports = grammar({ prec.left( PRECS.disjunction, seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._disjunction_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -735,7 +744,7 @@ module.exports = grammar({ bitwise_operation: ($) => prec.left( seq( - field("lhs", $._expression), + field("lhs", $.expression), field("op", $._bitwise_binary_operator), field("rhs", $._expr_hack_at_ternary_binary_suffix) ) @@ -772,7 +781,7 @@ module.exports = grammar({ seq("(", optional(sep1Opt($.value_argument, ",")), ")"), _fn_call_lambda_arguments: ($) => sep1($.lambda_literal, seq(field("name", $.simple_identifier), ":")), - type_arguments: ($) => prec.left(seq("<", sep1Opt($._type, ","), ">")), + type_arguments: ($) => prec.left(seq("<", sep1Opt($.type, ","), ">")), value_arguments: ($) => seq( choice( @@ -800,7 +809,7 @@ module.exports = grammar({ ), seq( optional(seq(field("name", $.value_argument_label), ":")), - field("value", $._expression) + field("value", $.expression) ) ) ) @@ -816,7 +825,7 @@ module.exports = grammar({ // Prefer direct calls, e.g. `try foo()`, over indirect like `try a ? b() : c`. This allows us to have // left associativity for the direct calls, which is technically wrong but is the only way to resolve the // ambiguity of `if foo { ... }` in the correct direction. - prec.right(-2, $._expression), + prec.right(-2, $.expression), prec.left(0, $._binary_expression), prec.left(0, $.call_expression), // Similarly special case the ternary expression, where `try` may come earlier than it is actually needed. @@ -838,7 +847,7 @@ module.exports = grammar({ "expr", choice( // Prefer direct calls over indirect (same as with `try`). - prec.right(-2, $._expression), + prec.right(-2, $.expression), prec.left(0, $.call_expression), // Special case ternary to `await` the whole thing (same as with `try`). prec.dynamic(1, prec.left(-1, $.ternary_expression)) @@ -851,9 +860,9 @@ module.exports = grammar({ prec.right( PRECS.ternary, seq( - field("condition", $._expression), + field("condition", $.expression), $._quest, - field("if_true", $._expression), + field("if_true", $.expression), ":", field("if_false", $._expr_hack_at_ternary_binary_suffix) ) @@ -862,13 +871,13 @@ module.exports = grammar({ prec.left( PRECS.ternary_binary_suffix, choice( - $._expression, + $.expression, alias($.expr_hack_at_ternary_binary_call, $.call_expression) ) ), expr_hack_at_ternary_binary_call: ($) => seq( - $._expression, + $.expression, alias($.expr_hack_at_ternary_binary_call_suffix, $.call_suffix) ), expr_hack_at_ternary_binary_call_suffix: ($) => @@ -876,7 +885,7 @@ module.exports = grammar({ call_expression: ($) => prec( PRECS.call, - prec.dynamic(DYNAMIC_PRECS.call, seq($._expression, $.call_suffix)) + prec.dynamic(DYNAMIC_PRECS.call, seq($.expression, $.call_suffix)) ), macro_invocation: ($) => prec( @@ -904,7 +913,7 @@ module.exports = grammar({ $.super_expression, $.try_expression, $.await_expression, - $._referenceable_operator, + $.referenceable_operator, $.key_path_expression, $.key_path_string_expression, prec.right( @@ -920,7 +929,7 @@ module.exports = grammar({ sep1Opt( seq( optional(seq(field("name", $.simple_identifier), ":")), - field("value", $._expression) + field("value", $.expression) ), "," ), @@ -928,7 +937,7 @@ module.exports = grammar({ ) ), array_literal: ($) => - seq("[", optional(sep1Opt(field("element", $._expression), ",")), "]"), + seq("[", optional(sep1Opt(field("element", $.expression), ",")), "]"), dictionary_literal: ($) => seq( "[", @@ -937,7 +946,7 @@ module.exports = grammar({ "]" ), _dictionary_literal_item: ($) => - seq(field("key", $._expression), ":", field("value", $._expression)), + seq(field("key", $.expression), ":", field("value", $.expression)), special_literal: ($) => seq( $._hash_symbol, @@ -956,7 +965,7 @@ module.exports = grammar({ $._hash_symbol, choice("colorLiteral", "fileLiteral", "imageLiteral"), "(", - sep1Opt(seq($.simple_identifier, ":", $._expression), ","), + sep1Opt(seq($.simple_identifier, ":", $.expression), ","), ")" ), lambda_literal: ($) => @@ -985,7 +994,7 @@ module.exports = grammar({ seq( optional($.ownership_modifier), field("name", $.simple_identifier), - optional(seq($._equal_sign, field("value", $._expression))) + optional(seq($._equal_sign, field("value", $.expression))) ) ) ), @@ -1033,17 +1042,17 @@ module.exports = grammar({ PRECS["if"], seq( "if", - sep1(field("condition", $._if_condition_sequence_item), ","), + sep1(field("condition", $.if_condition), ","), $._block, optional(seq($["else"], $._else_options)) ) ), - _if_condition_sequence_item: ($) => - choice($._if_let_binding, $._expression, $.availability_condition), - _if_let_binding: ($) => + if_condition: ($) => + choice($.if_let_binding, $.expression, $.availability_condition), + if_let_binding: ($) => seq( $._direct_or_indirect_binding, - optional(seq($._equal_sign, $._expression)), + optional(seq($._equal_sign, $.expression)), optional($.where_clause) ), guard_statement: ($) => @@ -1051,7 +1060,7 @@ module.exports = grammar({ PRECS["if"], seq( "guard", - sep1(field("condition", $._if_condition_sequence_item), ","), + sep1(field("condition", $.if_condition), ","), $["else"], $._block ) @@ -1061,7 +1070,7 @@ module.exports = grammar({ PRECS["switch"], seq( "switch", - field("expr", $._expression), + field("expr", $.expression), "{", repeat($.switch_entry), "}" @@ -1075,7 +1084,7 @@ module.exports = grammar({ "case", seq( $.switch_pattern, - optional(seq($.where_keyword, $._expression)) + optional(seq($.where_keyword, $.expression)) ), repeat(seq(",", $.switch_pattern)) ), @@ -1095,7 +1104,7 @@ module.exports = grammar({ optional($.where_clause), $._block ), - where_clause: ($) => prec.left(seq($.where_keyword, $._expression)), + where_clause: ($) => prec.left(seq($.where_keyword, $.expression)), key_path_expression: ($) => prec.right( PRECS.keypath, @@ -1108,7 +1117,7 @@ module.exports = grammar({ ) ), key_path_string_expression: ($) => - prec.left(seq($._hash_symbol, "keyPath", "(", $._expression, ")")), + prec.left(seq($._hash_symbol, "keyPath", "(", $.expression, ")")), _key_path_component: ($) => prec.left( choice( @@ -1164,7 +1173,7 @@ module.exports = grammar({ ), _bitwise_binary_operator: ($) => choice("&", "|", "^", "<<", ">>"), _postfix_unary_operator: ($) => choice("++", "--", $.bang), - directly_assignable_expression: ($) => $._expression, + directly_assignable_expression: ($) => $.expression, //////////////////////////////// // Statements - https://docs.swift.org/swift-book/ReferenceManual/Statements.html @@ -1180,15 +1189,15 @@ module.exports = grammar({ ), _local_statement: ($) => choice( - $._expression, - $._local_declaration, + $.expression, + $.local_declaration, $._labeled_statement, $.control_transfer_statement ), _top_level_statement: ($) => choice( - $._expression, - $._global_declaration, + $.expression, + $.global_declaration, $._labeled_statement, $._throw_statement ), @@ -1227,15 +1236,15 @@ module.exports = grammar({ // the opposite, though, since function calls may contain trailing code blocks, which are undesirable here. // // To fix that, we simply undo the special casing by defining our own `await_expression`. - choice($._expression, alias($.for_statement_await, $.await_expression)), - for_statement_await: ($) => seq($._await_operator, $._expression), + choice($.expression, alias($.for_statement_await, $.await_expression)), + for_statement_await: ($) => seq($._await_operator, $.expression), while_statement: ($) => prec( PRECS.loop, seq( "while", - sep1(field("condition", $._if_condition_sequence_item), ","), + sep1(field("condition", $.if_condition), ","), "{", optional($.statements), "}" @@ -1252,7 +1261,7 @@ module.exports = grammar({ // Make sure we make it to the `while` before assuming this is a parameter pack. repeat($._implicit_semi), "while", - sep1(field("condition", $._if_condition_sequence_item), ",") + sep1(field("condition", $.if_condition), ",") ) ), control_transfer_statement: ($) => @@ -1262,11 +1271,11 @@ module.exports = grammar({ PRECS.control_transfer, seq( $._optionally_valueful_control_keyword, - field("result", optional($._expression)) + field("result", optional($.expression)) ) ) ), - _throw_statement: ($) => seq($.throw_keyword, $._expression), + _throw_statement: ($) => seq($.throw_keyword, $.expression), throw_keyword: ($) => "throw", _optionally_valueful_control_keyword: ($) => choice("return", "continue", "break", "yield"), @@ -1276,13 +1285,13 @@ module.exports = grammar({ seq( field("target", $.directly_assignable_expression), field("operator", $._assignment_and_operator), - field("result", $._expression) + field("result", $.expression) ) ), value_parameter_pack: ($) => - prec.left(PRECS.parameter_pack, seq("each", $._expression)), + prec.left(PRECS.parameter_pack, seq("each", $.expression)), value_pack_expansion: ($) => - prec.left(PRECS.parameter_pack, seq("repeat", $._expression)), + prec.left(PRECS.parameter_pack, seq("repeat", $.expression)), availability_condition: ($) => seq( $._hash_symbol, @@ -1296,7 +1305,7 @@ module.exports = grammar({ //////////////////////////////// // Declarations - https://docs.swift.org/swift-book/ReferenceManual/Declarations.html //////////////////////////////// - _global_declaration: ($) => + global_declaration: ($) => choice( $.import_declaration, $.property_declaration, @@ -1310,7 +1319,7 @@ module.exports = grammar({ $.associatedtype_declaration, $.macro_declaration ), - _type_level_declaration: ($) => + type_level_declaration: ($) => choice( $.import_declaration, $.property_declaration, @@ -1325,7 +1334,7 @@ module.exports = grammar({ $.precedence_group_declaration, $.associatedtype_declaration ), - _local_declaration: ($) => + local_declaration: ($) => choice( alias($._local_property_declaration, $.property_declaration), alias($._local_typealias_declaration, $.typealias_declaration), @@ -1412,12 +1421,12 @@ module.exports = grammar({ 1, seq( $._equal_sign, - field("value", $._expression), + field("value", $.expression), $.willset_didset_block ) ), _expression_without_willset_didset: ($) => - seq($._equal_sign, field("value", $._expression)), + seq($._equal_sign, field("value", $.expression)), willset_didset_block: ($) => choice( seq("{", $.willset_clause, optional($.didset_clause), "}"), @@ -1445,7 +1454,7 @@ module.exports = grammar({ field("name", alias($.simple_identifier, $.type_identifier)), optional($.type_parameters), $._equal_sign, - field("value", $._type) + field("value", $.type) ), function_declaration: ($) => prec.right( @@ -1495,12 +1504,12 @@ module.exports = grammar({ _macro_signature: ($) => seq( $._function_value_parameters, - optional(seq($._arrow_operator, $._unannotated_type)) + optional(seq($._arrow_operator, $.unannotated_type)) ), macro_definition: ($) => seq( $._equal_sign, - field("body", choice($._expression, $.external_macro_definition)) + field("body", choice($.expression, $.external_macro_definition)) ), external_macro_definition: ($) => @@ -1521,7 +1530,7 @@ module.exports = grammar({ ), seq( field("declaration_kind", "extension"), - field("name", $._unannotated_type), + field("name", $.unannotated_type), optional($.type_parameters), optional(seq(":", $._inheritance_specifiers)), optional($.type_constraints), @@ -1561,7 +1570,7 @@ module.exports = grammar({ seq( optional($.type_parameter_modifiers), $._type_parameter_possibly_packed, - optional(seq(":", $._type)) + optional(seq(":", $.type)) ), _type_parameter_possibly_packed: ($) => choice( @@ -1585,20 +1594,18 @@ module.exports = grammar({ repeat($.attribute), field("constrained_type", $._constrained_type), choice($._equal_sign, $._eq_eq), - field("must_equal", $._type) + field("must_equal", $.type) ), - _constrained_type: ($) => - choice( - $.identifier, - seq( - $._unannotated_type, - optional(seq(".", sep1($.simple_identifier, "."))) - ) + _constrained_type: ($) => choice($.identifier, $.nested_type_identifier), + nested_type_identifier: ($) => + seq( + $.unannotated_type, + optional(seq(".", sep1($.simple_identifier, "."))) ), _class_member_separator: ($) => choice($._semi, $.multiline_comment), _class_member_declarations: ($) => seq( - sep1($._type_level_declaration, $._class_member_separator), + sep1($.type_level_declaration, $._class_member_separator), optional($._class_member_separator) ), _function_value_parameters: ($) => @@ -1609,7 +1616,7 @@ module.exports = grammar({ seq( optional($.attribute), $.parameter, - optional(seq($._equal_sign, field("default_value", $._expression))) + optional(seq($._equal_sign, field("default_value", $.expression))) ), parameter: ($) => seq( @@ -1623,16 +1630,15 @@ module.exports = grammar({ _non_constructor_function_decl: ($) => seq( "func", - field("name", choice($.simple_identifier, $._referenceable_operator)) + field("name", choice($.simple_identifier, $.referenceable_operator)) ), - _referenceable_operator: ($) => + referenceable_operator: ($) => choice( $.custom_operator, $._comparison_operator, $._additive_operator, $._multiplicative_operator, $._equality_operator, - $._comparison_operator, $._assignment_and_operator, "++", "--", @@ -1665,9 +1671,9 @@ module.exports = grammar({ _async_modifier: ($) => token("async"), throws: ($) => choice($._throws_keyword, $._rethrows_keyword), throws_clause: ($) => - seq($._throws_keyword, "(", field("type", $._unannotated_type), ")"), + seq($._throws_keyword, "(", field("type", $.unannotated_type), ")"), enum_class_body: ($) => - seq("{", repeat(choice($.enum_entry, $._type_level_declaration)), "}"), + seq("{", repeat(choice($.enum_entry, $.type_level_declaration)), "}"), enum_entry: ($) => seq( optional($.modifiers), @@ -1685,7 +1691,7 @@ module.exports = grammar({ _enum_entry_suffix: ($) => choice( field("data_contents", $.enum_type_parameters), - seq($._equal_sign, field("raw_value", $._expression)) + seq($._equal_sign, field("raw_value", $.expression)) ), enum_type_parameters: ($) => seq( @@ -1696,8 +1702,8 @@ module.exports = grammar({ optional( seq(optional($.wildcard_pattern), $.simple_identifier, ":") ), - $._type, - optional(seq($._equal_sign, $._expression)) + $.type, + optional(seq($._equal_sign, $.expression)) ), "," ) @@ -1719,16 +1725,10 @@ module.exports = grammar({ protocol_body: ($) => seq("{", optional($._protocol_member_declarations), "}"), _protocol_member_declarations: ($) => - seq(sep1($._protocol_member_declaration, $._semi), optional($._semi)), - _protocol_member_declaration: ($) => + seq(sep1($.protocol_member_declaration, $._semi), optional($._semi)), + protocol_member_declaration: ($) => choice( - alias( - seq( - $._bodyless_function_declaration, - optional(field("body", $.function_body)) - ), - $.protocol_function_declaration - ), + $.protocol_function_declaration, $.init_declaration, $.deinit_declaration, $.protocol_property_declaration, @@ -1736,6 +1736,11 @@ module.exports = grammar({ $.associatedtype_declaration, $.subscript_declaration ), + protocol_function_declaration: ($) => + seq( + $._bodyless_function_declaration, + optional(field("body", $.function_body)) + ), init_declaration: ($) => prec.right( seq( @@ -1804,7 +1809,7 @@ module.exports = grammar({ seq( choice("prefix", "infix", "postfix"), "operator", - $._referenceable_operator, + $.referenceable_operator, optional(seq(":", $.simple_identifier)), optional($.deprecated_operator_declaration_body) ), @@ -1831,9 +1836,9 @@ module.exports = grammar({ optional($.modifiers), "associatedtype", field("name", alias($.simple_identifier, $.type_identifier)), - optional(seq(":", field("must_inherit", $._type))), + optional(seq(":", field("must_inherit", $.type))), optional($.type_constraints), - optional(seq($._equal_sign, field("default_value", $._type))) + optional(seq($._equal_sign, field("default_value", $.type))) ), //////////////////////////////// // Attributes - https://docs.swift.org/swift-book/ReferenceManual/Attributes.html @@ -1848,9 +1853,9 @@ module.exports = grammar({ _attribute_argument: ($) => choice( // labeled function parameters, used in custom property wrappers - seq($.simple_identifier, ":", $._expression), + seq($.simple_identifier, ":", $.expression), // Unlabeled function parameters, simple identifiers, or `*` - $._expression, + $.expression, // References to param names (used in `@objc(foo:bar:)`) repeat1(seq($.simple_identifier, ":")), // Version restrictions (iOS 3.4.5, Swift 5.0.0) @@ -1887,13 +1892,13 @@ module.exports = grammar({ choice( $._universally_allowed_pattern, $._binding_pattern, - $._expression + $.expression ), optional($._quest) ), _non_binding_pattern_with_expr: ($) => seq( - choice($._universally_allowed_pattern, $._expression), + choice($._universally_allowed_pattern, $.expression), optional($._quest) ), _direct_or_indirect_binding: ($) => @@ -1932,8 +1937,8 @@ module.exports = grammar({ ), _type_casting_pattern: ($) => choice( - seq("is", $._type), - seq(alias($._binding_pattern_no_expr, $.pattern), $._as, $._type) + seq("is", $.type), + seq(alias($._binding_pattern_no_expr, $.pattern), $._as, $.type) ), _binding_pattern: ($) => seq( diff --git a/unified/extractor/tree-sitter-swift/node-types.yml b/unified/extractor/tree-sitter-swift/node-types.yml new file mode 100644 index 000000000000..c4bf650944b2 --- /dev/null +++ b/unified/extractor/tree-sitter-swift/node-types.yml @@ -0,0 +1,728 @@ +supertypes: + expression: + - additive_expression + - array_literal + - as_expression + - assignment + - await_expression + - bin_literal + - bitwise_operation + - boolean_literal + - call_expression + - check_expression + - comparison_expression + - conjunction_expression + - constructor_expression + - diagnostic + - dictionary_literal + - directive + - disjunction_expression + - equality_expression + - fully_open_range + - hex_literal + - if_statement + - infix_expression + - integer_literal + - key_path_expression + - key_path_string_expression + - lambda_literal + - line_string_literal + - macro_invocation + - multi_line_string_literal + - multiplicative_expression + - navigation_expression + - "nil" + - nil_coalescing_expression + - oct_literal + - open_end_range_expression + - open_start_range_expression + - optional_chain_marker + - playground_literal + - postfix_expression + - prefix_expression + - range_expression + - raw_string_literal + - real_literal + - referenceable_operator + - regex_literal + - selector_expression + - self_expression + - simple_identifier + - special_literal + - super_expression + - switch_statement + - ternary_expression + - try_expression + - tuple_expression + - value_pack_expansion + - value_parameter_pack + global_declaration: + - associatedtype_declaration + - class_declaration + - function_declaration + - import_declaration + - init_declaration + - macro_declaration + - operator_declaration + - precedence_group_declaration + - property_declaration + - protocol_declaration + - typealias_declaration + local_declaration: + - class_declaration + - function_declaration + - property_declaration + - typealias_declaration + protocol_member_declaration: + - associatedtype_declaration + - deinit_declaration + - init_declaration + - protocol_function_declaration + - protocol_property_declaration + - subscript_declaration + - typealias_declaration + type_level_declaration: + - associatedtype_declaration + - class_declaration + - deinit_declaration + - function_declaration + - import_declaration + - init_declaration + - operator_declaration + - precedence_group_declaration + - property_declaration + - protocol_declaration + - subscript_declaration + - typealias_declaration + unannotated_type: + - array_type + - dictionary_type + - existential_type + - function_type + - metatype + - opaque_type + - optional_type + - protocol_composition_type + - suppressed_constraint + - tuple_type + - type_pack_expansion + - type_parameter_pack + - user_type + +named: + additive_expression: + lhs: expression + op: ["+", "-"] + rhs: expression + array_literal: + element*: expression + array_type: + element: type + as_expression: + $children: as_operator + expr: expression + type: type + as_operator: + assignment: + operator: ["%=", "*=", "+=", "-=", "/=", "="] + result: expression + target: directly_assignable_expression + associatedtype_declaration: + $children*: [modifiers, type_constraints] + default_value?: type + must_inherit?: type + name: type_identifier + attribute: + $children+: [expression, user_type] + availability_condition: + $children*: [identifier, integer_literal] + await_expression: + $children?: expression + expr?: expression + bang: + bin_literal: + bitwise_operation: + lhs: expression + op: ["&", "<<", ">>", "^", "|"] + rhs: expression + boolean_literal: + call_expression: + $children+: [call_suffix, expression] + call_suffix: + $children+: [lambda_literal, value_arguments] + name*: simple_identifier + capture_list: + $children+: capture_list_item + capture_list_item: + $children?: ownership_modifier + name: [self_expression, simple_identifier] + value?: expression + catch_block: + $children+: [catch_keyword, statements, where_clause] + error?: pattern + catch_keyword: + check_expression: + op: "is" + target: expression + type: type + class_body: + $children*: [multiline_comment, type_level_declaration] + class_declaration: + $children*: [attribute, inheritance_modifier, inheritance_specifier, modifiers, ownership_modifier, property_behavior_modifier, type_constraints, type_parameters] + body: [class_body, enum_class_body] + declaration_kind: ["actor", "class", "enum", "extension", "struct"] + name: [type_identifier, unannotated_type] + comment: + comparison_expression: + lhs: expression + op: ["<", "<=", ">", ">="] + rhs: expression + computed_getter: + $children+: [attribute, getter_specifier, statements] + computed_modify: + $children+: [attribute, modify_specifier, statements] + computed_property: + $children*: [computed_getter, computed_modify, computed_setter, statements] + computed_setter: + $children+: [attribute, setter_specifier, simple_identifier, statements] + conjunction_expression: + lhs: expression + op: "&&" + rhs: expression + constructor_expression: + $children: constructor_suffix + constructed_type: [array_type, dictionary_type, user_type] + constructor_suffix: + $children+: [lambda_literal, value_arguments] + name*: simple_identifier + control_transfer_statement: + $children*: [expression, throw_keyword] + result?: expression + custom_operator: + default_keyword: + deinit_declaration: + $children?: modifiers + body: function_body + deprecated_operator_declaration_body: + $children*: [bin_literal, boolean_literal, hex_literal, integer_literal, line_string_literal, multi_line_string_literal, oct_literal, raw_string_literal, real_literal, regex_literal, simple_identifier] + diagnostic: + dictionary_literal: + key*: expression + value*: expression + dictionary_type: + key: type + value: type + didset_clause: + $children*: [modifiers, simple_identifier, statements] + directive: + $children*: [boolean_literal, integer_literal, simple_identifier] + directly_assignable_expression: + $children: expression + disjunction_expression: + lhs: expression + op: "||" + rhs: expression + do_statement: + $children*: [catch_block, statements] + else: + enum_class_body: + $children*: [enum_entry, type_level_declaration] + enum_entry: + $children?: modifiers + data_contents*: enum_type_parameters + name+: simple_identifier + raw_value*: expression + enum_type_parameters: + $children*: [expression, type, wildcard_pattern] + equality_constraint: + $children*: attribute + constrained_type: [identifier, nested_type_identifier] + must_equal: type + equality_expression: + lhs: expression + op: ["!=", "!==", "==", "==="] + rhs: expression + existential_type: + $children: unannotated_type + external_macro_definition: + $children: value_arguments + for_statement: + $children*: [statements, try_operator, type_annotation, where_clause] + collection: expression + item: pattern + fully_open_range: + function_body: + $children?: statements + function_declaration: + $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, parameter, property_behavior_modifier, throws, throws_clause, type_constraints, type_parameters] + body: function_body + default_value*: expression + name: [referenceable_operator, simple_identifier] + return_type?: [implicitly_unwrapped_type, type] + function_modifier: + function_type: + $children?: [throws, throws_clause] + params: unannotated_type + return_type: type + getter_specifier: + $children*: [mutation_modifier, throws, throws_clause] + guard_statement: + $children+: [else, statements] + condition+: if_condition + hex_literal: + identifier: + $children+: simple_identifier + if_condition: + $children: [availability_condition, expression, if_let_binding] + if_let_binding: + $children*: [expression, pattern, type, type_annotation, user_type, value_binding_pattern, where_clause, wildcard_pattern] + bound_identifier?: simple_identifier + if_statement: + $children*: [else, if_statement, statements] + condition+: if_condition + implicitly_unwrapped_type: + $children: type + import_declaration: + $children+: [identifier, modifiers] + infix_expression: + lhs: expression + op: custom_operator + rhs: expression + inheritance_constraint: + $children*: attribute + constrained_type: [identifier, nested_type_identifier] + inherits_from: [implicitly_unwrapped_type, type] + inheritance_modifier: + inheritance_specifier: + inherits_from: [function_type, suppressed_constraint, user_type] + init_declaration: + $children*: [attribute, bang, modifiers, parameter, throws, throws_clause, type_constraints, type_parameters] + body?: function_body + default_value*: expression + name: "init" + integer_literal: + interpolated_expression: + $children?: type_modifiers + name?: value_argument_label + reference_specifier*: value_argument_label + value?: expression + key_path_expression: + $children*: [array_type, bang, dictionary_type, simple_identifier, type_arguments, type_identifier, value_argument] + key_path_string_expression: + $children: expression + lambda_function_type: + $children*: [lambda_function_type_parameters, throws, throws_clause] + return_type?: [implicitly_unwrapped_type, type] + lambda_function_type_parameters: + $children+: lambda_parameter + lambda_literal: + $children*: [attribute, statements] + captures?: capture_list + type?: lambda_function_type + lambda_parameter: + $children?: [parameter_modifiers, self_expression] + external_name?: simple_identifier + name?: simple_identifier + type?: [implicitly_unwrapped_type, type] + line_str_text: + line_string_literal: + interpolation*: interpolated_expression + text*: [line_str_text, str_escaped_char] + macro_declaration: + $children+: [attribute, modifiers, parameter, simple_identifier, type_constraints, type_parameters, unannotated_type] + default_value*: expression + definition?: macro_definition + macro_definition: + body: [expression, external_macro_definition] + macro_invocation: + $children+: [call_suffix, simple_identifier, type_parameters] + member_modifier: + metatype: + $children: unannotated_type + modifiers: + $children+: [attribute, function_modifier, inheritance_modifier, member_modifier, mutation_modifier, ownership_modifier, parameter_modifier, property_behavior_modifier, property_modifier, visibility_modifier] + modify_specifier: + $children?: mutation_modifier + multi_line_str_text: + multi_line_string_literal: + interpolation*: interpolated_expression + text*: ["\"", multi_line_str_text, str_escaped_char] + multiline_comment: + multiplicative_expression: + lhs: expression + op: ["%", "*", "/"] + rhs: expression + mutation_modifier: + navigation_expression: + suffix: navigation_suffix + target+: ["(", ")", array_type, dictionary_type, existential_type, expression, opaque_type, user_type] + navigation_suffix: + suffix: [integer_literal, simple_identifier] + nested_type_identifier: + $children+: [simple_identifier, unannotated_type] + nil_coalescing_expression: + if_nil: expression + value: expression + oct_literal: + opaque_type: + $children: unannotated_type + open_end_range_expression: + start: expression + open_start_range_expression: + end: expression + operator_declaration: + $children+: [deprecated_operator_declaration_body, referenceable_operator, simple_identifier] + optional_chain_marker: + $children: expression + optional_type: + wrapped: [array_type, dictionary_type, tuple_type, user_type] + ownership_modifier: + parameter: + $children?: parameter_modifiers + external_name?: simple_identifier + name: simple_identifier + type: [implicitly_unwrapped_type, type] + parameter_modifier: + parameter_modifiers: + $children+: parameter_modifier + pattern: + $children*: [expression, pattern, type, user_type, value_binding_pattern, wildcard_pattern] + bound_identifier?: simple_identifier + playground_literal: + $children+: expression + postfix_expression: + operation: ["++", "--", bang] + target: expression + precedence_group_attribute: + $children+: [boolean_literal, simple_identifier] + precedence_group_attributes: + $children+: precedence_group_attribute + precedence_group_declaration: + $children+: [precedence_group_attributes, simple_identifier] + prefix_expression: + operation: ["&", "+", "++", "-", "--", ".", bang, custom_operator, "~"] + target: expression + property_behavior_modifier: + property_declaration: + $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier, type_annotation, type_constraints, value_binding_pattern, willset_didset_block] + computed_value*: computed_property + name+: pattern + value*: expression + property_modifier: + protocol_body: + $children*: protocol_member_declaration + protocol_composition_type: + $children+: unannotated_type + protocol_declaration: + $children*: [attribute, inheritance_specifier, modifiers, type_constraints, type_parameters] + body: protocol_body + declaration_kind: "protocol" + name: type_identifier + protocol_function_declaration: + $children*: [attribute, modifiers, parameter, throws, throws_clause, type_constraints, type_parameters] + body?: function_body + default_value*: expression + name: [referenceable_operator, simple_identifier] + return_type?: [implicitly_unwrapped_type, type] + protocol_property_declaration: + $children+: [modifiers, protocol_property_requirements, type_annotation, type_constraints] + name: pattern + protocol_property_requirements: + $children*: [getter_specifier, setter_specifier] + range_expression: + end: expression + op: ["...", "..<"] + start: expression + raw_str_continuing_indicator: + raw_str_end_part: + raw_str_interpolation: + $children: raw_str_interpolation_start + interpolation+: interpolated_expression + raw_str_interpolation_start: + raw_str_part: + raw_string_literal: + $children*: raw_str_continuing_indicator + interpolation*: raw_str_interpolation + text+: [raw_str_end_part, raw_str_part] + real_literal: + referenceable_operator: + $children?: [bang, custom_operator] + regex_literal: + repeat_while_statement: + $children?: statements + condition+: if_condition + selector_expression: + $children: expression + self_expression: + setter_specifier: + $children?: mutation_modifier + shebang_line: + simple_identifier: + source_file: + $children*: [do_statement, expression, for_statement, global_declaration, guard_statement, repeat_while_statement, shebang_line, statement_label, throw_keyword, while_statement] + special_literal: + statement_label: + statements: + $children+: [control_transfer_statement, do_statement, expression, for_statement, guard_statement, local_declaration, repeat_while_statement, statement_label, while_statement] + str_escaped_char: + subscript_declaration: + $children+: [attribute, computed_property, modifiers, parameter, type_constraints, type_parameters] + default_value*: expression + return_type?: [implicitly_unwrapped_type, type] + super_expression: + suppressed_constraint: + suppressed: type_identifier + switch_entry: + $children+: [default_keyword, expression, modifiers, statements, switch_pattern, where_keyword] + switch_pattern: + $children: pattern + switch_statement: + $children*: switch_entry + expr: expression + ternary_expression: + condition: expression + if_false: expression + if_true: expression + throw_keyword: + throws: + throws_clause: + type: unannotated_type + try_expression: + $children: try_operator + expr: expression + try_operator: + tuple_expression: + name*: simple_identifier + value+: expression + tuple_type: + $children?: tuple_type_item + element*: tuple_type_item + tuple_type_item: + $children*: [dictionary_type, existential_type, opaque_type, parameter_modifiers, wildcard_pattern] + name?: simple_identifier + type?: type + type: + modifiers?: type_modifiers + name: unannotated_type + type_annotation: + type: [implicitly_unwrapped_type, type] + type_arguments: + $children+: type + type_constraint: + $children: [equality_constraint, inheritance_constraint] + type_constraints: + $children+: [type_constraint, where_keyword] + type_identifier: + type_modifiers: + $children+: attribute + type_pack_expansion: + $children: unannotated_type + type_parameter: + $children+: [type, type_identifier, type_parameter_modifiers, type_parameter_pack] + type_parameter_modifiers: + $children+: attribute + type_parameter_pack: + $children: unannotated_type + type_parameters: + $children+: [type_constraints, type_parameter] + typealias_declaration: + $children*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier, type_parameters] + name: type_identifier + value: type + user_type: + $children+: [type_arguments, type_identifier] + value_argument: + $children?: type_modifiers + name?: value_argument_label + reference_specifier*: value_argument_label + value?: expression + value_argument_label: + $children: simple_identifier + value_arguments: + $children*: value_argument + value_binding_pattern: + mutability: ["let", "var"] + value_pack_expansion: + $children: expression + value_parameter_pack: + $children: expression + visibility_modifier: + where_clause: + $children+: [expression, where_keyword] + where_keyword: + while_statement: + $children?: statements + condition+: if_condition + wildcard_pattern: + willset_clause: + $children*: [modifiers, simple_identifier, statements] + willset_didset_block: + $children+: [didset_clause, willset_clause] + +unnamed: + - "?" + - "!" + - "!=" + - "!==" + - "\"" + - "\"\"\"" + - "#" + - "#else" + - "#elseif" + - "#endif" + - "#if" + - "%" + - "%=" + - "&" + - "&&" + - "(" + - ")" + - "*" + - "*=" + - "+" + - "++" + - "+=" + - "," + - "-" + - "--" + - "-=" + - "->" + - "." + - "..." + - "..<" + - "/" + - "/=" + - ":" + - ";" + - "<" + - "<<" + - "<=" + - "=" + - "==" + - "===" + - ">" + - ">=" + - ">>" + - "?" + - "??" + - "@" + - "@autoclosure" + - "@escaping" + - "Protocol" + - "Type" + - "[" + - "\\" + - "\\(" + - "]" + - "^" + - "^{" + - "_modify" + - "actor" + - "any" + - "arch" + - "as" + - "as!" + - "as?" + - "associatedtype" + - "async" + - "available" + - "await" + - "borrowing" + - "break" + - "canImport" + - "case" + - "class" + - "colorLiteral" + - "column" + - "compiler" + - "consuming" + - "continue" + - "convenience" + - "deinit" + - "didSet" + - "distributed" + - "do" + - "dsohandle" + - "dynamic" + - "each" + - "enum" + - "extension" + - "externalMacro" + - "fallthrough" + - "false" + - "file" + - "fileID" + - "fileLiteral" + - "filePath" + - "fileprivate" + - "final" + - "for" + - "func" + - "function" + - "get" + - "getter:" + - "guard" + - "if" + - "imageLiteral" + - "import" + - "in" + - "indirect" + - "infix" + - "init" + - "inout" + - "internal" + - "is" + - "keyPath" + - "lazy" + - "let" + - "line" + - "macro" + - "mutating" + - "nil" + - "nonisolated" + - "nonmutating" + - "open" + - "operator" + - "optional" + - "os" + - "override" + - "package" + - "postfix" + - "precedencegroup" + - "prefix" + - "private" + - "protocol" + - "public" + - "repeat" + - "required" + - "return" + - "selector" + - "self" + - "set" + - "setter:" + - "some" + - "static" + - "struct" + - "subscript" + - "super" + - "swift" + - "switch" + - "targetEnvironment" + - "true" + - "try" + - "typealias" + - "u" + - "unavailable" + - "unowned" + - "unowned(safe)" + - "unowned(unsafe)" + - "var" + - "weak" + - "while" + - "willSet" + - "yield" + - "{" + - "|" + - "||" + - "}" + - "~" diff --git a/unified/ql/lib/codeql/unified/Ast.qll b/unified/ql/lib/codeql/unified/Ast.qll index 54c1caceaf4b..5b9491fdb9fe 100644 --- a/unified/ql/lib/codeql/unified/Ast.qll +++ b/unified/ql/lib/codeql/unified/Ast.qll @@ -87,23 +87,17 @@ module Swift { ) } - /** A class representing `_expression` tokens. */ - class UnderscoreExpression extends @swift_token__expression, Token { - /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "UnderscoreExpression" } - } - /** A class representing `additive_expression` nodes. */ class AdditiveExpression extends @swift_additive_expression, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "AdditiveExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_additive_expression_lhs(this, i, result) } + final Expression getLhs() { swift_additive_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_additive_expression_def(this, value) | + exists(int value | swift_additive_expression_def(this, _, value, _) | result = "+" and value = 0 or result = "-" and value = 1 @@ -111,12 +105,12 @@ module Swift { } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_additive_expression_rhs(this, i, result) } + final Expression getRhs() { swift_additive_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_additive_expression_lhs(this, _, result) or - swift_additive_expression_rhs(this, _, result) + swift_additive_expression_def(this, result, _, _) or + swift_additive_expression_def(this, _, _, result) } } @@ -126,7 +120,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "ArrayLiteral" } /** Gets the node corresponding to the field `element`. */ - final AstNode getElement(int i) { swift_array_literal_element(this, i, result) } + final Expression getElement(int i) { swift_array_literal_element(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_array_literal_element(this, _, result) } @@ -138,15 +132,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "ArrayType" } /** Gets the node corresponding to the field `element`. */ - final AstNode getElement(int i) { swift_array_type_element(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_array_type_def(this, result) } + final Type getElement() { swift_array_type_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_array_type_element(this, _, result) or swift_array_type_def(this, result) - } + final override AstNode getAFieldOrChild() { swift_array_type_def(this, result) } } /** A class representing `as_expression` nodes. */ @@ -155,23 +144,19 @@ module Swift { final override string getAPrimaryQlClass() { result = "AsExpression" } /** Gets the node corresponding to the field `expr`. */ - final AstNode getExpr(int i) { swift_as_expression_expr(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_as_expression_def(this, result, _) } + final Expression getExpr() { swift_as_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_as_expression_type(this, i, result) } + final Type getType() { swift_as_expression_def(this, _, result, _) } /** Gets the child of this node. */ - final AsOperator getChild() { swift_as_expression_def(this, _, result) } + final AsOperator getChild() { swift_as_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_as_expression_expr(this, _, result) or - swift_as_expression_def(this, result, _) or - swift_as_expression_type(this, _, result) or - swift_as_expression_def(this, _, result) + swift_as_expression_def(this, result, _, _) or + swift_as_expression_def(this, _, result, _) or + swift_as_expression_def(this, _, _, result) } } @@ -188,7 +173,7 @@ module Swift { /** Gets the node corresponding to the field `operator`. */ final string getOperator() { - exists(int value | swift_assignment_def(this, value, _) | + exists(int value | swift_assignment_def(this, value, _, _) | result = "%=" and value = 0 or result = "*=" and value = 1 @@ -204,14 +189,14 @@ module Swift { } /** Gets the node corresponding to the field `result`. */ - final AstNode getResult(int i) { swift_assignment_result(this, i, result) } + final Expression getResult() { swift_assignment_def(this, _, result, _) } /** Gets the node corresponding to the field `target`. */ - final DirectlyAssignableExpression getTarget() { swift_assignment_def(this, _, result) } + final DirectlyAssignableExpression getTarget() { swift_assignment_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_assignment_result(this, _, result) or swift_assignment_def(this, _, result) + swift_assignment_def(this, _, result, _) or swift_assignment_def(this, _, _, result) } } @@ -221,26 +206,22 @@ module Swift { final override string getAPrimaryQlClass() { result = "AssociatedtypeDeclaration" } /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { - swift_associatedtype_declaration_default_value(this, i, result) - } + final Type getDefaultValue() { swift_associatedtype_declaration_default_value(this, result) } /** Gets the node corresponding to the field `must_inherit`. */ - final AstNode getMustInherit(int i) { - swift_associatedtype_declaration_must_inherit(this, i, result) - } + final Type getMustInherit() { swift_associatedtype_declaration_must_inherit(this, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_associatedtype_declaration_name(this, i, result) } + final TypeIdentifier getName() { swift_associatedtype_declaration_def(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_associatedtype_declaration_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_associatedtype_declaration_default_value(this, _, result) or - swift_associatedtype_declaration_must_inherit(this, _, result) or - swift_associatedtype_declaration_name(this, _, result) or + swift_associatedtype_declaration_default_value(this, result) or + swift_associatedtype_declaration_must_inherit(this, result) or + swift_associatedtype_declaration_def(this, result) or swift_associatedtype_declaration_child(this, _, result) } } @@ -277,14 +258,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "AwaitExpression" } /** Gets the node corresponding to the field `expr`. */ - final AstNode getExpr(int i) { swift_await_expression_expr(this, i, result) } + final Expression getExpr() { swift_await_expression_expr(this, result) } /** Gets the child of this node. */ - final AstNode getChild() { swift_await_expression_child(this, result) } + final Expression getChild() { swift_await_expression_child(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_await_expression_expr(this, _, result) or swift_await_expression_child(this, result) + swift_await_expression_expr(this, result) or swift_await_expression_child(this, result) } } @@ -306,11 +287,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "BitwiseOperation" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_bitwise_operation_lhs(this, i, result) } + final Expression getLhs() { swift_bitwise_operation_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_bitwise_operation_def(this, value) | + exists(int value | swift_bitwise_operation_def(this, _, value, _) | result = "&" and value = 0 or result = "<<" and value = 1 @@ -324,11 +305,12 @@ module Swift { } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_bitwise_operation_rhs(this, i, result) } + final Expression getRhs() { swift_bitwise_operation_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_bitwise_operation_lhs(this, _, result) or swift_bitwise_operation_rhs(this, _, result) + swift_bitwise_operation_def(this, result, _, _) or + swift_bitwise_operation_def(this, _, _, result) } } @@ -388,7 +370,7 @@ module Swift { final AstNode getName() { swift_capture_list_item_def(this, result) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_capture_list_item_value(this, i, result) } + final Expression getValue() { swift_capture_list_item_value(this, result) } /** Gets the child of this node. */ final OwnershipModifier getChild() { swift_capture_list_item_child(this, result) } @@ -396,7 +378,7 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_capture_list_item_def(this, result) or - swift_capture_list_item_value(this, _, result) or + swift_capture_list_item_value(this, result) or swift_capture_list_item_child(this, result) } } @@ -429,25 +411,23 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "CheckExpression" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_check_expression_def(this, result, _) } - /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_check_expression_def(this, _, value) | (result = "is" and value = 0)) + exists(int value | swift_check_expression_def(this, value, _, _) | + (result = "is" and value = 0) + ) } /** Gets the node corresponding to the field `target`. */ - final AstNode getTarget(int i) { swift_check_expression_target(this, i, result) } + final Expression getTarget() { swift_check_expression_def(this, _, result, _) } /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_check_expression_type(this, i, result) } + final Type getType() { swift_check_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_check_expression_def(this, result, _) or - swift_check_expression_target(this, _, result) or - swift_check_expression_type(this, _, result) + swift_check_expression_def(this, _, result, _) or + swift_check_expression_def(this, _, _, result) } } @@ -512,11 +492,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "ComparisonExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_comparison_expression_lhs(this, i, result) } + final Expression getLhs() { swift_comparison_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_comparison_expression_def(this, value) | + exists(int value | swift_comparison_expression_def(this, _, value, _) | result = "<" and value = 0 or result = "<=" and value = 1 @@ -528,12 +508,12 @@ module Swift { } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_comparison_expression_rhs(this, i, result) } + final Expression getRhs() { swift_comparison_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_comparison_expression_lhs(this, _, result) or - swift_comparison_expression_rhs(this, _, result) + swift_comparison_expression_def(this, result, _, _) or + swift_comparison_expression_def(this, _, _, result) } } @@ -591,22 +571,22 @@ module Swift { final override string getAPrimaryQlClass() { result = "ConjunctionExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_conjunction_expression_lhs(this, i, result) } + final Expression getLhs() { swift_conjunction_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_conjunction_expression_def(this, value) | + exists(int value | swift_conjunction_expression_def(this, _, value, _) | (result = "&&" and value = 0) ) } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_conjunction_expression_rhs(this, i, result) } + final Expression getRhs() { swift_conjunction_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_conjunction_expression_lhs(this, _, result) or - swift_conjunction_expression_rhs(this, _, result) + swift_conjunction_expression_def(this, result, _, _) or + swift_conjunction_expression_def(this, _, _, result) } } @@ -652,14 +632,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "ControlTransferStatement" } /** Gets the node corresponding to the field `result`. */ - final AstNode getResult(int i) { swift_control_transfer_statement_result(this, i, result) } + final Expression getResult() { swift_control_transfer_statement_result(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_control_transfer_statement_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_control_transfer_statement_result(this, _, result) or + swift_control_transfer_statement_result(this, result) or swift_control_transfer_statement_child(this, _, result) } } @@ -723,10 +703,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "DictionaryLiteral" } /** Gets the node corresponding to the field `key`. */ - final AstNode getKey(int i) { swift_dictionary_literal_key(this, i, result) } + final Expression getKey(int i) { swift_dictionary_literal_key(this, i, result) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_dictionary_literal_value(this, i, result) } + final Expression getValue(int i) { swift_dictionary_literal_value(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { @@ -741,19 +721,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "DictionaryType" } /** Gets the node corresponding to the field `key`. */ - final AstNode getKey(int i) { swift_dictionary_type_key(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_dictionary_type_name(this, i, result) } + final Type getKey() { swift_dictionary_type_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_dictionary_type_value(this, i, result) } + final Type getValue() { swift_dictionary_type_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_dictionary_type_key(this, _, result) or - swift_dictionary_type_name(this, _, result) or - swift_dictionary_type_value(this, _, result) + swift_dictionary_type_def(this, result, _) or swift_dictionary_type_def(this, _, result) } } @@ -787,11 +762,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "DirectlyAssignableExpression" } /** Gets the child of this node. */ - final AstNode getChild() { swift_directly_assignable_expression_child(this, result) } + final Expression getChild() { swift_directly_assignable_expression_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_directly_assignable_expression_child(this, result) + swift_directly_assignable_expression_def(this, result) } } @@ -801,22 +776,22 @@ module Swift { final override string getAPrimaryQlClass() { result = "DisjunctionExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_disjunction_expression_lhs(this, i, result) } + final Expression getLhs() { swift_disjunction_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_disjunction_expression_def(this, value) | + exists(int value | swift_disjunction_expression_def(this, _, value, _) | (result = "||" and value = 0) ) } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_disjunction_expression_rhs(this, i, result) } + final Expression getRhs() { swift_disjunction_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_disjunction_expression_lhs(this, _, result) or - swift_disjunction_expression_rhs(this, _, result) + swift_disjunction_expression_def(this, result, _, _) or + swift_disjunction_expression_def(this, _, _, result) } } @@ -864,7 +839,7 @@ module Swift { final SimpleIdentifier getName(int i) { swift_enum_entry_name(this, i, result) } /** Gets the node corresponding to the field `raw_value`. */ - final AstNode getRawValue(int i) { swift_enum_entry_raw_value(this, i, result) } + final Expression getRawValue(int i) { swift_enum_entry_raw_value(this, i, result) } /** Gets the child of this node. */ final Modifiers getChild() { swift_enum_entry_child(this, result) } @@ -883,17 +858,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "EnumTypeParameters" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_enum_type_parameters_name(this, i, result) } - /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_enum_type_parameters_child(this, i, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_enum_type_parameters_name(this, _, result) or - swift_enum_type_parameters_child(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_enum_type_parameters_child(this, _, result) } } /** A class representing `equality_constraint` nodes. */ @@ -902,24 +871,18 @@ module Swift { final override string getAPrimaryQlClass() { result = "EqualityConstraint" } /** Gets the node corresponding to the field `constrained_type`. */ - final AstNode getConstrainedType(int i) { - swift_equality_constraint_constrained_type(this, i, result) - } + final AstNode getConstrainedType() { swift_equality_constraint_def(this, result, _) } /** Gets the node corresponding to the field `must_equal`. */ - final AstNode getMustEqual(int i) { swift_equality_constraint_must_equal(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_equality_constraint_def(this, result) } + final Type getMustEqual() { swift_equality_constraint_def(this, _, result) } /** Gets the `i`th child of this node. */ final Attribute getChild(int i) { swift_equality_constraint_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_equality_constraint_constrained_type(this, _, result) or - swift_equality_constraint_must_equal(this, _, result) or - swift_equality_constraint_def(this, result) or + swift_equality_constraint_def(this, result, _) or + swift_equality_constraint_def(this, _, result) or swift_equality_constraint_child(this, _, result) } } @@ -930,11 +893,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "EqualityExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_equality_expression_lhs(this, i, result) } + final Expression getLhs() { swift_equality_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_equality_expression_def(this, value) | + exists(int value | swift_equality_expression_def(this, _, value, _) | result = "!=" and value = 0 or result = "!==" and value = 1 @@ -946,12 +909,12 @@ module Swift { } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_equality_expression_rhs(this, i, result) } + final Expression getRhs() { swift_equality_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_equality_expression_lhs(this, _, result) or - swift_equality_expression_rhs(this, _, result) + swift_equality_expression_def(this, result, _, _) or + swift_equality_expression_def(this, _, _, result) } } @@ -961,12 +924,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "ExistentialType" } /** Gets the child of this node. */ - final AstNode getChild() { swift_existential_type_def(this, result) } + final UnannotatedType getChild() { swift_existential_type_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_existential_type_def(this, result) } } + class Expression extends @swift_expression, AstNode { } + /** A class representing `external_macro_definition` nodes. */ class ExternalMacroDefinition extends @swift_external_macro_definition, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -985,18 +950,18 @@ module Swift { final override string getAPrimaryQlClass() { result = "ForStatement" } /** Gets the node corresponding to the field `collection`. */ - final AstNode getCollection(int i) { swift_for_statement_collection(this, i, result) } + final Expression getCollection() { swift_for_statement_def(this, result, _) } /** Gets the node corresponding to the field `item`. */ - final Pattern getItem() { swift_for_statement_def(this, result) } + final Pattern getItem() { swift_for_statement_def(this, _, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_for_statement_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_for_statement_collection(this, _, result) or - swift_for_statement_def(this, result) or + swift_for_statement_def(this, result, _) or + swift_for_statement_def(this, _, result) or swift_for_statement_child(this, _, result) } } @@ -1025,28 +990,28 @@ module Swift { final override string getAPrimaryQlClass() { result = "FunctionDeclaration" } /** Gets the node corresponding to the field `body`. */ - final FunctionBody getBody() { swift_function_declaration_def(this, result) } + final FunctionBody getBody() { swift_function_declaration_def(this, result, _) } /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { + final Expression getDefaultValue(int i) { swift_function_declaration_default_value(this, i, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_function_declaration_name(this, i, result) } + final AstNode getName() { swift_function_declaration_def(this, _, result) } /** Gets the node corresponding to the field `return_type`. */ - final AstNode getReturnType(int i) { swift_function_declaration_return_type(this, i, result) } + final AstNode getReturnType() { swift_function_declaration_return_type(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_function_declaration_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_function_declaration_def(this, result) or + swift_function_declaration_def(this, result, _) or swift_function_declaration_default_value(this, _, result) or - swift_function_declaration_name(this, _, result) or - swift_function_declaration_return_type(this, _, result) or + swift_function_declaration_def(this, _, result) or + swift_function_declaration_return_type(this, result) or swift_function_declaration_child(this, _, result) } } @@ -1062,14 +1027,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "FunctionType" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_function_type_def(this, result, _) } - /** Gets the node corresponding to the field `params`. */ - final AstNode getParams() { swift_function_type_def(this, _, result) } + final UnannotatedType getParams() { swift_function_type_def(this, result, _) } /** Gets the node corresponding to the field `return_type`. */ - final AstNode getReturnType(int i) { swift_function_type_return_type(this, i, result) } + final Type getReturnType() { swift_function_type_def(this, _, result) } /** Gets the child of this node. */ final AstNode getChild() { swift_function_type_child(this, result) } @@ -1078,7 +1040,6 @@ module Swift { final override AstNode getAFieldOrChild() { swift_function_type_def(this, result, _) or swift_function_type_def(this, _, result) or - swift_function_type_return_type(this, _, result) or swift_function_type_child(this, result) } } @@ -1095,30 +1056,22 @@ module Swift { final override AstNode getAFieldOrChild() { swift_getter_specifier_child(this, _, result) } } + class GlobalDeclaration extends @swift_global_declaration, AstNode { } + /** A class representing `guard_statement` nodes. */ class GuardStatement extends @swift_guard_statement, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "GuardStatement" } - /** Gets the node corresponding to the field `bound_identifier`. */ - final SimpleIdentifier getBoundIdentifier(int i) { - swift_guard_statement_bound_identifier(this, i, result) - } - /** Gets the node corresponding to the field `condition`. */ - final AstNode getCondition(int i) { swift_guard_statement_condition(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_guard_statement_name(this, i, result) } + final IfCondition getCondition(int i) { swift_guard_statement_condition(this, i, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_guard_statement_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_guard_statement_bound_identifier(this, _, result) or swift_guard_statement_condition(this, _, result) or - swift_guard_statement_name(this, _, result) or swift_guard_statement_child(this, _, result) } } @@ -1141,34 +1094,67 @@ module Swift { final override AstNode getAFieldOrChild() { swift_identifier_child(this, _, result) } } - /** A class representing `if_statement` nodes. */ - class IfStatement extends @swift_if_statement, AstNode { + /** A class representing `if_condition` nodes. */ + class IfCondition extends @swift_if_condition, AstNode { /** Gets the name of the primary QL class for this element. */ - final override string getAPrimaryQlClass() { result = "IfStatement" } + final override string getAPrimaryQlClass() { result = "IfCondition" } + + /** Gets the child of this node. */ + final AstNode getChild() { swift_if_condition_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_if_condition_def(this, result) } + } + + /** A class representing `if_let_binding` nodes. */ + class IfLetBinding extends @swift_if_let_binding, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "IfLetBinding" } /** Gets the node corresponding to the field `bound_identifier`. */ - final SimpleIdentifier getBoundIdentifier(int i) { - swift_if_statement_bound_identifier(this, i, result) + final SimpleIdentifier getBoundIdentifier() { + swift_if_let_binding_bound_identifier(this, result) } - /** Gets the node corresponding to the field `condition`. */ - final AstNode getCondition(int i) { swift_if_statement_condition(this, i, result) } + /** Gets the `i`th child of this node. */ + final AstNode getChild(int i) { swift_if_let_binding_child(this, i, result) } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_if_statement_name(this, i, result) } + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_if_let_binding_bound_identifier(this, result) or + swift_if_let_binding_child(this, _, result) + } + } + + /** A class representing `if_statement` nodes. */ + class IfStatement extends @swift_if_statement, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "IfStatement" } + + /** Gets the node corresponding to the field `condition`. */ + final IfCondition getCondition(int i) { swift_if_statement_condition(this, i, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_if_statement_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_if_statement_bound_identifier(this, _, result) or - swift_if_statement_condition(this, _, result) or - swift_if_statement_name(this, _, result) or - swift_if_statement_child(this, _, result) + swift_if_statement_condition(this, _, result) or swift_if_statement_child(this, _, result) } } + /** A class representing `implicitly_unwrapped_type` nodes. */ + class ImplicitlyUnwrappedType extends @swift_implicitly_unwrapped_type, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "ImplicitlyUnwrappedType" } + + /** Gets the child of this node. */ + final Type getChild() { swift_implicitly_unwrapped_type_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_implicitly_unwrapped_type_def(this, result) } + } + /** A class representing `import_declaration` nodes. */ class ImportDeclaration extends @swift_import_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -1187,19 +1173,19 @@ module Swift { final override string getAPrimaryQlClass() { result = "InfixExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_infix_expression_lhs(this, i, result) } + final Expression getLhs() { swift_infix_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ - final CustomOperator getOp() { swift_infix_expression_def(this, result) } + final CustomOperator getOp() { swift_infix_expression_def(this, _, result, _) } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_infix_expression_rhs(this, i, result) } + final Expression getRhs() { swift_infix_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_infix_expression_lhs(this, _, result) or - swift_infix_expression_def(this, result) or - swift_infix_expression_rhs(this, _, result) + swift_infix_expression_def(this, result, _, _) or + swift_infix_expression_def(this, _, result, _) or + swift_infix_expression_def(this, _, _, result) } } @@ -1209,26 +1195,18 @@ module Swift { final override string getAPrimaryQlClass() { result = "InheritanceConstraint" } /** Gets the node corresponding to the field `constrained_type`. */ - final AstNode getConstrainedType(int i) { - swift_inheritance_constraint_constrained_type(this, i, result) - } + final AstNode getConstrainedType() { swift_inheritance_constraint_def(this, result, _) } /** Gets the node corresponding to the field `inherits_from`. */ - final AstNode getInheritsFrom(int i) { - swift_inheritance_constraint_inherits_from(this, i, result) - } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_inheritance_constraint_def(this, result) } + final AstNode getInheritsFrom() { swift_inheritance_constraint_def(this, _, result) } /** Gets the `i`th child of this node. */ final Attribute getChild(int i) { swift_inheritance_constraint_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_inheritance_constraint_constrained_type(this, _, result) or - swift_inheritance_constraint_inherits_from(this, _, result) or - swift_inheritance_constraint_def(this, result) or + swift_inheritance_constraint_def(this, result, _) or + swift_inheritance_constraint_def(this, _, result) or swift_inheritance_constraint_child(this, _, result) } } @@ -1260,7 +1238,9 @@ module Swift { final FunctionBody getBody() { swift_init_declaration_body(this, result) } /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { swift_init_declaration_default_value(this, i, result) } + final Expression getDefaultValue(int i) { + swift_init_declaration_default_value(this, i, result) + } /** Gets the node corresponding to the field `name`. */ final string getName() { @@ -1298,7 +1278,7 @@ module Swift { } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_interpolated_expression_value(this, i, result) } + final Expression getValue() { swift_interpolated_expression_value(this, result) } /** Gets the child of this node. */ final TypeModifiers getChild() { swift_interpolated_expression_child(this, result) } @@ -1307,7 +1287,7 @@ module Swift { final override AstNode getAFieldOrChild() { swift_interpolated_expression_name(this, result) or swift_interpolated_expression_reference_specifier(this, _, result) or - swift_interpolated_expression_value(this, _, result) or + swift_interpolated_expression_value(this, result) or swift_interpolated_expression_child(this, result) } } @@ -1330,12 +1310,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "KeyPathStringExpression" } /** Gets the child of this node. */ - final AstNode getChild() { swift_key_path_string_expression_child(this, result) } + final Expression getChild() { swift_key_path_string_expression_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_key_path_string_expression_child(this, result) - } + final override AstNode getAFieldOrChild() { swift_key_path_string_expression_def(this, result) } } /** A class representing `lambda_function_type` nodes. */ @@ -1343,19 +1321,15 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "LambdaFunctionType" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_lambda_function_type_name(this, result) } - /** Gets the node corresponding to the field `return_type`. */ - final AstNode getReturnType(int i) { swift_lambda_function_type_return_type(this, i, result) } + final AstNode getReturnType() { swift_lambda_function_type_return_type(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_lambda_function_type_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_lambda_function_type_name(this, result) or - swift_lambda_function_type_return_type(this, _, result) or + swift_lambda_function_type_return_type(this, result) or swift_lambda_function_type_child(this, _, result) } } @@ -1407,10 +1381,10 @@ module Swift { final SimpleIdentifier getExternalName() { swift_lambda_parameter_external_name(this, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_lambda_parameter_name(this, i, result) } + final SimpleIdentifier getName() { swift_lambda_parameter_name(this, result) } /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_lambda_parameter_type(this, i, result) } + final AstNode getType() { swift_lambda_parameter_type(this, result) } /** Gets the child of this node. */ final AstNode getChild() { swift_lambda_parameter_child(this, result) } @@ -1418,8 +1392,8 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_lambda_parameter_external_name(this, result) or - swift_lambda_parameter_name(this, _, result) or - swift_lambda_parameter_type(this, _, result) or + swift_lambda_parameter_name(this, result) or + swift_lambda_parameter_type(this, result) or swift_lambda_parameter_child(this, result) } } @@ -1450,13 +1424,17 @@ module Swift { } } + class LocalDeclaration extends @swift_local_declaration, AstNode { } + /** A class representing `macro_declaration` nodes. */ class MacroDeclaration extends @swift_macro_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "MacroDeclaration" } /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { swift_macro_declaration_default_value(this, i, result) } + final Expression getDefaultValue(int i) { + swift_macro_declaration_default_value(this, i, result) + } /** Gets the node corresponding to the field `definition`. */ final MacroDefinition getDefinition() { swift_macro_declaration_definition(this, result) } @@ -1478,10 +1456,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "MacroDefinition" } /** Gets the node corresponding to the field `body`. */ - final AstNode getBody(int i) { swift_macro_definition_body(this, i, result) } + final AstNode getBody() { swift_macro_definition_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_macro_definition_body(this, _, result) } + final override AstNode getAFieldOrChild() { swift_macro_definition_def(this, result) } } /** A class representing `macro_invocation` nodes. */ @@ -1508,7 +1486,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "Metatype" } /** Gets the child of this node. */ - final AstNode getChild() { swift_metatype_def(this, result) } + final UnannotatedType getChild() { swift_metatype_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_metatype_def(this, result) } @@ -1576,11 +1554,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "MultiplicativeExpression" } /** Gets the node corresponding to the field `lhs`. */ - final AstNode getLhs(int i) { swift_multiplicative_expression_lhs(this, i, result) } + final Expression getLhs() { swift_multiplicative_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_multiplicative_expression_def(this, value) | + exists(int value | swift_multiplicative_expression_def(this, _, value, _) | result = "%" and value = 0 or result = "*" and value = 1 @@ -1590,12 +1568,12 @@ module Swift { } /** Gets the node corresponding to the field `rhs`. */ - final AstNode getRhs(int i) { swift_multiplicative_expression_rhs(this, i, result) } + final Expression getRhs() { swift_multiplicative_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_multiplicative_expression_lhs(this, _, result) or - swift_multiplicative_expression_rhs(this, _, result) + swift_multiplicative_expression_def(this, result, _, _) or + swift_multiplicative_expression_def(this, _, _, result) } } @@ -1610,9 +1588,6 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NavigationExpression" } - /** Gets the node corresponding to the field `element`. */ - final AstNode getElement() { swift_navigation_expression_element(this, result) } - /** Gets the node corresponding to the field `suffix`. */ final NavigationSuffix getSuffix() { swift_navigation_expression_def(this, result) } @@ -1621,7 +1596,6 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_navigation_expression_element(this, result) or swift_navigation_expression_def(this, result) or swift_navigation_expression_target(this, _, result) } @@ -1639,21 +1613,35 @@ module Swift { final override AstNode getAFieldOrChild() { swift_navigation_suffix_def(this, result) } } + /** A class representing `nested_type_identifier` nodes. */ + class NestedTypeIdentifier extends @swift_nested_type_identifier, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "NestedTypeIdentifier" } + + /** Gets the `i`th child of this node. */ + final AstNode getChild(int i) { swift_nested_type_identifier_child(this, i, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_nested_type_identifier_child(this, _, result) + } + } + /** A class representing `nil_coalescing_expression` nodes. */ class NilCoalescingExpression extends @swift_nil_coalescing_expression, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "NilCoalescingExpression" } /** Gets the node corresponding to the field `if_nil`. */ - final AstNode getIfNil(int i) { swift_nil_coalescing_expression_if_nil(this, i, result) } + final Expression getIfNil() { swift_nil_coalescing_expression_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_nil_coalescing_expression_value(this, i, result) } + final Expression getValue() { swift_nil_coalescing_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_nil_coalescing_expression_if_nil(this, _, result) or - swift_nil_coalescing_expression_value(this, _, result) + swift_nil_coalescing_expression_def(this, result, _) or + swift_nil_coalescing_expression_def(this, _, result) } } @@ -1669,7 +1657,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "OpaqueType" } /** Gets the child of this node. */ - final AstNode getChild() { swift_opaque_type_def(this, result) } + final UnannotatedType getChild() { swift_opaque_type_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_opaque_type_def(this, result) } @@ -1681,12 +1669,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "OpenEndRangeExpression" } /** Gets the node corresponding to the field `start`. */ - final AstNode getStart(int i) { swift_open_end_range_expression_start(this, i, result) } + final Expression getStart() { swift_open_end_range_expression_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_open_end_range_expression_start(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_open_end_range_expression_def(this, result) } } /** A class representing `open_start_range_expression` nodes. */ @@ -1695,11 +1681,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "OpenStartRangeExpression" } /** Gets the node corresponding to the field `end`. */ - final AstNode getEnd(int i) { swift_open_start_range_expression_end(this, i, result) } + final Expression getEnd() { swift_open_start_range_expression_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_open_start_range_expression_end(this, _, result) + swift_open_start_range_expression_def(this, result) } } @@ -1715,6 +1701,18 @@ module Swift { final override AstNode getAFieldOrChild() { swift_operator_declaration_child(this, _, result) } } + /** A class representing `optional_chain_marker` nodes. */ + class OptionalChainMarker extends @swift_optional_chain_marker, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "OptionalChainMarker" } + + /** Gets the child of this node. */ + final Expression getChild() { swift_optional_chain_marker_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_optional_chain_marker_def(this, result) } + } + /** A class representing `optional_type` nodes. */ class OptionalType extends @swift_optional_type, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -1742,10 +1740,10 @@ module Swift { final SimpleIdentifier getExternalName() { swift_parameter_external_name(this, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_parameter_name(this, i, result) } + final SimpleIdentifier getName() { swift_parameter_def(this, result, _) } /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_parameter_type(this, i, result) } + final AstNode getType() { swift_parameter_def(this, _, result) } /** Gets the child of this node. */ final ParameterModifiers getChild() { swift_parameter_child(this, result) } @@ -1753,8 +1751,8 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_parameter_external_name(this, result) or - swift_parameter_name(this, _, result) or - swift_parameter_type(this, _, result) or + swift_parameter_def(this, result, _) or + swift_parameter_def(this, _, result) or swift_parameter_child(this, result) } } @@ -1785,17 +1783,12 @@ module Swift { /** Gets the node corresponding to the field `bound_identifier`. */ final SimpleIdentifier getBoundIdentifier() { swift_pattern_bound_identifier(this, result) } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_pattern_name(this, result) } - /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_pattern_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_pattern_bound_identifier(this, result) or - swift_pattern_name(this, result) or - swift_pattern_child(this, _, result) + swift_pattern_bound_identifier(this, result) or swift_pattern_child(this, _, result) } } @@ -1805,7 +1798,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "PlaygroundLiteral" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_playground_literal_child(this, i, result) } + final Expression getChild(int i) { swift_playground_literal_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_playground_literal_child(this, _, result) } @@ -1817,14 +1810,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "PostfixExpression" } /** Gets the node corresponding to the field `operation`. */ - final AstNode getOperation() { swift_postfix_expression_def(this, result) } + final AstNode getOperation() { swift_postfix_expression_def(this, result, _) } /** Gets the node corresponding to the field `target`. */ - final AstNode getTarget(int i) { swift_postfix_expression_target(this, i, result) } + final Expression getTarget() { swift_postfix_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_postfix_expression_def(this, result) or swift_postfix_expression_target(this, _, result) + swift_postfix_expression_def(this, result, _) or swift_postfix_expression_def(this, _, result) } } @@ -1878,14 +1871,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "PrefixExpression" } /** Gets the node corresponding to the field `operation`. */ - final AstNode getOperation() { swift_prefix_expression_def(this, result) } + final AstNode getOperation() { swift_prefix_expression_def(this, result, _) } /** Gets the node corresponding to the field `target`. */ - final AstNode getTarget(int i) { swift_prefix_expression_target(this, i, result) } + final Expression getTarget() { swift_prefix_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_prefix_expression_def(this, result) or swift_prefix_expression_target(this, _, result) + swift_prefix_expression_def(this, result, _) or swift_prefix_expression_def(this, _, result) } } @@ -1909,7 +1902,7 @@ module Swift { final Pattern getName(int i) { swift_property_declaration_name(this, i, result) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_property_declaration_value(this, i, result) } + final Expression getValue(int i) { swift_property_declaration_value(this, i, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_property_declaration_child(this, i, result) } @@ -1934,16 +1927,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ProtocolBody" } - /** Gets the node corresponding to the field `body`. */ - final ProtocolFunctionDeclaration getBody(int i) { swift_protocol_body_body(this, i, result) } - /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_protocol_body_child(this, i, result) } + final ProtocolMemberDeclaration getChild(int i) { swift_protocol_body_child(this, i, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_protocol_body_body(this, _, result) or swift_protocol_body_child(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_protocol_body_child(this, _, result) } } /** A class representing `protocol_composition_type` nodes. */ @@ -1952,7 +1940,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "ProtocolCompositionType" } /** Gets the `i`th child of this node. */ - final AstNode getChild(int i) { swift_protocol_composition_type_child(this, i, result) } + final UnannotatedType getChild(int i) { swift_protocol_composition_type_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { @@ -1994,31 +1982,35 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "ProtocolFunctionDeclaration" } + /** Gets the node corresponding to the field `body`. */ + final FunctionBody getBody() { swift_protocol_function_declaration_body(this, result) } + /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { + final Expression getDefaultValue(int i) { swift_protocol_function_declaration_default_value(this, i, result) } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_protocol_function_declaration_name(this, i, result) } + final AstNode getName() { swift_protocol_function_declaration_def(this, result) } /** Gets the node corresponding to the field `return_type`. */ - final AstNode getReturnType(int i) { - swift_protocol_function_declaration_return_type(this, i, result) - } + final AstNode getReturnType() { swift_protocol_function_declaration_return_type(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_protocol_function_declaration_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { + swift_protocol_function_declaration_body(this, result) or swift_protocol_function_declaration_default_value(this, _, result) or - swift_protocol_function_declaration_name(this, _, result) or - swift_protocol_function_declaration_return_type(this, _, result) or + swift_protocol_function_declaration_def(this, result) or + swift_protocol_function_declaration_return_type(this, result) or swift_protocol_function_declaration_child(this, _, result) } } + class ProtocolMemberDeclaration extends @swift_protocol_member_declaration, AstNode { } + /** A class representing `protocol_property_declaration` nodes. */ class ProtocolPropertyDeclaration extends @swift_protocol_property_declaration, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -2057,11 +2049,11 @@ module Swift { final override string getAPrimaryQlClass() { result = "RangeExpression" } /** Gets the node corresponding to the field `end`. */ - final AstNode getEnd(int i) { swift_range_expression_end(this, i, result) } + final Expression getEnd() { swift_range_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `op`. */ final string getOp() { - exists(int value | swift_range_expression_def(this, value) | + exists(int value | swift_range_expression_def(this, _, value, _) | result = "..." and value = 0 or result = "..<" and value = 1 @@ -2069,11 +2061,12 @@ module Swift { } /** Gets the node corresponding to the field `start`. */ - final AstNode getStart(int i) { swift_range_expression_start(this, i, result) } + final Expression getStart() { swift_range_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_range_expression_end(this, _, result) or swift_range_expression_start(this, _, result) + swift_range_expression_def(this, result, _, _) or + swift_range_expression_def(this, _, _, result) } } @@ -2153,6 +2146,18 @@ module Swift { final override string getAPrimaryQlClass() { result = "RealLiteral" } } + /** A class representing `referenceable_operator` nodes. */ + class ReferenceableOperator extends @swift_referenceable_operator, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "ReferenceableOperator" } + + /** Gets the child of this node. */ + final AstNode getChild() { swift_referenceable_operator_child(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { swift_referenceable_operator_child(this, result) } + } + /** A class representing `regex_literal` tokens. */ class RegexLiteral extends @swift_token_regex_literal, Token { /** Gets the name of the primary QL class for this element. */ @@ -2164,25 +2169,17 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "RepeatWhileStatement" } - /** Gets the node corresponding to the field `bound_identifier`. */ - final SimpleIdentifier getBoundIdentifier(int i) { - swift_repeat_while_statement_bound_identifier(this, i, result) - } - /** Gets the node corresponding to the field `condition`. */ - final AstNode getCondition(int i) { swift_repeat_while_statement_condition(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_repeat_while_statement_name(this, i, result) } + final IfCondition getCondition(int i) { + swift_repeat_while_statement_condition(this, i, result) + } /** Gets the child of this node. */ final Statements getChild() { swift_repeat_while_statement_child(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_repeat_while_statement_bound_identifier(this, _, result) or swift_repeat_while_statement_condition(this, _, result) or - swift_repeat_while_statement_name(this, _, result) or swift_repeat_while_statement_child(this, result) } } @@ -2193,10 +2190,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "SelectorExpression" } /** Gets the child of this node. */ - final AstNode getChild() { swift_selector_expression_child(this, result) } + final Expression getChild() { swift_selector_expression_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_selector_expression_child(this, result) } + final override AstNode getAFieldOrChild() { swift_selector_expression_def(this, result) } } /** A class representing `self_expression` tokens. */ @@ -2277,15 +2274,12 @@ module Swift { final override string getAPrimaryQlClass() { result = "SubscriptDeclaration" } /** Gets the node corresponding to the field `default_value`. */ - final AstNode getDefaultValue(int i) { + final Expression getDefaultValue(int i) { swift_subscript_declaration_default_value(this, i, result) } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_subscript_declaration_name(this, result) } - /** Gets the node corresponding to the field `return_type`. */ - final AstNode getReturnType(int i) { swift_subscript_declaration_return_type(this, i, result) } + final AstNode getReturnType() { swift_subscript_declaration_return_type(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_subscript_declaration_child(this, i, result) } @@ -2293,8 +2287,7 @@ module Swift { /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_subscript_declaration_default_value(this, _, result) or - swift_subscript_declaration_name(this, result) or - swift_subscript_declaration_return_type(this, _, result) or + swift_subscript_declaration_return_type(this, result) or swift_subscript_declaration_child(this, _, result) } } @@ -2347,14 +2340,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "SwitchStatement" } /** Gets the node corresponding to the field `expr`. */ - final AstNode getExpr(int i) { swift_switch_statement_expr(this, i, result) } + final Expression getExpr() { swift_switch_statement_def(this, result) } /** Gets the `i`th child of this node. */ final SwitchEntry getChild(int i) { swift_switch_statement_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_switch_statement_expr(this, _, result) or swift_switch_statement_child(this, _, result) + swift_switch_statement_def(this, result) or swift_switch_statement_child(this, _, result) } } @@ -2364,19 +2357,19 @@ module Swift { final override string getAPrimaryQlClass() { result = "TernaryExpression" } /** Gets the node corresponding to the field `condition`. */ - final AstNode getCondition(int i) { swift_ternary_expression_condition(this, i, result) } + final Expression getCondition() { swift_ternary_expression_def(this, result, _, _) } /** Gets the node corresponding to the field `if_false`. */ - final AstNode getIfFalse(int i) { swift_ternary_expression_if_false(this, i, result) } + final Expression getIfFalse() { swift_ternary_expression_def(this, _, result, _) } /** Gets the node corresponding to the field `if_true`. */ - final AstNode getIfTrue(int i) { swift_ternary_expression_if_true(this, i, result) } + final Expression getIfTrue() { swift_ternary_expression_def(this, _, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_ternary_expression_condition(this, _, result) or - swift_ternary_expression_if_false(this, _, result) or - swift_ternary_expression_if_true(this, _, result) + swift_ternary_expression_def(this, result, _, _) or + swift_ternary_expression_def(this, _, result, _) or + swift_ternary_expression_def(this, _, _, result) } } @@ -2398,7 +2391,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "ThrowsClause" } /** Gets the node corresponding to the field `type`. */ - final AstNode getType() { swift_throws_clause_def(this, result) } + final UnannotatedType getType() { swift_throws_clause_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_throws_clause_def(this, result) } @@ -2410,14 +2403,14 @@ module Swift { final override string getAPrimaryQlClass() { result = "TryExpression" } /** Gets the node corresponding to the field `expr`. */ - final AstNode getExpr(int i) { swift_try_expression_expr(this, i, result) } + final Expression getExpr() { swift_try_expression_def(this, result, _) } /** Gets the child of this node. */ - final TryOperator getChild() { swift_try_expression_def(this, result) } + final TryOperator getChild() { swift_try_expression_def(this, _, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_try_expression_expr(this, _, result) or swift_try_expression_def(this, result) + swift_try_expression_def(this, result, _) or swift_try_expression_def(this, _, result) } } @@ -2436,7 +2429,7 @@ module Swift { final SimpleIdentifier getName(int i) { swift_tuple_expression_name(this, i, result) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_tuple_expression_value(this, i, result) } + final Expression getValue(int i) { swift_tuple_expression_value(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { @@ -2466,42 +2459,50 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TupleTypeItem" } - /** Gets the node corresponding to the field `element`. */ - final AstNode getElement() { swift_tuple_type_item_element(this, result) } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_tuple_type_item_name(this, i, result) } + final SimpleIdentifier getName() { swift_tuple_type_item_name(this, result) } /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_tuple_type_item_type(this, i, result) } + final Type getType() { swift_tuple_type_item_type(this, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_tuple_type_item_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_tuple_type_item_element(this, result) or - swift_tuple_type_item_name(this, _, result) or - swift_tuple_type_item_type(this, _, result) or + swift_tuple_type_item_name(this, result) or + swift_tuple_type_item_type(this, result) or swift_tuple_type_item_child(this, _, result) } } + /** A class representing `type` nodes. */ + class Type extends @swift_type__, AstNode { + /** Gets the name of the primary QL class for this element. */ + final override string getAPrimaryQlClass() { result = "Type" } + + /** Gets the node corresponding to the field `modifiers`. */ + final TypeModifiers getModifiers() { swift_type_modifiers(this, result) } + + /** Gets the node corresponding to the field `name`. */ + final UnannotatedType getName() { swift_type_def(this, result) } + + /** Gets a field or child node of this node. */ + final override AstNode getAFieldOrChild() { + swift_type_modifiers(this, result) or swift_type_def(this, result) + } + } + /** A class representing `type_annotation` nodes. */ class TypeAnnotation extends @swift_type_annotation, AstNode { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeAnnotation" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_type_annotation_def(this, result) } - /** Gets the node corresponding to the field `type`. */ - final AstNode getType(int i) { swift_type_annotation_type(this, i, result) } + final AstNode getType() { swift_type_annotation_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_type_annotation_def(this, result) or swift_type_annotation_type(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_type_annotation_def(this, result) } } /** A class representing `type_arguments` nodes. */ @@ -2509,16 +2510,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeArguments" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_type_arguments_name(this, i, result) } - /** Gets the `i`th child of this node. */ - final TypeModifiers getChild(int i) { swift_type_arguments_child(this, i, result) } + final Type getChild(int i) { swift_type_arguments_child(this, i, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_type_arguments_name(this, _, result) or swift_type_arguments_child(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_type_arguments_child(this, _, result) } } /** A class representing `type_constraint` nodes. */ @@ -2551,6 +2547,8 @@ module Swift { final override string getAPrimaryQlClass() { result = "TypeIdentifier" } } + class TypeLevelDeclaration extends @swift_type_level_declaration, AstNode { } + /** A class representing `type_modifiers` nodes. */ class TypeModifiers extends @swift_type_modifiers, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -2569,7 +2567,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "TypePackExpansion" } /** Gets the child of this node. */ - final AstNode getChild() { swift_type_pack_expansion_def(this, result) } + final UnannotatedType getChild() { swift_type_pack_expansion_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_type_pack_expansion_def(this, result) } @@ -2580,16 +2578,11 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "TypeParameter" } - /** Gets the node corresponding to the field `name`. */ - final AstNode getName() { swift_type_parameter_name(this, result) } - /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_type_parameter_child(this, i, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { - swift_type_parameter_name(this, result) or swift_type_parameter_child(this, _, result) - } + final override AstNode getAFieldOrChild() { swift_type_parameter_child(this, _, result) } } /** A class representing `type_parameter_modifiers` nodes. */ @@ -2612,7 +2605,7 @@ module Swift { final override string getAPrimaryQlClass() { result = "TypeParameterPack" } /** Gets the child of this node. */ - final AstNode getChild() { swift_type_parameter_pack_def(this, result) } + final UnannotatedType getChild() { swift_type_parameter_pack_def(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { swift_type_parameter_pack_def(this, result) } @@ -2636,22 +2629,24 @@ module Swift { final override string getAPrimaryQlClass() { result = "TypealiasDeclaration" } /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_typealias_declaration_name(this, i, result) } + final TypeIdentifier getName() { swift_typealias_declaration_def(this, result, _) } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_typealias_declaration_value(this, i, result) } + final Type getValue() { swift_typealias_declaration_def(this, _, result) } /** Gets the `i`th child of this node. */ final AstNode getChild(int i) { swift_typealias_declaration_child(this, i, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_typealias_declaration_name(this, _, result) or - swift_typealias_declaration_value(this, _, result) or + swift_typealias_declaration_def(this, result, _) or + swift_typealias_declaration_def(this, _, result) or swift_typealias_declaration_child(this, _, result) } } + class UnannotatedType extends @swift_unannotated_type, AstNode { } + /** A class representing `user_type` nodes. */ class UserType extends @swift_user_type, AstNode { /** Gets the name of the primary QL class for this element. */ @@ -2678,7 +2673,7 @@ module Swift { } /** Gets the node corresponding to the field `value`. */ - final AstNode getValue(int i) { swift_value_argument_value(this, i, result) } + final Expression getValue() { swift_value_argument_value(this, result) } /** Gets the child of this node. */ final TypeModifiers getChild() { swift_value_argument_child(this, result) } @@ -2687,7 +2682,7 @@ module Swift { final override AstNode getAFieldOrChild() { swift_value_argument_name(this, result) or swift_value_argument_reference_specifier(this, _, result) or - swift_value_argument_value(this, _, result) or + swift_value_argument_value(this, result) or swift_value_argument_child(this, result) } } @@ -2740,10 +2735,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "ValuePackExpansion" } /** Gets the child of this node. */ - final AstNode getChild() { swift_value_pack_expansion_child(this, result) } + final Expression getChild() { swift_value_pack_expansion_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_value_pack_expansion_child(this, result) } + final override AstNode getAFieldOrChild() { swift_value_pack_expansion_def(this, result) } } /** A class representing `value_parameter_pack` nodes. */ @@ -2752,10 +2747,10 @@ module Swift { final override string getAPrimaryQlClass() { result = "ValueParameterPack" } /** Gets the child of this node. */ - final AstNode getChild() { swift_value_parameter_pack_child(this, result) } + final Expression getChild() { swift_value_parameter_pack_def(this, result) } /** Gets a field or child node of this node. */ - final override AstNode getAFieldOrChild() { swift_value_parameter_pack_child(this, result) } + final override AstNode getAFieldOrChild() { swift_value_parameter_pack_def(this, result) } } /** A class representing `visibility_modifier` tokens. */ @@ -2787,26 +2782,15 @@ module Swift { /** Gets the name of the primary QL class for this element. */ final override string getAPrimaryQlClass() { result = "WhileStatement" } - /** Gets the node corresponding to the field `bound_identifier`. */ - final SimpleIdentifier getBoundIdentifier(int i) { - swift_while_statement_bound_identifier(this, i, result) - } - /** Gets the node corresponding to the field `condition`. */ - final AstNode getCondition(int i) { swift_while_statement_condition(this, i, result) } - - /** Gets the node corresponding to the field `name`. */ - final AstNode getName(int i) { swift_while_statement_name(this, i, result) } + final IfCondition getCondition(int i) { swift_while_statement_condition(this, i, result) } /** Gets the child of this node. */ final Statements getChild() { swift_while_statement_child(this, result) } /** Gets a field or child node of this node. */ final override AstNode getAFieldOrChild() { - swift_while_statement_bound_identifier(this, _, result) or - swift_while_statement_condition(this, _, result) or - swift_while_statement_name(this, _, result) or - swift_while_statement_child(this, result) + swift_while_statement_condition(this, _, result) or swift_while_statement_child(this, result) } } diff --git a/unified/ql/lib/unified.dbscheme b/unified/ql/lib/unified.dbscheme index c580e8e69271..b50bc56eaa2a 100644 --- a/unified/ql/lib/unified.dbscheme +++ b/unified/ql/lib/unified.dbscheme @@ -132,87 +132,39 @@ overlayChangedFiles( ); /*- Swift dbscheme -*/ -@swift_additive_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_additive_expression, index] -swift_additive_expression_lhs( - int swift_additive_expression: @swift_additive_expression ref, - int index: int ref, - unique int lhs: @swift_additive_expression_lhs_type ref -); - case @swift_additive_expression.op of 0 = @swift_additive_expression_plus | 1 = @swift_additive_expression_minus ; -@swift_additive_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_additive_expression, index] -swift_additive_expression_rhs( - int swift_additive_expression: @swift_additive_expression ref, - int index: int ref, - unique int rhs: @swift_additive_expression_rhs_type ref -); - swift_additive_expression_def( unique int id: @swift_additive_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); -@swift_array_literal_element_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_array_literal, index] swift_array_literal_element( int swift_array_literal: @swift_array_literal ref, int index: int ref, - unique int element: @swift_array_literal_element_type ref + unique int element: @swift_expression ref ); swift_array_literal_def( unique int id: @swift_array_literal ); -@swift_array_type_element_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_array_type, index] -swift_array_type_element( - int swift_array_type: @swift_array_type ref, - int index: int ref, - unique int element: @swift_array_type_element_type ref -); - -@swift_array_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_array_type_def( unique int id: @swift_array_type, - int name: @swift_array_type_name_type ref -); - -@swift_as_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_as_expression, index] -swift_as_expression_expr( - int swift_as_expression: @swift_as_expression ref, - int index: int ref, - unique int expr: @swift_as_expression_expr_type ref -); - -@swift_as_expression_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -@swift_as_expression_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_as_expression, index] -swift_as_expression_type( - int swift_as_expression: @swift_as_expression ref, - int index: int ref, - unique int type__: @swift_as_expression_type_type ref + int element: @swift_type__ ref ); swift_as_expression_def( unique int id: @swift_as_expression, - int name: @swift_as_expression_name_type ref, + int expr: @swift_expression ref, + int type__: @swift_type__ ref, int child: @swift_token_as_operator ref ); @@ -226,46 +178,21 @@ case @swift_assignment.operator of ; -@swift_assignment_result_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_assignment, index] -swift_assignment_result( - int swift_assignment: @swift_assignment ref, - int index: int ref, - unique int result: @swift_assignment_result_type ref -); - swift_assignment_def( unique int id: @swift_assignment, int operator: int ref, + int result: @swift_expression ref, int target: @swift_directly_assignable_expression ref ); -@swift_associatedtype_declaration_default_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_associatedtype_declaration, index] swift_associatedtype_declaration_default_value( - int swift_associatedtype_declaration: @swift_associatedtype_declaration ref, - int index: int ref, - unique int default_value: @swift_associatedtype_declaration_default_value_type ref + unique int swift_associatedtype_declaration: @swift_associatedtype_declaration ref, + unique int default_value: @swift_type__ ref ); -@swift_associatedtype_declaration_must_inherit_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_associatedtype_declaration, index] swift_associatedtype_declaration_must_inherit( - int swift_associatedtype_declaration: @swift_associatedtype_declaration ref, - int index: int ref, - unique int must_inherit: @swift_associatedtype_declaration_must_inherit_type ref -); - -@swift_associatedtype_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_associatedtype_declaration, index] -swift_associatedtype_declaration_name( - int swift_associatedtype_declaration: @swift_associatedtype_declaration ref, - int index: int ref, - unique int name: @swift_associatedtype_declaration_name_type ref + unique int swift_associatedtype_declaration: @swift_associatedtype_declaration ref, + unique int must_inherit: @swift_type__ ref ); @swift_associatedtype_declaration_child_type = @swift_modifiers | @swift_type_constraints @@ -278,10 +205,11 @@ swift_associatedtype_declaration_child( ); swift_associatedtype_declaration_def( - unique int id: @swift_associatedtype_declaration + unique int id: @swift_associatedtype_declaration, + int name: @swift_token_type_identifier ref ); -@swift_attribute_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_user_type | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_attribute_child_type = @swift_expression | @swift_user_type #keyset[swift_attribute, index] swift_attribute_child( @@ -307,35 +235,20 @@ swift_availability_condition_def( unique int id: @swift_availability_condition ); -@swift_await_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_await_expression, index] swift_await_expression_expr( - int swift_await_expression: @swift_await_expression ref, - int index: int ref, - unique int expr: @swift_await_expression_expr_type ref + unique int swift_await_expression: @swift_await_expression ref, + unique int expr: @swift_expression ref ); -@swift_await_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - swift_await_expression_child( unique int swift_await_expression: @swift_await_expression ref, - unique int child: @swift_await_expression_child_type ref + unique int child: @swift_expression ref ); swift_await_expression_def( unique int id: @swift_await_expression ); -@swift_bitwise_operation_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_bitwise_operation, index] -swift_bitwise_operation_lhs( - int swift_bitwise_operation: @swift_bitwise_operation ref, - int index: int ref, - unique int lhs: @swift_bitwise_operation_lhs_type ref -); - case @swift_bitwise_operation.op of 0 = @swift_bitwise_operation_ampersand | 1 = @swift_bitwise_operation_langlelangle @@ -345,21 +258,14 @@ case @swift_bitwise_operation.op of ; -@swift_bitwise_operation_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_bitwise_operation, index] -swift_bitwise_operation_rhs( - int swift_bitwise_operation: @swift_bitwise_operation ref, - int index: int ref, - unique int rhs: @swift_bitwise_operation_rhs_type ref -); - swift_bitwise_operation_def( unique int id: @swift_bitwise_operation, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); -@swift_call_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_call_expression_child_type = @swift_call_suffix | @swift_expression #keyset[swift_call_expression, index] swift_call_expression_child( @@ -405,13 +311,9 @@ swift_capture_list_def( @swift_capture_list_item_name_type = @swift_token_self_expression | @swift_token_simple_identifier -@swift_capture_list_item_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_capture_list_item, index] swift_capture_list_item_value( - int swift_capture_list_item: @swift_capture_list_item ref, - int index: int ref, - unique int value: @swift_capture_list_item_value_type ref + unique int swift_capture_list_item: @swift_capture_list_item ref, + unique int value: @swift_expression ref ); swift_capture_list_item_child( @@ -442,38 +344,19 @@ swift_catch_block_def( unique int id: @swift_catch_block ); -@swift_check_expression_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - case @swift_check_expression.op of 0 = @swift_check_expression_is ; -@swift_check_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_check_expression, index] -swift_check_expression_target( - int swift_check_expression: @swift_check_expression ref, - int index: int ref, - unique int target: @swift_check_expression_target_type ref -); - -@swift_check_expression_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_check_expression, index] -swift_check_expression_type( - int swift_check_expression: @swift_check_expression ref, - int index: int ref, - unique int type__: @swift_check_expression_type_type ref -); - swift_check_expression_def( unique int id: @swift_check_expression, - int name: @swift_check_expression_name_type ref, - int op: int ref + int op: int ref, + int target: @swift_expression ref, + int type__: @swift_type__ ref ); -@swift_class_body_child_type = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_token_multiline_comment | @swift_typealias_declaration +@swift_class_body_child_type = @swift_token_multiline_comment | @swift_type_level_declaration #keyset[swift_class_body, index] swift_class_body_child( @@ -497,7 +380,7 @@ case @swift_class_declaration.declaration_kind of ; -@swift_class_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_class_declaration_name_type = @swift_token_type_identifier | @swift_unannotated_type @swift_class_declaration_child_type = @swift_attribute | @swift_inheritance_specifier | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_constraints | @swift_type_parameters @@ -515,15 +398,6 @@ swift_class_declaration_def( int name: @swift_class_declaration_name_type ref ); -@swift_comparison_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_comparison_expression, index] -swift_comparison_expression_lhs( - int swift_comparison_expression: @swift_comparison_expression ref, - int index: int ref, - unique int lhs: @swift_comparison_expression_lhs_type ref -); - case @swift_comparison_expression.op of 0 = @swift_comparison_expression_langle | 1 = @swift_comparison_expression_langleequal @@ -532,18 +406,11 @@ case @swift_comparison_expression.op of ; -@swift_comparison_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_comparison_expression, index] -swift_comparison_expression_rhs( - int swift_comparison_expression: @swift_comparison_expression ref, - int index: int ref, - unique int rhs: @swift_comparison_expression_rhs_type ref -); - swift_comparison_expression_def( unique int id: @swift_comparison_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); @swift_computed_getter_child_type = @swift_attribute | @swift_getter_specifier | @swift_statements @@ -598,32 +465,16 @@ swift_computed_setter_def( unique int id: @swift_computed_setter ); -@swift_conjunction_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_conjunction_expression, index] -swift_conjunction_expression_lhs( - int swift_conjunction_expression: @swift_conjunction_expression ref, - int index: int ref, - unique int lhs: @swift_conjunction_expression_lhs_type ref -); - case @swift_conjunction_expression.op of 0 = @swift_conjunction_expression_ampersandampersand ; -@swift_conjunction_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_conjunction_expression, index] -swift_conjunction_expression_rhs( - int swift_conjunction_expression: @swift_conjunction_expression ref, - int index: int ref, - unique int rhs: @swift_conjunction_expression_rhs_type ref -); - swift_conjunction_expression_def( unique int id: @swift_conjunction_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); @swift_constructor_expression_constructed_type_type = @swift_array_type | @swift_dictionary_type | @swift_user_type @@ -654,16 +505,12 @@ swift_constructor_suffix_def( unique int id: @swift_constructor_suffix ); -@swift_control_transfer_statement_result_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_control_transfer_statement, index] swift_control_transfer_statement_result( - int swift_control_transfer_statement: @swift_control_transfer_statement ref, - int index: int ref, - unique int result: @swift_control_transfer_statement_result_type ref + unique int swift_control_transfer_statement: @swift_control_transfer_statement ref, + unique int result: @swift_expression ref ); -@swift_control_transfer_statement_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_throw_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_control_transfer_statement_child_type = @swift_expression | @swift_token_throw_keyword #keyset[swift_control_transfer_statement, index] swift_control_transfer_statement_child( @@ -699,57 +546,28 @@ swift_deprecated_operator_declaration_body_def( unique int id: @swift_deprecated_operator_declaration_body ); -@swift_dictionary_literal_key_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_dictionary_literal, index] swift_dictionary_literal_key( int swift_dictionary_literal: @swift_dictionary_literal ref, int index: int ref, - unique int key__: @swift_dictionary_literal_key_type ref + unique int key__: @swift_expression ref ); -@swift_dictionary_literal_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_dictionary_literal, index] swift_dictionary_literal_value( int swift_dictionary_literal: @swift_dictionary_literal ref, int index: int ref, - unique int value: @swift_dictionary_literal_value_type ref + unique int value: @swift_expression ref ); swift_dictionary_literal_def( unique int id: @swift_dictionary_literal ); -@swift_dictionary_type_key_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_dictionary_type, index] -swift_dictionary_type_key( - int swift_dictionary_type: @swift_dictionary_type ref, - int index: int ref, - unique int key__: @swift_dictionary_type_key_type ref -); - -@swift_dictionary_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_dictionary_type, index] -swift_dictionary_type_name( - int swift_dictionary_type: @swift_dictionary_type ref, - int index: int ref, - unique int name: @swift_dictionary_type_name_type ref -); - -@swift_dictionary_type_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_dictionary_type, index] -swift_dictionary_type_value( - int swift_dictionary_type: @swift_dictionary_type ref, - int index: int ref, - unique int value: @swift_dictionary_type_value_type ref -); - swift_dictionary_type_def( - unique int id: @swift_dictionary_type + unique int id: @swift_dictionary_type, + int key__: @swift_type__ ref, + int value: @swift_type__ ref ); @swift_didset_clause_child_type = @swift_modifiers | @swift_statements | @swift_token_simple_identifier @@ -778,24 +596,9 @@ swift_directive_def( unique int id: @swift_directive ); -@swift_directly_assignable_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -swift_directly_assignable_expression_child( - unique int swift_directly_assignable_expression: @swift_directly_assignable_expression ref, - unique int child: @swift_directly_assignable_expression_child_type ref -); - swift_directly_assignable_expression_def( - unique int id: @swift_directly_assignable_expression -); - -@swift_disjunction_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_disjunction_expression, index] -swift_disjunction_expression_lhs( - int swift_disjunction_expression: @swift_disjunction_expression ref, - int index: int ref, - unique int lhs: @swift_disjunction_expression_lhs_type ref + unique int id: @swift_directly_assignable_expression, + int child: @swift_expression ref ); case @swift_disjunction_expression.op of @@ -803,18 +606,11 @@ case @swift_disjunction_expression.op of ; -@swift_disjunction_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_disjunction_expression, index] -swift_disjunction_expression_rhs( - int swift_disjunction_expression: @swift_disjunction_expression ref, - int index: int ref, - unique int rhs: @swift_disjunction_expression_rhs_type ref -); - swift_disjunction_expression_def( unique int id: @swift_disjunction_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); @swift_do_statement_child_type = @swift_catch_block | @swift_statements @@ -830,7 +626,7 @@ swift_do_statement_def( unique int id: @swift_do_statement ); -@swift_enum_class_body_child_type = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_enum_entry | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_typealias_declaration +@swift_enum_class_body_child_type = @swift_enum_entry | @swift_type_level_declaration #keyset[swift_enum_class_body, index] swift_enum_class_body_child( @@ -857,13 +653,11 @@ swift_enum_entry_name( unique int name: @swift_token_simple_identifier ref ); -@swift_enum_entry_raw_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_enum_entry, index] swift_enum_entry_raw_value( int swift_enum_entry: @swift_enum_entry ref, int index: int ref, - unique int raw_value: @swift_enum_entry_raw_value_type ref + unique int raw_value: @swift_expression ref ); swift_enum_entry_child( @@ -875,16 +669,7 @@ swift_enum_entry_def( unique int id: @swift_enum_entry ); -@swift_enum_type_parameters_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_enum_type_parameters, index] -swift_enum_type_parameters_name( - int swift_enum_type_parameters: @swift_enum_type_parameters ref, - int index: int ref, - unique int name: @swift_enum_type_parameters_name_type ref -); - -@swift_enum_type_parameters_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_type_modifiers | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_enum_type_parameters_child_type = @swift_expression | @swift_token_wildcard_pattern | @swift_type__ #keyset[swift_enum_type_parameters, index] swift_enum_type_parameters_child( @@ -897,25 +682,7 @@ swift_enum_type_parameters_def( unique int id: @swift_enum_type_parameters ); -@swift_equality_constraint_constrained_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_identifier | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_equality_constraint, index] -swift_equality_constraint_constrained_type( - int swift_equality_constraint: @swift_equality_constraint ref, - int index: int ref, - unique int constrained_type: @swift_equality_constraint_constrained_type_type ref -); - -@swift_equality_constraint_must_equal_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_equality_constraint, index] -swift_equality_constraint_must_equal( - int swift_equality_constraint: @swift_equality_constraint ref, - int index: int ref, - unique int must_equal: @swift_equality_constraint_must_equal_type ref -); - -@swift_equality_constraint_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_equality_constraint_constrained_type_type = @swift_identifier | @swift_nested_type_identifier #keyset[swift_equality_constraint, index] swift_equality_constraint_child( @@ -926,16 +693,8 @@ swift_equality_constraint_child( swift_equality_constraint_def( unique int id: @swift_equality_constraint, - int name: @swift_equality_constraint_name_type ref -); - -@swift_equality_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_equality_expression, index] -swift_equality_expression_lhs( - int swift_equality_expression: @swift_equality_expression ref, - int index: int ref, - unique int lhs: @swift_equality_expression_lhs_type ref + int constrained_type: @swift_equality_constraint_constrained_type_type ref, + int must_equal: @swift_type__ ref ); case @swift_equality_expression.op of @@ -946,41 +705,25 @@ case @swift_equality_expression.op of ; -@swift_equality_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_equality_expression, index] -swift_equality_expression_rhs( - int swift_equality_expression: @swift_equality_expression ref, - int index: int ref, - unique int rhs: @swift_equality_expression_rhs_type ref -); - swift_equality_expression_def( unique int id: @swift_equality_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); -@swift_existential_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_existential_type_def( unique int id: @swift_existential_type, - int child: @swift_existential_type_child_type ref + int child: @swift_unannotated_type ref ); +@swift_expression = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_chain_marker | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_referenceable_operator | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack + swift_external_macro_definition_def( unique int id: @swift_external_macro_definition, int child: @swift_value_arguments ref ); -@swift_for_statement_collection_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_for_statement, index] -swift_for_statement_collection( - int swift_for_statement: @swift_for_statement ref, - int index: int ref, - unique int collection: @swift_for_statement_collection_type ref -); - @swift_for_statement_child_type = @swift_statements | @swift_token_try_operator | @swift_type_annotation | @swift_where_clause #keyset[swift_for_statement, index] @@ -992,6 +735,7 @@ swift_for_statement_child( swift_for_statement_def( unique int id: @swift_for_statement, + int collection: @swift_expression ref, int item: @swift_pattern ref ); @@ -1004,30 +748,19 @@ swift_function_body_def( unique int id: @swift_function_body ); -@swift_function_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_function_declaration, index] swift_function_declaration_default_value( int swift_function_declaration: @swift_function_declaration ref, int index: int ref, - unique int default_value: @swift_function_declaration_default_value_type ref + unique int default_value: @swift_expression ref ); -@swift_function_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_function_declaration_name_type = @swift_referenceable_operator | @swift_token_simple_identifier -#keyset[swift_function_declaration, index] -swift_function_declaration_name( - int swift_function_declaration: @swift_function_declaration ref, - int index: int ref, - unique int name: @swift_function_declaration_name_type ref -); - -@swift_function_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_function_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_function_declaration, index] swift_function_declaration_return_type( - int swift_function_declaration: @swift_function_declaration ref, - int index: int ref, + unique int swift_function_declaration: @swift_function_declaration ref, unique int return_type: @swift_function_declaration_return_type_type ref ); @@ -1042,20 +775,8 @@ swift_function_declaration_child( swift_function_declaration_def( unique int id: @swift_function_declaration, - int body: @swift_function_body ref -); - -@swift_function_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -@swift_function_type_params_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -@swift_function_type_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_function_type, index] -swift_function_type_return_type( - int swift_function_type: @swift_function_type ref, - int index: int ref, - unique int return_type: @swift_function_type_return_type_type ref + int body: @swift_function_body ref, + int name: @swift_function_declaration_name_type ref ); @swift_function_type_child_type = @swift_throws_clause | @swift_token_throws @@ -1067,8 +788,8 @@ swift_function_type_child( swift_function_type_def( unique int id: @swift_function_type, - int name: @swift_function_type_name_type ref, - int params: @swift_function_type_params_type ref + int params: @swift_unannotated_type ref, + int return_type: @swift_type__ ref ); @swift_getter_specifier_child_type = @swift_throws_clause | @swift_token_mutation_modifier | @swift_token_throws @@ -1084,29 +805,13 @@ swift_getter_specifier_def( unique int id: @swift_getter_specifier ); -#keyset[swift_guard_statement, index] -swift_guard_statement_bound_identifier( - int swift_guard_statement: @swift_guard_statement ref, - int index: int ref, - unique int bound_identifier: @swift_token_simple_identifier ref -); - -@swift_guard_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause +@swift_global_declaration = @swift_associatedtype_declaration | @swift_class_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_macro_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_typealias_declaration #keyset[swift_guard_statement, index] swift_guard_statement_condition( int swift_guard_statement: @swift_guard_statement ref, int index: int ref, - unique int condition: @swift_guard_statement_condition_type ref -); - -@swift_guard_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_guard_statement, index] -swift_guard_statement_name( - int swift_guard_statement: @swift_guard_statement ref, - int index: int ref, - unique int name: @swift_guard_statement_name_type ref + unique int condition: @swift_if_condition ref ); @swift_guard_statement_child_type = @swift_statements | @swift_token_else @@ -1133,29 +838,36 @@ swift_identifier_def( unique int id: @swift_identifier ); -#keyset[swift_if_statement, index] -swift_if_statement_bound_identifier( - int swift_if_statement: @swift_if_statement ref, - int index: int ref, +@swift_if_condition_child_type = @swift_availability_condition | @swift_expression | @swift_if_let_binding + +swift_if_condition_def( + unique int id: @swift_if_condition, + int child: @swift_if_condition_child_type ref +); + +swift_if_let_binding_bound_identifier( + unique int swift_if_let_binding: @swift_if_let_binding ref, unique int bound_identifier: @swift_token_simple_identifier ref ); -@swift_if_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause +@swift_if_let_binding_child_type = @swift_expression | @swift_pattern | @swift_token_wildcard_pattern | @swift_type__ | @swift_type_annotation | @swift_user_type | @swift_value_binding_pattern | @swift_where_clause -#keyset[swift_if_statement, index] -swift_if_statement_condition( - int swift_if_statement: @swift_if_statement ref, +#keyset[swift_if_let_binding, index] +swift_if_let_binding_child( + int swift_if_let_binding: @swift_if_let_binding ref, int index: int ref, - unique int condition: @swift_if_statement_condition_type ref + unique int child: @swift_if_let_binding_child_type ref ); -@swift_if_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +swift_if_let_binding_def( + unique int id: @swift_if_let_binding +); #keyset[swift_if_statement, index] -swift_if_statement_name( +swift_if_statement_condition( int swift_if_statement: @swift_if_statement ref, int index: int ref, - unique int name: @swift_if_statement_name_type ref + unique int condition: @swift_if_condition ref ); @swift_if_statement_child_type = @swift_if_statement | @swift_statements | @swift_token_else @@ -1171,6 +883,11 @@ swift_if_statement_def( unique int id: @swift_if_statement ); +swift_implicitly_unwrapped_type_def( + unique int id: @swift_implicitly_unwrapped_type, + int child: @swift_type__ ref +); + @swift_import_declaration_child_type = @swift_identifier | @swift_modifiers #keyset[swift_import_declaration, index] @@ -1184,48 +901,16 @@ swift_import_declaration_def( unique int id: @swift_import_declaration ); -@swift_infix_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_infix_expression, index] -swift_infix_expression_lhs( - int swift_infix_expression: @swift_infix_expression ref, - int index: int ref, - unique int lhs: @swift_infix_expression_lhs_type ref -); - -@swift_infix_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_infix_expression, index] -swift_infix_expression_rhs( - int swift_infix_expression: @swift_infix_expression ref, - int index: int ref, - unique int rhs: @swift_infix_expression_rhs_type ref -); - swift_infix_expression_def( unique int id: @swift_infix_expression, - int op: @swift_token_custom_operator ref -); - -@swift_inheritance_constraint_constrained_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_identifier | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_inheritance_constraint, index] -swift_inheritance_constraint_constrained_type( - int swift_inheritance_constraint: @swift_inheritance_constraint ref, - int index: int ref, - unique int constrained_type: @swift_inheritance_constraint_constrained_type_type ref + int lhs: @swift_expression ref, + int op: @swift_token_custom_operator ref, + int rhs: @swift_expression ref ); -@swift_inheritance_constraint_inherits_from_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_inheritance_constraint_constrained_type_type = @swift_identifier | @swift_nested_type_identifier -#keyset[swift_inheritance_constraint, index] -swift_inheritance_constraint_inherits_from( - int swift_inheritance_constraint: @swift_inheritance_constraint ref, - int index: int ref, - unique int inherits_from: @swift_inheritance_constraint_inherits_from_type ref -); - -@swift_inheritance_constraint_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_inheritance_constraint_inherits_from_type = @swift_implicitly_unwrapped_type | @swift_type__ #keyset[swift_inheritance_constraint, index] swift_inheritance_constraint_child( @@ -1236,7 +921,8 @@ swift_inheritance_constraint_child( swift_inheritance_constraint_def( unique int id: @swift_inheritance_constraint, - int name: @swift_inheritance_constraint_name_type ref + int constrained_type: @swift_inheritance_constraint_constrained_type_type ref, + int inherits_from: @swift_inheritance_constraint_inherits_from_type ref ); @swift_inheritance_specifier_inherits_from_type = @swift_function_type | @swift_suppressed_constraint | @swift_user_type @@ -1251,13 +937,11 @@ swift_init_declaration_body( unique int body: @swift_function_body ref ); -@swift_init_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_init_declaration, index] swift_init_declaration_default_value( int swift_init_declaration: @swift_init_declaration ref, int index: int ref, - unique int default_value: @swift_init_declaration_default_value_type ref + unique int default_value: @swift_expression ref ); case @swift_init_declaration.name of @@ -1291,13 +975,9 @@ swift_interpolated_expression_reference_specifier( unique int reference_specifier: @swift_value_argument_label ref ); -@swift_interpolated_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_interpolated_expression, index] swift_interpolated_expression_value( - int swift_interpolated_expression: @swift_interpolated_expression ref, - int index: int ref, - unique int value: @swift_interpolated_expression_value_type ref + unique int swift_interpolated_expression: @swift_interpolated_expression ref, + unique int value: @swift_expression ref ); swift_interpolated_expression_child( @@ -1322,30 +1002,15 @@ swift_key_path_expression_def( unique int id: @swift_key_path_expression ); -@swift_key_path_string_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -swift_key_path_string_expression_child( - unique int swift_key_path_string_expression: @swift_key_path_string_expression ref, - unique int child: @swift_key_path_string_expression_child_type ref -); - swift_key_path_string_expression_def( - unique int id: @swift_key_path_string_expression -); - -@swift_lambda_function_type_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -swift_lambda_function_type_name( - unique int swift_lambda_function_type: @swift_lambda_function_type ref, - unique int name: @swift_lambda_function_type_name_type ref + unique int id: @swift_key_path_string_expression, + int child: @swift_expression ref ); -@swift_lambda_function_type_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_lambda_function_type_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_lambda_function_type, index] swift_lambda_function_type_return_type( - int swift_lambda_function_type: @swift_lambda_function_type ref, - int index: int ref, + unique int swift_lambda_function_type: @swift_lambda_function_type ref, unique int return_type: @swift_lambda_function_type_return_type_type ref ); @@ -1401,21 +1066,15 @@ swift_lambda_parameter_external_name( unique int external_name: @swift_token_simple_identifier ref ); -@swift_lambda_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_lambda_parameter, index] swift_lambda_parameter_name( - int swift_lambda_parameter: @swift_lambda_parameter ref, - int index: int ref, - unique int name: @swift_lambda_parameter_name_type ref + unique int swift_lambda_parameter: @swift_lambda_parameter ref, + unique int name: @swift_token_simple_identifier ref ); -@swift_lambda_parameter_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_lambda_parameter_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_lambda_parameter, index] swift_lambda_parameter_type( - int swift_lambda_parameter: @swift_lambda_parameter ref, - int index: int ref, + unique int swift_lambda_parameter: @swift_lambda_parameter ref, unique int type__: @swift_lambda_parameter_type_type ref ); @@ -1450,13 +1109,13 @@ swift_line_string_literal_def( unique int id: @swift_line_string_literal ); -@swift_macro_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_local_declaration = @swift_class_declaration | @swift_function_declaration | @swift_property_declaration | @swift_typealias_declaration #keyset[swift_macro_declaration, index] swift_macro_declaration_default_value( int swift_macro_declaration: @swift_macro_declaration ref, int index: int ref, - unique int default_value: @swift_macro_declaration_default_value_type ref + unique int default_value: @swift_expression ref ); swift_macro_declaration_definition( @@ -1464,7 +1123,7 @@ swift_macro_declaration_definition( unique int definition: @swift_macro_definition ref ); -@swift_macro_declaration_child_type = @swift_array_type | @swift_attribute | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_modifiers | @swift_opaque_type | @swift_optional_type | @swift_parameter | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_constraints | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_type_parameters | @swift_user_type +@swift_macro_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_token_simple_identifier | @swift_type_constraints | @swift_type_parameters | @swift_unannotated_type #keyset[swift_macro_declaration, index] swift_macro_declaration_child( @@ -1477,17 +1136,11 @@ swift_macro_declaration_def( unique int id: @swift_macro_declaration ); -@swift_macro_definition_body_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_external_macro_definition | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_macro_definition, index] -swift_macro_definition_body( - int swift_macro_definition: @swift_macro_definition ref, - int index: int ref, - unique int body: @swift_macro_definition_body_type ref -); +@swift_macro_definition_body_type = @swift_expression | @swift_external_macro_definition swift_macro_definition_def( - unique int id: @swift_macro_definition + unique int id: @swift_macro_definition, + int body: @swift_macro_definition_body_type ref ); @swift_macro_invocation_child_type = @swift_call_suffix | @swift_token_simple_identifier | @swift_type_parameters @@ -1503,11 +1156,9 @@ swift_macro_invocation_def( unique int id: @swift_macro_invocation ); -@swift_metatype_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_metatype_def( unique int id: @swift_metatype, - int child: @swift_metatype_child_type ref + int child: @swift_unannotated_type ref ); @swift_modifiers_child_type = @swift_attribute | @swift_token_function_modifier | @swift_token_inheritance_modifier | @swift_token_member_modifier | @swift_token_mutation_modifier | @swift_token_ownership_modifier | @swift_token_parameter_modifier | @swift_token_property_behavior_modifier | @swift_token_property_modifier | @swift_token_visibility_modifier @@ -1552,15 +1203,6 @@ swift_multi_line_string_literal_def( unique int id: @swift_multi_line_string_literal ); -@swift_multiplicative_expression_lhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_multiplicative_expression, index] -swift_multiplicative_expression_lhs( - int swift_multiplicative_expression: @swift_multiplicative_expression ref, - int index: int ref, - unique int lhs: @swift_multiplicative_expression_lhs_type ref -); - case @swift_multiplicative_expression.op of 0 = @swift_multiplicative_expression_percent | 1 = @swift_multiplicative_expression_star @@ -1568,28 +1210,14 @@ case @swift_multiplicative_expression.op of ; -@swift_multiplicative_expression_rhs_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_multiplicative_expression, index] -swift_multiplicative_expression_rhs( - int swift_multiplicative_expression: @swift_multiplicative_expression ref, - int index: int ref, - unique int rhs: @swift_multiplicative_expression_rhs_type ref -); - swift_multiplicative_expression_def( unique int id: @swift_multiplicative_expression, - int op: int ref + int lhs: @swift_expression ref, + int op: int ref, + int rhs: @swift_expression ref ); -@swift_navigation_expression_element_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type - -swift_navigation_expression_element( - unique int swift_navigation_expression: @swift_navigation_expression ref, - unique int element: @swift_navigation_expression_element_type ref -); - -@swift_navigation_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_user_type | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_navigation_expression_target_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_expression | @swift_opaque_type | @swift_reserved_word | @swift_user_type #keyset[swift_navigation_expression, index] swift_navigation_expression_target( @@ -1610,62 +1238,41 @@ swift_navigation_suffix_def( int suffix: @swift_navigation_suffix_suffix_type ref ); -@swift_nil_coalescing_expression_if_nil_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_nested_type_identifier_child_type = @swift_token_simple_identifier | @swift_unannotated_type -#keyset[swift_nil_coalescing_expression, index] -swift_nil_coalescing_expression_if_nil( - int swift_nil_coalescing_expression: @swift_nil_coalescing_expression ref, +#keyset[swift_nested_type_identifier, index] +swift_nested_type_identifier_child( + int swift_nested_type_identifier: @swift_nested_type_identifier ref, int index: int ref, - unique int if_nil: @swift_nil_coalescing_expression_if_nil_type ref + unique int child: @swift_nested_type_identifier_child_type ref ); -@swift_nil_coalescing_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_nil_coalescing_expression, index] -swift_nil_coalescing_expression_value( - int swift_nil_coalescing_expression: @swift_nil_coalescing_expression ref, - int index: int ref, - unique int value: @swift_nil_coalescing_expression_value_type ref +swift_nested_type_identifier_def( + unique int id: @swift_nested_type_identifier ); swift_nil_coalescing_expression_def( - unique int id: @swift_nil_coalescing_expression + unique int id: @swift_nil_coalescing_expression, + int if_nil: @swift_expression ref, + int value: @swift_expression ref ); -@swift_opaque_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_opaque_type_def( unique int id: @swift_opaque_type, - int child: @swift_opaque_type_child_type ref -); - -@swift_open_end_range_expression_start_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_open_end_range_expression, index] -swift_open_end_range_expression_start( - int swift_open_end_range_expression: @swift_open_end_range_expression ref, - int index: int ref, - unique int start: @swift_open_end_range_expression_start_type ref + int child: @swift_unannotated_type ref ); swift_open_end_range_expression_def( - unique int id: @swift_open_end_range_expression -); - -@swift_open_start_range_expression_end_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_open_start_range_expression, index] -swift_open_start_range_expression_end( - int swift_open_start_range_expression: @swift_open_start_range_expression ref, - int index: int ref, - unique int end: @swift_open_start_range_expression_end_type ref + unique int id: @swift_open_end_range_expression, + int start: @swift_expression ref ); swift_open_start_range_expression_def( - unique int id: @swift_open_start_range_expression + unique int id: @swift_open_start_range_expression, + int end: @swift_expression ref ); -@swift_operator_declaration_child_type = @swift_deprecated_operator_declaration_body | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier +@swift_operator_declaration_child_type = @swift_deprecated_operator_declaration_body | @swift_referenceable_operator | @swift_token_simple_identifier #keyset[swift_operator_declaration, index] swift_operator_declaration_child( @@ -1678,6 +1285,11 @@ swift_operator_declaration_def( unique int id: @swift_operator_declaration ); +swift_optional_chain_marker_def( + unique int id: @swift_optional_chain_marker, + int child: @swift_expression ref +); + @swift_optional_type_wrapped_type = @swift_array_type | @swift_dictionary_type | @swift_tuple_type | @swift_user_type swift_optional_type_def( @@ -1690,23 +1302,7 @@ swift_parameter_external_name( unique int external_name: @swift_token_simple_identifier ref ); -@swift_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_parameter, index] -swift_parameter_name( - int swift_parameter: @swift_parameter ref, - int index: int ref, - unique int name: @swift_parameter_name_type ref -); - -@swift_parameter_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_parameter, index] -swift_parameter_type( - int swift_parameter: @swift_parameter ref, - int index: int ref, - unique int type__: @swift_parameter_type_type ref -); +@swift_parameter_type_type = @swift_implicitly_unwrapped_type | @swift_type__ swift_parameter_child( unique int swift_parameter: @swift_parameter ref, @@ -1714,7 +1310,9 @@ swift_parameter_child( ); swift_parameter_def( - unique int id: @swift_parameter + unique int id: @swift_parameter, + int name: @swift_token_simple_identifier ref, + int type__: @swift_parameter_type_type ref ); #keyset[swift_parameter_modifiers, index] @@ -1733,14 +1331,7 @@ swift_pattern_bound_identifier( unique int bound_identifier: @swift_token_simple_identifier ref ); -@swift_pattern_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -swift_pattern_name( - unique int swift_pattern: @swift_pattern ref, - unique int name: @swift_pattern_name_type ref -); - -@swift_pattern_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_type_modifiers | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_pattern_child_type = @swift_expression | @swift_pattern | @swift_token_wildcard_pattern | @swift_type__ | @swift_user_type | @swift_value_binding_pattern #keyset[swift_pattern, index] swift_pattern_child( @@ -1753,13 +1344,11 @@ swift_pattern_def( unique int id: @swift_pattern ); -@swift_playground_literal_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_playground_literal, index] swift_playground_literal_child( int swift_playground_literal: @swift_playground_literal ref, int index: int ref, - unique int child: @swift_playground_literal_child_type ref + unique int child: @swift_expression ref ); swift_playground_literal_def( @@ -1768,18 +1357,10 @@ swift_playground_literal_def( @swift_postfix_expression_operation_type = @swift_reserved_word | @swift_token_bang -@swift_postfix_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_postfix_expression, index] -swift_postfix_expression_target( - int swift_postfix_expression: @swift_postfix_expression ref, - int index: int ref, - unique int target: @swift_postfix_expression_target_type ref -); - swift_postfix_expression_def( unique int id: @swift_postfix_expression, - int operation: @swift_postfix_expression_operation_type ref + int operation: @swift_postfix_expression_operation_type ref, + int target: @swift_expression ref ); @swift_precedence_group_attribute_child_type = @swift_token_boolean_literal | @swift_token_simple_identifier @@ -1821,18 +1402,10 @@ swift_precedence_group_declaration_def( @swift_prefix_expression_operation_type = @swift_reserved_word | @swift_token_bang | @swift_token_custom_operator -@swift_prefix_expression_target_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token__expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_prefix_expression, index] -swift_prefix_expression_target( - int swift_prefix_expression: @swift_prefix_expression ref, - int index: int ref, - unique int target: @swift_prefix_expression_target_type ref -); - swift_prefix_expression_def( unique int id: @swift_prefix_expression, - int operation: @swift_prefix_expression_operation_type ref + int operation: @swift_prefix_expression_operation_type ref, + int target: @swift_expression ref ); #keyset[swift_property_declaration, index] @@ -1849,13 +1422,11 @@ swift_property_declaration_name( unique int name: @swift_pattern ref ); -@swift_property_declaration_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_property_declaration, index] swift_property_declaration_value( int swift_property_declaration: @swift_property_declaration ref, int index: int ref, - unique int value: @swift_property_declaration_value_type ref + unique int value: @swift_expression ref ); @swift_property_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_annotation | @swift_type_constraints | @swift_value_binding_pattern | @swift_willset_didset_block @@ -1871,33 +1442,22 @@ swift_property_declaration_def( unique int id: @swift_property_declaration ); -#keyset[swift_protocol_body, index] -swift_protocol_body_body( - int swift_protocol_body: @swift_protocol_body ref, - int index: int ref, - unique int body: @swift_protocol_function_declaration ref -); - -@swift_protocol_body_child_type = @swift_associatedtype_declaration | @swift_deinit_declaration | @swift_init_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_subscript_declaration | @swift_typealias_declaration - #keyset[swift_protocol_body, index] swift_protocol_body_child( int swift_protocol_body: @swift_protocol_body ref, int index: int ref, - unique int child: @swift_protocol_body_child_type ref + unique int child: @swift_protocol_member_declaration ref ); swift_protocol_body_def( unique int id: @swift_protocol_body ); -@swift_protocol_composition_type_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - #keyset[swift_protocol_composition_type, index] swift_protocol_composition_type_child( int swift_protocol_composition_type: @swift_protocol_composition_type ref, int index: int ref, - unique int child: @swift_protocol_composition_type_child_type ref + unique int child: @swift_unannotated_type ref ); swift_protocol_composition_type_def( @@ -1925,34 +1485,28 @@ swift_protocol_declaration_def( int name: @swift_token_type_identifier ref ); -@swift_protocol_function_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +swift_protocol_function_declaration_body( + unique int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, + unique int body: @swift_function_body ref +); #keyset[swift_protocol_function_declaration, index] swift_protocol_function_declaration_default_value( int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, int index: int ref, - unique int default_value: @swift_protocol_function_declaration_default_value_type ref + unique int default_value: @swift_expression ref ); -@swift_protocol_function_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_token_bang | @swift_token_custom_operator | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_protocol_function_declaration, index] -swift_protocol_function_declaration_name( - int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, - int index: int ref, - unique int name: @swift_protocol_function_declaration_name_type ref -); +@swift_protocol_function_declaration_name_type = @swift_referenceable_operator | @swift_token_simple_identifier -@swift_protocol_function_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_protocol_function_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_protocol_function_declaration, index] swift_protocol_function_declaration_return_type( - int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, - int index: int ref, + unique int swift_protocol_function_declaration: @swift_protocol_function_declaration ref, unique int return_type: @swift_protocol_function_declaration_return_type_type ref ); -@swift_protocol_function_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_statements | @swift_throws_clause | @swift_token_throws | @swift_type_constraints | @swift_type_parameters +@swift_protocol_function_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_parameter | @swift_throws_clause | @swift_token_throws | @swift_type_constraints | @swift_type_parameters #keyset[swift_protocol_function_declaration, index] swift_protocol_function_declaration_child( @@ -1962,9 +1516,12 @@ swift_protocol_function_declaration_child( ); swift_protocol_function_declaration_def( - unique int id: @swift_protocol_function_declaration + unique int id: @swift_protocol_function_declaration, + int name: @swift_protocol_function_declaration_name_type ref ); +@swift_protocol_member_declaration = @swift_associatedtype_declaration | @swift_deinit_declaration | @swift_init_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_subscript_declaration | @swift_typealias_declaration + @swift_protocol_property_declaration_child_type = @swift_modifiers | @swift_protocol_property_requirements | @swift_type_annotation | @swift_type_constraints #keyset[swift_protocol_property_declaration, index] @@ -1992,33 +1549,17 @@ swift_protocol_property_requirements_def( unique int id: @swift_protocol_property_requirements ); -@swift_range_expression_end_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_range_expression, index] -swift_range_expression_end( - int swift_range_expression: @swift_range_expression ref, - int index: int ref, - unique int end: @swift_range_expression_end_type ref -); - case @swift_range_expression.op of 0 = @swift_range_expression_dotdotdot | 1 = @swift_range_expression_dotdotlangle ; -@swift_range_expression_start_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_range_expression, index] -swift_range_expression_start( - int swift_range_expression: @swift_range_expression ref, - int index: int ref, - unique int start: @swift_range_expression_start_type ref -); - swift_range_expression_def( unique int id: @swift_range_expression, - int op: int ref + int end: @swift_expression ref, + int op: int ref, + int start: @swift_expression ref ); #keyset[swift_raw_str_interpolation, index] @@ -2060,29 +1601,22 @@ swift_raw_string_literal_def( unique int id: @swift_raw_string_literal ); -#keyset[swift_repeat_while_statement, index] -swift_repeat_while_statement_bound_identifier( - int swift_repeat_while_statement: @swift_repeat_while_statement ref, - int index: int ref, - unique int bound_identifier: @swift_token_simple_identifier ref -); - -@swift_repeat_while_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause +@swift_referenceable_operator_child_type = @swift_token_bang | @swift_token_custom_operator -#keyset[swift_repeat_while_statement, index] -swift_repeat_while_statement_condition( - int swift_repeat_while_statement: @swift_repeat_while_statement ref, - int index: int ref, - unique int condition: @swift_repeat_while_statement_condition_type ref +swift_referenceable_operator_child( + unique int swift_referenceable_operator: @swift_referenceable_operator ref, + unique int child: @swift_referenceable_operator_child_type ref ); -@swift_repeat_while_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +swift_referenceable_operator_def( + unique int id: @swift_referenceable_operator +); #keyset[swift_repeat_while_statement, index] -swift_repeat_while_statement_name( +swift_repeat_while_statement_condition( int swift_repeat_while_statement: @swift_repeat_while_statement ref, int index: int ref, - unique int name: @swift_repeat_while_statement_name_type ref + unique int condition: @swift_if_condition ref ); swift_repeat_while_statement_child( @@ -2094,15 +1628,9 @@ swift_repeat_while_statement_def( unique int id: @swift_repeat_while_statement ); -@swift_selector_expression_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -swift_selector_expression_child( - unique int swift_selector_expression: @swift_selector_expression ref, - unique int child: @swift_selector_expression_child_type ref -); - swift_selector_expression_def( - unique int id: @swift_selector_expression + unique int id: @swift_selector_expression, + int child: @swift_expression ref ); swift_setter_specifier_child( @@ -2114,7 +1642,7 @@ swift_setter_specifier_def( unique int id: @swift_setter_specifier ); -@swift_source_file_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_class_declaration | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_do_statement | @swift_equality_expression | @swift_for_statement | @swift_function_declaration | @swift_guard_statement | @swift_if_statement | @swift_import_declaration | @swift_infix_expression | @swift_init_declaration | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_declaration | @swift_range_expression | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_shebang_line | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_statement_label | @swift_token_super_expression | @swift_token_throw_keyword | @swift_try_expression | @swift_tuple_expression | @swift_typealias_declaration | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_while_statement +@swift_source_file_child_type = @swift_do_statement | @swift_expression | @swift_for_statement | @swift_global_declaration | @swift_guard_statement | @swift_repeat_while_statement | @swift_token_shebang_line | @swift_token_statement_label | @swift_token_throw_keyword | @swift_while_statement #keyset[swift_source_file, index] swift_source_file_child( @@ -2127,7 +1655,7 @@ swift_source_file_def( unique int id: @swift_source_file ); -@swift_statements_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_class_declaration | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_control_transfer_statement | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_do_statement | @swift_equality_expression | @swift_for_statement | @swift_function_declaration | @swift_guard_statement | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_property_declaration | @swift_range_expression | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_statement_label | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_typealias_declaration | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_while_statement +@swift_statements_child_type = @swift_control_transfer_statement | @swift_do_statement | @swift_expression | @swift_for_statement | @swift_guard_statement | @swift_local_declaration | @swift_repeat_while_statement | @swift_token_statement_label | @swift_while_statement #keyset[swift_statements, index] swift_statements_child( @@ -2140,28 +1668,17 @@ swift_statements_def( unique int id: @swift_statements ); -@swift_subscript_declaration_default_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_subscript_declaration, index] swift_subscript_declaration_default_value( int swift_subscript_declaration: @swift_subscript_declaration ref, int index: int ref, - unique int default_value: @swift_subscript_declaration_default_value_type ref -); - -@swift_subscript_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -swift_subscript_declaration_name( - unique int swift_subscript_declaration: @swift_subscript_declaration ref, - unique int name: @swift_subscript_declaration_name_type ref + unique int default_value: @swift_expression ref ); -@swift_subscript_declaration_return_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_subscript_declaration_return_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_subscript_declaration, index] swift_subscript_declaration_return_type( - int swift_subscript_declaration: @swift_subscript_declaration ref, - int index: int ref, + unique int swift_subscript_declaration: @swift_subscript_declaration ref, unique int return_type: @swift_subscript_declaration_return_type_type ref ); @@ -2183,7 +1700,7 @@ swift_suppressed_constraint_def( int suppressed: @swift_token_type_identifier ref ); -@swift_switch_entry_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_modifiers | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_statements | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_default_keyword | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_where_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_switch_entry_child_type = @swift_expression | @swift_modifiers | @swift_statements | @swift_switch_pattern | @swift_token_default_keyword | @swift_token_where_keyword #keyset[swift_switch_entry, index] swift_switch_entry_child( @@ -2201,15 +1718,6 @@ swift_switch_pattern_def( int child: @swift_pattern ref ); -@swift_switch_statement_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_switch_statement, index] -swift_switch_statement_expr( - int swift_switch_statement: @swift_switch_statement ref, - int index: int ref, - unique int expr: @swift_switch_statement_expr_type ref -); - #keyset[swift_switch_statement, index] swift_switch_statement_child( int swift_switch_statement: @swift_switch_statement ref, @@ -2218,58 +1726,25 @@ swift_switch_statement_child( ); swift_switch_statement_def( - unique int id: @swift_switch_statement -); - -@swift_ternary_expression_condition_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_ternary_expression, index] -swift_ternary_expression_condition( - int swift_ternary_expression: @swift_ternary_expression ref, - int index: int ref, - unique int condition: @swift_ternary_expression_condition_type ref -); - -@swift_ternary_expression_if_false_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_ternary_expression, index] -swift_ternary_expression_if_false( - int swift_ternary_expression: @swift_ternary_expression ref, - int index: int ref, - unique int if_false: @swift_ternary_expression_if_false_type ref -); - -@swift_ternary_expression_if_true_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_ternary_expression, index] -swift_ternary_expression_if_true( - int swift_ternary_expression: @swift_ternary_expression ref, - int index: int ref, - unique int if_true: @swift_ternary_expression_if_true_type ref + unique int id: @swift_switch_statement, + int expr: @swift_expression ref ); swift_ternary_expression_def( - unique int id: @swift_ternary_expression + unique int id: @swift_ternary_expression, + int condition: @swift_expression ref, + int if_false: @swift_expression ref, + int if_true: @swift_expression ref ); -@swift_throws_clause_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_throws_clause_def( unique int id: @swift_throws_clause, - int type__: @swift_throws_clause_type_type ref -); - -@swift_try_expression_expr_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_try_expression, index] -swift_try_expression_expr( - int swift_try_expression: @swift_try_expression ref, - int index: int ref, - unique int expr: @swift_try_expression_expr_type ref + int type__: @swift_unannotated_type ref ); swift_try_expression_def( unique int id: @swift_try_expression, + int expr: @swift_expression ref, int child: @swift_token_try_operator ref ); @@ -2280,13 +1755,11 @@ swift_tuple_expression_name( unique int name: @swift_token_simple_identifier ref ); -@swift_tuple_expression_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - #keyset[swift_tuple_expression, index] swift_tuple_expression_value( int swift_tuple_expression: @swift_tuple_expression ref, int index: int ref, - unique int value: @swift_tuple_expression_value_type ref + unique int value: @swift_expression ref ); swift_tuple_expression_def( @@ -2309,32 +1782,17 @@ swift_tuple_type_def( unique int id: @swift_tuple_type ); -@swift_tuple_type_item_element_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type - -swift_tuple_type_item_element( - unique int swift_tuple_type_item: @swift_tuple_type_item ref, - unique int element: @swift_tuple_type_item_element_type ref -); - -@swift_tuple_type_item_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_simple_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_tuple_type_item, index] swift_tuple_type_item_name( - int swift_tuple_type_item: @swift_tuple_type_item ref, - int index: int ref, - unique int name: @swift_tuple_type_item_name_type ref + unique int swift_tuple_type_item: @swift_tuple_type_item ref, + unique int name: @swift_token_simple_identifier ref ); -@swift_tuple_type_item_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_tuple_type_item, index] swift_tuple_type_item_type( - int swift_tuple_type_item: @swift_tuple_type_item ref, - int index: int ref, - unique int type__: @swift_tuple_type_item_type_type ref + unique int swift_tuple_type_item: @swift_tuple_type_item ref, + unique int type__: @swift_type__ ref ); -@swift_tuple_type_item_child_type = @swift_parameter_modifiers | @swift_token_wildcard_pattern +@swift_tuple_type_item_child_type = @swift_dictionary_type | @swift_existential_type | @swift_opaque_type | @swift_parameter_modifiers | @swift_token_wildcard_pattern #keyset[swift_tuple_type_item, index] swift_tuple_type_item_child( @@ -2347,36 +1805,28 @@ swift_tuple_type_item_def( unique int id: @swift_tuple_type_item ); -@swift_type_annotation_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -@swift_type_annotation_type_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_reserved_word | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_type_annotation, index] -swift_type_annotation_type( - int swift_type_annotation: @swift_type_annotation ref, - int index: int ref, - unique int type__: @swift_type_annotation_type_type ref +swift_type_modifiers( + unique int swift_type__: @swift_type__ ref, + unique int modifiers: @swift_type_modifiers ref ); -swift_type_annotation_def( - unique int id: @swift_type_annotation, - int name: @swift_type_annotation_name_type ref +swift_type_def( + unique int id: @swift_type__, + int name: @swift_unannotated_type ref ); -@swift_type_arguments_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type +@swift_type_annotation_type_type = @swift_implicitly_unwrapped_type | @swift_type__ -#keyset[swift_type_arguments, index] -swift_type_arguments_name( - int swift_type_arguments: @swift_type_arguments ref, - int index: int ref, - unique int name: @swift_type_arguments_name_type ref +swift_type_annotation_def( + unique int id: @swift_type_annotation, + int type__: @swift_type_annotation_type_type ref ); #keyset[swift_type_arguments, index] swift_type_arguments_child( int swift_type_arguments: @swift_type_arguments ref, int index: int ref, - unique int child: @swift_type_modifiers ref + unique int child: @swift_type__ ref ); swift_type_arguments_def( @@ -2403,6 +1853,8 @@ swift_type_constraints_def( unique int id: @swift_type_constraints ); +@swift_type_level_declaration = @swift_associatedtype_declaration | @swift_class_declaration | @swift_deinit_declaration | @swift_function_declaration | @swift_import_declaration | @swift_init_declaration | @swift_operator_declaration | @swift_precedence_group_declaration | @swift_property_declaration | @swift_protocol_declaration | @swift_subscript_declaration | @swift_typealias_declaration + #keyset[swift_type_modifiers, index] swift_type_modifiers_child( int swift_type_modifiers: @swift_type_modifiers ref, @@ -2414,21 +1866,12 @@ swift_type_modifiers_def( unique int id: @swift_type_modifiers ); -@swift_type_pack_expansion_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_type_pack_expansion_def( unique int id: @swift_type_pack_expansion, - int child: @swift_type_pack_expansion_child_type ref -); - -@swift_type_parameter_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -swift_type_parameter_name( - unique int swift_type_parameter: @swift_type_parameter ref, - unique int name: @swift_type_parameter_name_type ref + int child: @swift_unannotated_type ref ); -@swift_type_parameter_child_type = @swift_token_type_identifier | @swift_type_modifiers | @swift_type_parameter_modifiers | @swift_type_parameter_pack +@swift_type_parameter_child_type = @swift_token_type_identifier | @swift_type__ | @swift_type_parameter_modifiers | @swift_type_parameter_pack #keyset[swift_type_parameter, index] swift_type_parameter_child( @@ -2452,11 +1895,9 @@ swift_type_parameter_modifiers_def( unique int id: @swift_type_parameter_modifiers ); -@swift_type_parameter_pack_child_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - swift_type_parameter_pack_def( unique int id: @swift_type_parameter_pack, - int child: @swift_type_parameter_pack_child_type ref + int child: @swift_unannotated_type ref ); @swift_type_parameters_child_type = @swift_type_constraints | @swift_type_parameter @@ -2472,24 +1913,6 @@ swift_type_parameters_def( unique int id: @swift_type_parameters ); -@swift_typealias_declaration_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_token_type_identifier | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_typealias_declaration, index] -swift_typealias_declaration_name( - int swift_typealias_declaration: @swift_typealias_declaration ref, - int index: int ref, - unique int name: @swift_typealias_declaration_name_type ref -); - -@swift_typealias_declaration_value_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_typealias_declaration, index] -swift_typealias_declaration_value( - int swift_typealias_declaration: @swift_typealias_declaration ref, - int index: int ref, - unique int value: @swift_typealias_declaration_value_type ref -); - @swift_typealias_declaration_child_type = @swift_attribute | @swift_modifiers | @swift_token_inheritance_modifier | @swift_token_ownership_modifier | @swift_token_property_behavior_modifier | @swift_type_parameters #keyset[swift_typealias_declaration, index] @@ -2500,9 +1923,13 @@ swift_typealias_declaration_child( ); swift_typealias_declaration_def( - unique int id: @swift_typealias_declaration + unique int id: @swift_typealias_declaration, + int name: @swift_token_type_identifier ref, + int value: @swift_type__ ref ); +@swift_unannotated_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type + @swift_user_type_child_type = @swift_token_type_identifier | @swift_type_arguments #keyset[swift_user_type, index] @@ -2528,13 +1955,9 @@ swift_value_argument_reference_specifier( unique int reference_specifier: @swift_value_argument_label ref ); -@swift_value_argument_value_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -#keyset[swift_value_argument, index] swift_value_argument_value( - int swift_value_argument: @swift_value_argument ref, - int index: int ref, - unique int value: @swift_value_argument_value_type ref + unique int swift_value_argument: @swift_value_argument ref, + unique int value: @swift_expression ref ); swift_value_argument_child( @@ -2573,29 +1996,17 @@ swift_value_binding_pattern_def( int mutability: int ref ); -@swift_value_pack_expansion_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -swift_value_pack_expansion_child( - unique int swift_value_pack_expansion: @swift_value_pack_expansion ref, - unique int child: @swift_value_pack_expansion_child_type ref -); - swift_value_pack_expansion_def( - unique int id: @swift_value_pack_expansion -); - -@swift_value_parameter_pack_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack - -swift_value_parameter_pack_child( - unique int swift_value_parameter_pack: @swift_value_parameter_pack ref, - unique int child: @swift_value_parameter_pack_child_type ref + unique int id: @swift_value_pack_expansion, + int child: @swift_expression ref ); swift_value_parameter_pack_def( - unique int id: @swift_value_parameter_pack + unique int id: @swift_value_parameter_pack, + int child: @swift_expression ref ); -@swift_where_clause_child_type = @swift_additive_expression | @swift_array_literal | @swift_as_expression | @swift_assignment | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_range_expression | @swift_raw_string_literal | @swift_selector_expression | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_where_keyword | @swift_try_expression | @swift_tuple_expression | @swift_value_pack_expansion | @swift_value_parameter_pack +@swift_where_clause_child_type = @swift_expression | @swift_token_where_keyword #keyset[swift_where_clause, index] swift_where_clause_child( @@ -2608,29 +2019,11 @@ swift_where_clause_def( unique int id: @swift_where_clause ); -#keyset[swift_while_statement, index] -swift_while_statement_bound_identifier( - int swift_while_statement: @swift_while_statement ref, - int index: int ref, - unique int bound_identifier: @swift_token_simple_identifier ref -); - -@swift_while_statement_condition_type = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_check_expression | @swift_comparison_expression | @swift_conjunction_expression | @swift_constructor_expression | @swift_dictionary_literal | @swift_dictionary_type | @swift_directive | @swift_disjunction_expression | @swift_equality_expression | @swift_existential_type | @swift_function_type | @swift_if_statement | @swift_infix_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_literal | @swift_line_string_literal | @swift_macro_invocation | @swift_metatype | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_optional_type | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_prefix_expression | @swift_protocol_composition_type | @swift_range_expression | @swift_raw_string_literal | @swift_reserved_word | @swift_selector_expression | @swift_suppressed_constraint | @swift_switch_statement | @swift_ternary_expression | @swift_token_bang | @swift_token_bin_literal | @swift_token_boolean_literal | @swift_token_custom_operator | @swift_token_diagnostic | @swift_token_fully_open_range | @swift_token_hex_literal | @swift_token_integer_literal | @swift_token_oct_literal | @swift_token_real_literal | @swift_token_regex_literal | @swift_token_self_expression | @swift_token_simple_identifier | @swift_token_special_literal | @swift_token_super_expression | @swift_token_wildcard_pattern | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_type_annotation | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause - #keyset[swift_while_statement, index] swift_while_statement_condition( int swift_while_statement: @swift_while_statement ref, int index: int ref, - unique int condition: @swift_while_statement_condition_type ref -); - -@swift_while_statement_name_type = @swift_array_type | @swift_dictionary_type | @swift_existential_type | @swift_function_type | @swift_metatype | @swift_opaque_type | @swift_optional_type | @swift_protocol_composition_type | @swift_suppressed_constraint | @swift_tuple_type | @swift_type_pack_expansion | @swift_type_parameter_pack | @swift_user_type - -#keyset[swift_while_statement, index] -swift_while_statement_name( - int swift_while_statement: @swift_while_statement ref, - int index: int ref, - unique int name: @swift_while_statement_name_type ref + unique int condition: @swift_if_condition ref ); swift_while_statement_child( @@ -2676,56 +2069,55 @@ swift_tokeninfo( case @swift_token.kind of 0 = @swift_reserved_word -| 1 = @swift_token__expression -| 2 = @swift_token_as_operator -| 3 = @swift_token_bang -| 4 = @swift_token_bin_literal -| 5 = @swift_token_boolean_literal -| 6 = @swift_token_catch_keyword -| 7 = @swift_token_comment -| 8 = @swift_token_custom_operator -| 9 = @swift_token_default_keyword -| 10 = @swift_token_diagnostic -| 11 = @swift_token_else -| 12 = @swift_token_fully_open_range -| 13 = @swift_token_function_modifier -| 14 = @swift_token_hex_literal -| 15 = @swift_token_inheritance_modifier -| 16 = @swift_token_integer_literal -| 17 = @swift_token_line_str_text -| 18 = @swift_token_member_modifier -| 19 = @swift_token_multi_line_str_text -| 20 = @swift_token_multiline_comment -| 21 = @swift_token_mutation_modifier -| 22 = @swift_token_oct_literal -| 23 = @swift_token_ownership_modifier -| 24 = @swift_token_parameter_modifier -| 25 = @swift_token_property_behavior_modifier -| 26 = @swift_token_property_modifier -| 27 = @swift_token_raw_str_continuing_indicator -| 28 = @swift_token_raw_str_end_part -| 29 = @swift_token_raw_str_interpolation_start -| 30 = @swift_token_raw_str_part -| 31 = @swift_token_real_literal -| 32 = @swift_token_regex_literal -| 33 = @swift_token_self_expression -| 34 = @swift_token_shebang_line -| 35 = @swift_token_simple_identifier -| 36 = @swift_token_special_literal -| 37 = @swift_token_statement_label -| 38 = @swift_token_str_escaped_char -| 39 = @swift_token_super_expression -| 40 = @swift_token_throw_keyword -| 41 = @swift_token_throws -| 42 = @swift_token_try_operator -| 43 = @swift_token_type_identifier -| 44 = @swift_token_visibility_modifier -| 45 = @swift_token_where_keyword -| 46 = @swift_token_wildcard_pattern +| 1 = @swift_token_as_operator +| 2 = @swift_token_bang +| 3 = @swift_token_bin_literal +| 4 = @swift_token_boolean_literal +| 5 = @swift_token_catch_keyword +| 6 = @swift_token_comment +| 7 = @swift_token_custom_operator +| 8 = @swift_token_default_keyword +| 9 = @swift_token_diagnostic +| 10 = @swift_token_else +| 11 = @swift_token_fully_open_range +| 12 = @swift_token_function_modifier +| 13 = @swift_token_hex_literal +| 14 = @swift_token_inheritance_modifier +| 15 = @swift_token_integer_literal +| 16 = @swift_token_line_str_text +| 17 = @swift_token_member_modifier +| 18 = @swift_token_multi_line_str_text +| 19 = @swift_token_multiline_comment +| 20 = @swift_token_mutation_modifier +| 21 = @swift_token_oct_literal +| 22 = @swift_token_ownership_modifier +| 23 = @swift_token_parameter_modifier +| 24 = @swift_token_property_behavior_modifier +| 25 = @swift_token_property_modifier +| 26 = @swift_token_raw_str_continuing_indicator +| 27 = @swift_token_raw_str_end_part +| 28 = @swift_token_raw_str_interpolation_start +| 29 = @swift_token_raw_str_part +| 30 = @swift_token_real_literal +| 31 = @swift_token_regex_literal +| 32 = @swift_token_self_expression +| 33 = @swift_token_shebang_line +| 34 = @swift_token_simple_identifier +| 35 = @swift_token_special_literal +| 36 = @swift_token_statement_label +| 37 = @swift_token_str_escaped_char +| 38 = @swift_token_super_expression +| 39 = @swift_token_throw_keyword +| 40 = @swift_token_throws +| 41 = @swift_token_try_operator +| 42 = @swift_token_type_identifier +| 43 = @swift_token_visibility_modifier +| 44 = @swift_token_where_keyword +| 45 = @swift_token_wildcard_pattern ; -@swift_ast_node = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_attribute | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_capture_list | @swift_capture_list_item | @swift_catch_block | @swift_check_expression | @swift_class_body | @swift_class_declaration | @swift_comparison_expression | @swift_computed_getter | @swift_computed_modify | @swift_computed_property | @swift_computed_setter | @swift_conjunction_expression | @swift_constructor_expression | @swift_constructor_suffix | @swift_control_transfer_statement | @swift_deinit_declaration | @swift_deprecated_operator_declaration_body | @swift_dictionary_literal | @swift_dictionary_type | @swift_didset_clause | @swift_directive | @swift_directly_assignable_expression | @swift_disjunction_expression | @swift_do_statement | @swift_enum_class_body | @swift_enum_entry | @swift_enum_type_parameters | @swift_equality_constraint | @swift_equality_expression | @swift_existential_type | @swift_external_macro_definition | @swift_for_statement | @swift_function_body | @swift_function_declaration | @swift_function_type | @swift_getter_specifier | @swift_guard_statement | @swift_identifier | @swift_if_statement | @swift_import_declaration | @swift_infix_expression | @swift_inheritance_constraint | @swift_inheritance_specifier | @swift_init_declaration | @swift_interpolated_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_function_type | @swift_lambda_function_type_parameters | @swift_lambda_literal | @swift_lambda_parameter | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_definition | @swift_macro_invocation | @swift_metatype | @swift_modifiers | @swift_modify_specifier | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_navigation_suffix | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_optional_type | @swift_parameter | @swift_parameter_modifiers | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_attribute | @swift_precedence_group_attributes | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_body | @swift_protocol_composition_type | @swift_protocol_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_protocol_property_requirements | @swift_range_expression | @swift_raw_str_interpolation | @swift_raw_string_literal | @swift_repeat_while_statement | @swift_selector_expression | @swift_setter_specifier | @swift_source_file | @swift_statements | @swift_subscript_declaration | @swift_suppressed_constraint | @swift_switch_entry | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_throws_clause | @swift_token | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_tuple_type_item | @swift_type_annotation | @swift_type_arguments | @swift_type_constraint | @swift_type_constraints | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter | @swift_type_parameter_modifiers | @swift_type_parameter_pack | @swift_type_parameters | @swift_typealias_declaration | @swift_user_type | @swift_value_argument | @swift_value_argument_label | @swift_value_arguments | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause | @swift_while_statement | @swift_willset_clause | @swift_willset_didset_block +@swift_ast_node = @swift_additive_expression | @swift_array_literal | @swift_array_type | @swift_as_expression | @swift_assignment | @swift_associatedtype_declaration | @swift_attribute | @swift_availability_condition | @swift_await_expression | @swift_bitwise_operation | @swift_call_expression | @swift_call_suffix | @swift_capture_list | @swift_capture_list_item | @swift_catch_block | @swift_check_expression | @swift_class_body | @swift_class_declaration | @swift_comparison_expression | @swift_computed_getter | @swift_computed_modify | @swift_computed_property | @swift_computed_setter | @swift_conjunction_expression | @swift_constructor_expression | @swift_constructor_suffix | @swift_control_transfer_statement | @swift_deinit_declaration | @swift_deprecated_operator_declaration_body | @swift_dictionary_literal | @swift_dictionary_type | @swift_didset_clause | @swift_directive | @swift_directly_assignable_expression | @swift_disjunction_expression | @swift_do_statement | @swift_enum_class_body | @swift_enum_entry | @swift_enum_type_parameters | @swift_equality_constraint | @swift_equality_expression | @swift_existential_type | @swift_external_macro_definition | @swift_for_statement | @swift_function_body | @swift_function_declaration | @swift_function_type | @swift_getter_specifier | @swift_guard_statement | @swift_identifier | @swift_if_condition | @swift_if_let_binding | @swift_if_statement | @swift_implicitly_unwrapped_type | @swift_import_declaration | @swift_infix_expression | @swift_inheritance_constraint | @swift_inheritance_specifier | @swift_init_declaration | @swift_interpolated_expression | @swift_key_path_expression | @swift_key_path_string_expression | @swift_lambda_function_type | @swift_lambda_function_type_parameters | @swift_lambda_literal | @swift_lambda_parameter | @swift_line_string_literal | @swift_macro_declaration | @swift_macro_definition | @swift_macro_invocation | @swift_metatype | @swift_modifiers | @swift_modify_specifier | @swift_multi_line_string_literal | @swift_multiplicative_expression | @swift_navigation_expression | @swift_navigation_suffix | @swift_nested_type_identifier | @swift_nil_coalescing_expression | @swift_opaque_type | @swift_open_end_range_expression | @swift_open_start_range_expression | @swift_operator_declaration | @swift_optional_chain_marker | @swift_optional_type | @swift_parameter | @swift_parameter_modifiers | @swift_pattern | @swift_playground_literal | @swift_postfix_expression | @swift_precedence_group_attribute | @swift_precedence_group_attributes | @swift_precedence_group_declaration | @swift_prefix_expression | @swift_property_declaration | @swift_protocol_body | @swift_protocol_composition_type | @swift_protocol_declaration | @swift_protocol_function_declaration | @swift_protocol_property_declaration | @swift_protocol_property_requirements | @swift_range_expression | @swift_raw_str_interpolation | @swift_raw_string_literal | @swift_referenceable_operator | @swift_repeat_while_statement | @swift_selector_expression | @swift_setter_specifier | @swift_source_file | @swift_statements | @swift_subscript_declaration | @swift_suppressed_constraint | @swift_switch_entry | @swift_switch_pattern | @swift_switch_statement | @swift_ternary_expression | @swift_throws_clause | @swift_token | @swift_try_expression | @swift_tuple_expression | @swift_tuple_type | @swift_tuple_type_item | @swift_type__ | @swift_type_annotation | @swift_type_arguments | @swift_type_constraint | @swift_type_constraints | @swift_type_modifiers | @swift_type_pack_expansion | @swift_type_parameter | @swift_type_parameter_modifiers | @swift_type_parameter_pack | @swift_type_parameters | @swift_typealias_declaration | @swift_user_type | @swift_value_argument | @swift_value_argument_label | @swift_value_arguments | @swift_value_binding_pattern | @swift_value_pack_expansion | @swift_value_parameter_pack | @swift_where_clause | @swift_while_statement | @swift_willset_clause | @swift_willset_didset_block swift_ast_node_location( unique int node: @swift_ast_node ref, diff --git a/unified/scripts/regenerate-grammar.sh b/unified/scripts/regenerate-grammar.sh new file mode 100755 index 000000000000..b7a5ce263fb8 --- /dev/null +++ b/unified/scripts/regenerate-grammar.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Regenerate the vendored tree-sitter-swift parser tables from grammar.js, +# then refresh the human-readable node-types.yml companion file. +# +# Run this after editing +# unified/extractor/tree-sitter-swift/grammar.js so that: +# * src/parser.c, src/grammar.json, src/node-types.json (and the +# src/tree_sitter/*.h headers) reflect the current grammar; and +# * node-types.yml shows the same information in a form that's +# pleasant to review in PR diffs. +# +# Requirements: tree-sitter CLI on PATH, and a working cargo toolchain. +set -euo pipefail + +cd "$(dirname "$0")/.." +SWIFT_DIR="extractor/tree-sitter-swift" + +( + cd "$SWIFT_DIR" + tree-sitter generate +) + +# Build yeast's node_types_yaml binary and use it to convert the freshly +# generated src/node-types.json into the human-readable node-types.yml. +cargo run --release --quiet -p yeast --bin node_types_yaml -- \ + --from-json "$SWIFT_DIR/src/node-types.json" > "$SWIFT_DIR/node-types.yml" + +echo "Regenerated $SWIFT_DIR/{src/parser.c,src/grammar.json,src/node-types.json,node-types.yml}"