diff --git a/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/iac.dbscheme b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/iac.dbscheme new file mode 100644 index 000000000000..e360faddae54 --- /dev/null +++ b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/iac.dbscheme @@ -0,0 +1,1511 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + +/*- BICEP dbscheme -*/ +#keyset[bicep_arguments, index] +bicep_arguments_child( + int bicep_arguments: @bicep_arguments ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_arguments_def( + unique int id: @bicep_arguments +); + +@bicep_array_child_type = @bicep_decorators | @bicep_expression + +#keyset[bicep_array, index] +bicep_array_child( + int bicep_array: @bicep_array ref, + int index: int ref, + unique int child: @bicep_array_child_type ref +); + +bicep_array_def( + unique int id: @bicep_array +); + +bicep_array_type_def( + unique int id: @bicep_array_type, + int child: @bicep_type__ ref +); + +bicep_assert_statement_def( + unique int id: @bicep_assert_statement, + int name: @bicep_token_identifier ref, + int child: @bicep_expression ref +); + +@bicep_assignment_expression_left_type = @bicep_member_expression | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_subscript_expression | @bicep_token_identifier + +bicep_assignment_expression_def( + unique int id: @bicep_assignment_expression, + int left: @bicep_assignment_expression_left_type ref, + int right: @bicep_expression ref +); + +case @bicep_binary_expression.operator of + 0 = @bicep_binary_expression_bangequal +| 1 = @bicep_binary_expression_bangtilde +| 2 = @bicep_binary_expression_percent +| 3 = @bicep_binary_expression_ampersandampersand +| 4 = @bicep_binary_expression_star +| 5 = @bicep_binary_expression_plus +| 6 = @bicep_binary_expression_minus +| 7 = @bicep_binary_expression_slash +| 8 = @bicep_binary_expression_langle +| 9 = @bicep_binary_expression_langleequal +| 10 = @bicep_binary_expression_equalequal +| 11 = @bicep_binary_expression_equaltilde +| 12 = @bicep_binary_expression_rangle +| 13 = @bicep_binary_expression_rangleequal +| 14 = @bicep_binary_expression_questionquestion +| 15 = @bicep_binary_expression_pipe +| 16 = @bicep_binary_expression_pipepipe +; + + +bicep_binary_expression_def( + unique int id: @bicep_binary_expression, + int left: @bicep_expression ref, + int operator: int ref, + int right: @bicep_expression ref +); + +bicep_call_expression_child( + unique int bicep_call_expression: @bicep_call_expression ref, + unique int child: @bicep_token_nullable_return_type ref +); + +bicep_call_expression_def( + unique int id: @bicep_call_expression, + int arguments: @bicep_arguments ref, + int function: @bicep_expression ref +); + +bicep_compatible_identifier_def( + unique int id: @bicep_compatible_identifier, + int child: @bicep_token_identifier ref +); + +@bicep_declaration = @bicep_assert_statement | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_output_declaration | @bicep_parameter_declaration | @bicep_resource_declaration | @bicep_test_block | @bicep_type_declaration | @bicep_user_defined_function | @bicep_variable_declaration + +bicep_decorator_def( + unique int id: @bicep_decorator, + int child: @bicep_call_expression ref +); + +#keyset[bicep_decorators, index] +bicep_decorators_child( + int bicep_decorators: @bicep_decorators ref, + int index: int ref, + unique int child: @bicep_decorator ref +); + +bicep_decorators_def( + unique int id: @bicep_decorators +); + +@bicep_expression = @bicep_assignment_expression | @bicep_binary_expression | @bicep_lambda_expression | @bicep_primary_expression | @bicep_ternary_expression | @bicep_unary_expression + +@bicep_for_loop_parameters_child_type = @bicep_token_loop_enumerator | @bicep_token_loop_variable + +#keyset[bicep_for_loop_parameters, index] +bicep_for_loop_parameters_child( + int bicep_for_loop_parameters: @bicep_for_loop_parameters ref, + int index: int ref, + unique int child: @bicep_for_loop_parameters_child_type ref +); + +bicep_for_loop_parameters_def( + unique int id: @bicep_for_loop_parameters +); + +@bicep_for_statement_body_type = @bicep_expression | @bicep_if_statement + +bicep_for_statement_initializer( + unique int bicep_for_statement: @bicep_for_statement ref, + unique int initializer: @bicep_token_identifier ref +); + +@bicep_for_statement_child_type = @bicep_expression | @bicep_for_loop_parameters + +#keyset[bicep_for_statement, index] +bicep_for_statement_child( + int bicep_for_statement: @bicep_for_statement ref, + int index: int ref, + unique int child: @bicep_for_statement_child_type ref +); + +bicep_for_statement_def( + unique int id: @bicep_for_statement, + int body: @bicep_for_statement_body_type ref +); + +@bicep_if_statement_child_type = @bicep_object | @bicep_parenthesized_expression + +#keyset[bicep_if_statement, index] +bicep_if_statement_child( + int bicep_if_statement: @bicep_if_statement ref, + int index: int ref, + unique int child: @bicep_if_statement_child_type ref +); + +bicep_if_statement_def( + unique int id: @bicep_if_statement +); + +@bicep_import_functionality_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_functionality, index] +bicep_import_functionality_child( + int bicep_import_functionality: @bicep_import_functionality ref, + int index: int ref, + unique int child: @bicep_import_functionality_child_type ref +); + +bicep_import_functionality_def( + unique int id: @bicep_import_functionality +); + +@bicep_import_statement_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_statement, index] +bicep_import_statement_child( + int bicep_import_statement: @bicep_import_statement ref, + int index: int ref, + unique int child: @bicep_import_statement_child_type ref +); + +bicep_import_statement_def( + unique int id: @bicep_import_statement +); + +@bicep_import_with_statement_child_type = @bicep_expression | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_with_statement, index] +bicep_import_with_statement_child( + int bicep_import_with_statement: @bicep_import_with_statement ref, + int index: int ref, + unique int child: @bicep_import_with_statement_child_type ref +); + +bicep_import_with_statement_def( + unique int id: @bicep_import_with_statement +); + +#keyset[bicep_infrastructure, index] +bicep_infrastructure_child( + int bicep_infrastructure: @bicep_infrastructure ref, + int index: int ref, + unique int child: @bicep_statement ref +); + +bicep_infrastructure_def( + unique int id: @bicep_infrastructure +); + +bicep_interpolation_def( + unique int id: @bicep_interpolation, + int child: @bicep_expression ref +); + +#keyset[bicep_lambda_expression, index] +bicep_lambda_expression_child( + int bicep_lambda_expression: @bicep_lambda_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_lambda_expression_def( + unique int id: @bicep_lambda_expression +); + +@bicep_member_expression_object_type = @bicep_expression | @bicep_parameterized_type + +bicep_member_expression_def( + unique int id: @bicep_member_expression, + int object: @bicep_member_expression_object_type ref, + int property: @bicep_token_property_identifier ref +); + +@bicep_metadata_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_metadata_declaration, index] +bicep_metadata_declaration_child( + int bicep_metadata_declaration: @bicep_metadata_declaration ref, + int index: int ref, + unique int child: @bicep_metadata_declaration_child_type ref +); + +bicep_metadata_declaration_def( + unique int id: @bicep_metadata_declaration +); + +@bicep_module_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_module_declaration, index] +bicep_module_declaration_child( + int bicep_module_declaration: @bicep_module_declaration ref, + int index: int ref, + unique int child: @bicep_module_declaration_child_type ref +); + +bicep_module_declaration_def( + unique int id: @bicep_module_declaration +); + +bicep_negated_type_def( + unique int id: @bicep_negated_type, + int child: @bicep_type__ ref +); + +@bicep_nullable_type_child_type = @bicep_array_type | @bicep_expression | @bicep_parenthesized_type | @bicep_token_primitive_type + +bicep_nullable_type_def( + unique int id: @bicep_nullable_type, + int child: @bicep_nullable_type_child_type ref +); + +@bicep_object_child_type = @bicep_decorators | @bicep_object_property + +#keyset[bicep_object, index] +bicep_object_child( + int bicep_object: @bicep_object ref, + int index: int ref, + unique int child: @bicep_object_child_type ref +); + +bicep_object_def( + unique int id: @bicep_object +); + +@bicep_object_property_child_type = @bicep_array_type | @bicep_compatible_identifier | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_resource_declaration | @bicep_string__ | @bicep_token_identifier | @bicep_token_primitive_type | @bicep_union_type + +#keyset[bicep_object_property, index] +bicep_object_property_child( + int bicep_object_property: @bicep_object_property ref, + int index: int ref, + unique int child: @bicep_object_property_child_type ref +); + +bicep_object_property_def( + unique int id: @bicep_object_property +); + +@bicep_output_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_output_declaration, index] +bicep_output_declaration_child( + int bicep_output_declaration: @bicep_output_declaration ref, + int index: int ref, + unique int child: @bicep_output_declaration_child_type ref +); + +bicep_output_declaration_def( + unique int id: @bicep_output_declaration +); + +@bicep_parameter_child_type = @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter, index] +bicep_parameter_child( + int bicep_parameter: @bicep_parameter ref, + int index: int ref, + unique int child: @bicep_parameter_child_type ref +); + +bicep_parameter_def( + unique int id: @bicep_parameter +); + +@bicep_parameter_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter_declaration, index] +bicep_parameter_declaration_child( + int bicep_parameter_declaration: @bicep_parameter_declaration ref, + int index: int ref, + unique int child: @bicep_parameter_declaration_child_type ref +); + +bicep_parameter_declaration_def( + unique int id: @bicep_parameter_declaration +); + +@bicep_parameterized_type_child_type = @bicep_token_identifier | @bicep_type_arguments + +#keyset[bicep_parameterized_type, index] +bicep_parameterized_type_child( + int bicep_parameterized_type: @bicep_parameterized_type ref, + int index: int ref, + unique int child: @bicep_parameterized_type_child_type ref +); + +bicep_parameterized_type_def( + unique int id: @bicep_parameterized_type +); + +#keyset[bicep_parameters, index] +bicep_parameters_child( + int bicep_parameters: @bicep_parameters ref, + int index: int ref, + unique int child: @bicep_parameter ref +); + +bicep_parameters_def( + unique int id: @bicep_parameters +); + +#keyset[bicep_parenthesized_expression, index] +bicep_parenthesized_expression_child( + int bicep_parenthesized_expression: @bicep_parenthesized_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_parenthesized_expression_def( + unique int id: @bicep_parenthesized_expression +); + +bicep_parenthesized_type_def( + unique int id: @bicep_parenthesized_type, + int child: @bicep_type__ ref +); + +@bicep_primary_expression = @bicep_array | @bicep_call_expression | @bicep_for_statement | @bicep_member_expression | @bicep_object | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number + +@bicep_resource_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_resource_declaration, index] +bicep_resource_declaration_child( + int bicep_resource_declaration: @bicep_resource_declaration ref, + int index: int ref, + unique int child: @bicep_resource_declaration_child_type ref +); + +bicep_resource_declaration_def( + unique int id: @bicep_resource_declaration +); + +bicep_resource_expression_def( + unique int id: @bicep_resource_expression, + int object: @bicep_expression ref, + int resource: @bicep_token_identifier ref +); + +@bicep_statement = @bicep_declaration | @bicep_decorators | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_target_scope_assignment | @bicep_using_statement + +@bicep_string_child_type = @bicep_interpolation | @bicep_token_escape_sequence | @bicep_token_string_content + +#keyset[bicep_string__, index] +bicep_string_child( + int bicep_string__: @bicep_string__ ref, + int index: int ref, + unique int child: @bicep_string_child_type ref +); + +bicep_string_def( + unique int id: @bicep_string__ +); + +bicep_subscript_expression_def( + unique int id: @bicep_subscript_expression, + int index: @bicep_expression ref, + int object: @bicep_expression ref +); + +bicep_target_scope_assignment_def( + unique int id: @bicep_target_scope_assignment, + int child: @bicep_string__ ref +); + +bicep_ternary_expression_def( + unique int id: @bicep_ternary_expression, + int alternative: @bicep_expression ref, + int condition: @bicep_expression ref, + int consequence: @bicep_expression ref +); + +@bicep_test_block_child_type = @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_test_block, index] +bicep_test_block_child( + int bicep_test_block: @bicep_test_block ref, + int index: int ref, + unique int child: @bicep_test_block_child_type ref +); + +bicep_test_block_def( + unique int id: @bicep_test_block +); + +@bicep_type_child_type = @bicep_array_type | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type | @bicep_union_type + +bicep_type_def( + unique int id: @bicep_type__, + int child: @bicep_type_child_type ref +); + +#keyset[bicep_type_arguments, index] +bicep_type_arguments_child( + int bicep_type_arguments: @bicep_type_arguments ref, + int index: int ref, + unique int child: @bicep_string__ ref +); + +bicep_type_arguments_def( + unique int id: @bicep_type_arguments +); + +@bicep_type_declaration_child_type = @bicep_array_type | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_token_identifier | @bicep_union_type + +#keyset[bicep_type_declaration, index] +bicep_type_declaration_child( + int bicep_type_declaration: @bicep_type_declaration ref, + int index: int ref, + unique int child: @bicep_type_declaration_child_type ref +); + +bicep_type_declaration_def( + unique int id: @bicep_type_declaration +); + +case @bicep_unary_expression.operator of + 0 = @bicep_unary_expression_bang +| 1 = @bicep_unary_expression_minus +; + + +bicep_unary_expression_def( + unique int id: @bicep_unary_expression, + int argument: @bicep_expression ref, + int operator: int ref +); + +@bicep_union_type_child_type = @bicep_array_type | @bicep_expression | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type + +#keyset[bicep_union_type, index] +bicep_union_type_child( + int bicep_union_type: @bicep_union_type ref, + int index: int ref, + unique int child: @bicep_union_type_child_type ref +); + +bicep_union_type_def( + unique int id: @bicep_union_type +); + +@bicep_user_defined_function_child_type = @bicep_expression | @bicep_parameters + +#keyset[bicep_user_defined_function, index] +bicep_user_defined_function_child( + int bicep_user_defined_function: @bicep_user_defined_function ref, + int index: int ref, + unique int child: @bicep_user_defined_function_child_type ref +); + +bicep_user_defined_function_def( + unique int id: @bicep_user_defined_function, + int name: @bicep_token_identifier ref, + int returns: @bicep_type__ ref +); + +bicep_using_statement_def( + unique int id: @bicep_using_statement, + int child: @bicep_string__ ref +); + +@bicep_variable_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_variable_declaration, index] +bicep_variable_declaration_child( + int bicep_variable_declaration: @bicep_variable_declaration ref, + int index: int ref, + unique int child: @bicep_variable_declaration_child_type ref +); + +bicep_variable_declaration_def( + unique int id: @bicep_variable_declaration +); + +bicep_tokeninfo( + unique int id: @bicep_token, + int kind: int ref, + string value: string ref +); + +case @bicep_token.kind of + 0 = @bicep_reserved_word +| 1 = @bicep_token_boolean +| 2 = @bicep_token_comment +| 3 = @bicep_token_diagnostic_comment +| 4 = @bicep_token_escape_sequence +| 5 = @bicep_token_identifier +| 6 = @bicep_token_loop_enumerator +| 7 = @bicep_token_loop_variable +| 8 = @bicep_token_null +| 9 = @bicep_token_nullable_return_type +| 10 = @bicep_token_number +| 11 = @bicep_token_primitive_type +| 12 = @bicep_token_property_identifier +| 13 = @bicep_token_string_content +; + + +@bicep_ast_node = @bicep_arguments | @bicep_array | @bicep_array_type | @bicep_assert_statement | @bicep_assignment_expression | @bicep_binary_expression | @bicep_call_expression | @bicep_compatible_identifier | @bicep_decorator | @bicep_decorators | @bicep_for_loop_parameters | @bicep_for_statement | @bicep_if_statement | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_infrastructure | @bicep_interpolation | @bicep_lambda_expression | @bicep_member_expression | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_object_property | @bicep_output_declaration | @bicep_parameter | @bicep_parameter_declaration | @bicep_parameterized_type | @bicep_parameters | @bicep_parenthesized_expression | @bicep_parenthesized_type | @bicep_resource_declaration | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_target_scope_assignment | @bicep_ternary_expression | @bicep_test_block | @bicep_token | @bicep_type__ | @bicep_type_arguments | @bicep_type_declaration | @bicep_unary_expression | @bicep_union_type | @bicep_user_defined_function | @bicep_using_statement | @bicep_variable_declaration + +bicep_ast_node_location( + unique int node: @bicep_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +bicep_ast_node_parent( + unique int node: @bicep_ast_node ref, + int parent: @bicep_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/old.dbscheme b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/old.dbscheme new file mode 100644 index 000000000000..6b6bd681890e --- /dev/null +++ b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/old.dbscheme @@ -0,0 +1,955 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Empty location -*/ + +empty_location( + int location: @location_default ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_comments (unique int id: @yaml_comment, + string text: string ref, + string tostring: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error | @yaml_comment; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/upgrade.properties b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/upgrade.properties new file mode 100644 index 000000000000..954b766394ba --- /dev/null +++ b/iac/downgrades/6b6bd681890e727cb8941c05a0ff08cb033b7026/upgrade.properties @@ -0,0 +1,4 @@ +description: Restore Bicep language support tables (empty) for older query packs +compatibility: partial +yaml_comments.rel: delete +empty_location.rel: delete diff --git a/iac/downgrades/README b/iac/downgrades/README deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/iac/downgrades/initial/iac.dbscheme b/iac/downgrades/initial/iac.dbscheme new file mode 100644 index 000000000000..e360faddae54 --- /dev/null +++ b/iac/downgrades/initial/iac.dbscheme @@ -0,0 +1,1511 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + +/*- BICEP dbscheme -*/ +#keyset[bicep_arguments, index] +bicep_arguments_child( + int bicep_arguments: @bicep_arguments ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_arguments_def( + unique int id: @bicep_arguments +); + +@bicep_array_child_type = @bicep_decorators | @bicep_expression + +#keyset[bicep_array, index] +bicep_array_child( + int bicep_array: @bicep_array ref, + int index: int ref, + unique int child: @bicep_array_child_type ref +); + +bicep_array_def( + unique int id: @bicep_array +); + +bicep_array_type_def( + unique int id: @bicep_array_type, + int child: @bicep_type__ ref +); + +bicep_assert_statement_def( + unique int id: @bicep_assert_statement, + int name: @bicep_token_identifier ref, + int child: @bicep_expression ref +); + +@bicep_assignment_expression_left_type = @bicep_member_expression | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_subscript_expression | @bicep_token_identifier + +bicep_assignment_expression_def( + unique int id: @bicep_assignment_expression, + int left: @bicep_assignment_expression_left_type ref, + int right: @bicep_expression ref +); + +case @bicep_binary_expression.operator of + 0 = @bicep_binary_expression_bangequal +| 1 = @bicep_binary_expression_bangtilde +| 2 = @bicep_binary_expression_percent +| 3 = @bicep_binary_expression_ampersandampersand +| 4 = @bicep_binary_expression_star +| 5 = @bicep_binary_expression_plus +| 6 = @bicep_binary_expression_minus +| 7 = @bicep_binary_expression_slash +| 8 = @bicep_binary_expression_langle +| 9 = @bicep_binary_expression_langleequal +| 10 = @bicep_binary_expression_equalequal +| 11 = @bicep_binary_expression_equaltilde +| 12 = @bicep_binary_expression_rangle +| 13 = @bicep_binary_expression_rangleequal +| 14 = @bicep_binary_expression_questionquestion +| 15 = @bicep_binary_expression_pipe +| 16 = @bicep_binary_expression_pipepipe +; + + +bicep_binary_expression_def( + unique int id: @bicep_binary_expression, + int left: @bicep_expression ref, + int operator: int ref, + int right: @bicep_expression ref +); + +bicep_call_expression_child( + unique int bicep_call_expression: @bicep_call_expression ref, + unique int child: @bicep_token_nullable_return_type ref +); + +bicep_call_expression_def( + unique int id: @bicep_call_expression, + int arguments: @bicep_arguments ref, + int function: @bicep_expression ref +); + +bicep_compatible_identifier_def( + unique int id: @bicep_compatible_identifier, + int child: @bicep_token_identifier ref +); + +@bicep_declaration = @bicep_assert_statement | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_output_declaration | @bicep_parameter_declaration | @bicep_resource_declaration | @bicep_test_block | @bicep_type_declaration | @bicep_user_defined_function | @bicep_variable_declaration + +bicep_decorator_def( + unique int id: @bicep_decorator, + int child: @bicep_call_expression ref +); + +#keyset[bicep_decorators, index] +bicep_decorators_child( + int bicep_decorators: @bicep_decorators ref, + int index: int ref, + unique int child: @bicep_decorator ref +); + +bicep_decorators_def( + unique int id: @bicep_decorators +); + +@bicep_expression = @bicep_assignment_expression | @bicep_binary_expression | @bicep_lambda_expression | @bicep_primary_expression | @bicep_ternary_expression | @bicep_unary_expression + +@bicep_for_loop_parameters_child_type = @bicep_token_loop_enumerator | @bicep_token_loop_variable + +#keyset[bicep_for_loop_parameters, index] +bicep_for_loop_parameters_child( + int bicep_for_loop_parameters: @bicep_for_loop_parameters ref, + int index: int ref, + unique int child: @bicep_for_loop_parameters_child_type ref +); + +bicep_for_loop_parameters_def( + unique int id: @bicep_for_loop_parameters +); + +@bicep_for_statement_body_type = @bicep_expression | @bicep_if_statement + +bicep_for_statement_initializer( + unique int bicep_for_statement: @bicep_for_statement ref, + unique int initializer: @bicep_token_identifier ref +); + +@bicep_for_statement_child_type = @bicep_expression | @bicep_for_loop_parameters + +#keyset[bicep_for_statement, index] +bicep_for_statement_child( + int bicep_for_statement: @bicep_for_statement ref, + int index: int ref, + unique int child: @bicep_for_statement_child_type ref +); + +bicep_for_statement_def( + unique int id: @bicep_for_statement, + int body: @bicep_for_statement_body_type ref +); + +@bicep_if_statement_child_type = @bicep_object | @bicep_parenthesized_expression + +#keyset[bicep_if_statement, index] +bicep_if_statement_child( + int bicep_if_statement: @bicep_if_statement ref, + int index: int ref, + unique int child: @bicep_if_statement_child_type ref +); + +bicep_if_statement_def( + unique int id: @bicep_if_statement +); + +@bicep_import_functionality_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_functionality, index] +bicep_import_functionality_child( + int bicep_import_functionality: @bicep_import_functionality ref, + int index: int ref, + unique int child: @bicep_import_functionality_child_type ref +); + +bicep_import_functionality_def( + unique int id: @bicep_import_functionality +); + +@bicep_import_statement_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_statement, index] +bicep_import_statement_child( + int bicep_import_statement: @bicep_import_statement ref, + int index: int ref, + unique int child: @bicep_import_statement_child_type ref +); + +bicep_import_statement_def( + unique int id: @bicep_import_statement +); + +@bicep_import_with_statement_child_type = @bicep_expression | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_with_statement, index] +bicep_import_with_statement_child( + int bicep_import_with_statement: @bicep_import_with_statement ref, + int index: int ref, + unique int child: @bicep_import_with_statement_child_type ref +); + +bicep_import_with_statement_def( + unique int id: @bicep_import_with_statement +); + +#keyset[bicep_infrastructure, index] +bicep_infrastructure_child( + int bicep_infrastructure: @bicep_infrastructure ref, + int index: int ref, + unique int child: @bicep_statement ref +); + +bicep_infrastructure_def( + unique int id: @bicep_infrastructure +); + +bicep_interpolation_def( + unique int id: @bicep_interpolation, + int child: @bicep_expression ref +); + +#keyset[bicep_lambda_expression, index] +bicep_lambda_expression_child( + int bicep_lambda_expression: @bicep_lambda_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_lambda_expression_def( + unique int id: @bicep_lambda_expression +); + +@bicep_member_expression_object_type = @bicep_expression | @bicep_parameterized_type + +bicep_member_expression_def( + unique int id: @bicep_member_expression, + int object: @bicep_member_expression_object_type ref, + int property: @bicep_token_property_identifier ref +); + +@bicep_metadata_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_metadata_declaration, index] +bicep_metadata_declaration_child( + int bicep_metadata_declaration: @bicep_metadata_declaration ref, + int index: int ref, + unique int child: @bicep_metadata_declaration_child_type ref +); + +bicep_metadata_declaration_def( + unique int id: @bicep_metadata_declaration +); + +@bicep_module_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_module_declaration, index] +bicep_module_declaration_child( + int bicep_module_declaration: @bicep_module_declaration ref, + int index: int ref, + unique int child: @bicep_module_declaration_child_type ref +); + +bicep_module_declaration_def( + unique int id: @bicep_module_declaration +); + +bicep_negated_type_def( + unique int id: @bicep_negated_type, + int child: @bicep_type__ ref +); + +@bicep_nullable_type_child_type = @bicep_array_type | @bicep_expression | @bicep_parenthesized_type | @bicep_token_primitive_type + +bicep_nullable_type_def( + unique int id: @bicep_nullable_type, + int child: @bicep_nullable_type_child_type ref +); + +@bicep_object_child_type = @bicep_decorators | @bicep_object_property + +#keyset[bicep_object, index] +bicep_object_child( + int bicep_object: @bicep_object ref, + int index: int ref, + unique int child: @bicep_object_child_type ref +); + +bicep_object_def( + unique int id: @bicep_object +); + +@bicep_object_property_child_type = @bicep_array_type | @bicep_compatible_identifier | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_resource_declaration | @bicep_string__ | @bicep_token_identifier | @bicep_token_primitive_type | @bicep_union_type + +#keyset[bicep_object_property, index] +bicep_object_property_child( + int bicep_object_property: @bicep_object_property ref, + int index: int ref, + unique int child: @bicep_object_property_child_type ref +); + +bicep_object_property_def( + unique int id: @bicep_object_property +); + +@bicep_output_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_output_declaration, index] +bicep_output_declaration_child( + int bicep_output_declaration: @bicep_output_declaration ref, + int index: int ref, + unique int child: @bicep_output_declaration_child_type ref +); + +bicep_output_declaration_def( + unique int id: @bicep_output_declaration +); + +@bicep_parameter_child_type = @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter, index] +bicep_parameter_child( + int bicep_parameter: @bicep_parameter ref, + int index: int ref, + unique int child: @bicep_parameter_child_type ref +); + +bicep_parameter_def( + unique int id: @bicep_parameter +); + +@bicep_parameter_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter_declaration, index] +bicep_parameter_declaration_child( + int bicep_parameter_declaration: @bicep_parameter_declaration ref, + int index: int ref, + unique int child: @bicep_parameter_declaration_child_type ref +); + +bicep_parameter_declaration_def( + unique int id: @bicep_parameter_declaration +); + +@bicep_parameterized_type_child_type = @bicep_token_identifier | @bicep_type_arguments + +#keyset[bicep_parameterized_type, index] +bicep_parameterized_type_child( + int bicep_parameterized_type: @bicep_parameterized_type ref, + int index: int ref, + unique int child: @bicep_parameterized_type_child_type ref +); + +bicep_parameterized_type_def( + unique int id: @bicep_parameterized_type +); + +#keyset[bicep_parameters, index] +bicep_parameters_child( + int bicep_parameters: @bicep_parameters ref, + int index: int ref, + unique int child: @bicep_parameter ref +); + +bicep_parameters_def( + unique int id: @bicep_parameters +); + +#keyset[bicep_parenthesized_expression, index] +bicep_parenthesized_expression_child( + int bicep_parenthesized_expression: @bicep_parenthesized_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_parenthesized_expression_def( + unique int id: @bicep_parenthesized_expression +); + +bicep_parenthesized_type_def( + unique int id: @bicep_parenthesized_type, + int child: @bicep_type__ ref +); + +@bicep_primary_expression = @bicep_array | @bicep_call_expression | @bicep_for_statement | @bicep_member_expression | @bicep_object | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number + +@bicep_resource_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_resource_declaration, index] +bicep_resource_declaration_child( + int bicep_resource_declaration: @bicep_resource_declaration ref, + int index: int ref, + unique int child: @bicep_resource_declaration_child_type ref +); + +bicep_resource_declaration_def( + unique int id: @bicep_resource_declaration +); + +bicep_resource_expression_def( + unique int id: @bicep_resource_expression, + int object: @bicep_expression ref, + int resource: @bicep_token_identifier ref +); + +@bicep_statement = @bicep_declaration | @bicep_decorators | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_target_scope_assignment | @bicep_using_statement + +@bicep_string_child_type = @bicep_interpolation | @bicep_token_escape_sequence | @bicep_token_string_content + +#keyset[bicep_string__, index] +bicep_string_child( + int bicep_string__: @bicep_string__ ref, + int index: int ref, + unique int child: @bicep_string_child_type ref +); + +bicep_string_def( + unique int id: @bicep_string__ +); + +bicep_subscript_expression_def( + unique int id: @bicep_subscript_expression, + int index: @bicep_expression ref, + int object: @bicep_expression ref +); + +bicep_target_scope_assignment_def( + unique int id: @bicep_target_scope_assignment, + int child: @bicep_string__ ref +); + +bicep_ternary_expression_def( + unique int id: @bicep_ternary_expression, + int alternative: @bicep_expression ref, + int condition: @bicep_expression ref, + int consequence: @bicep_expression ref +); + +@bicep_test_block_child_type = @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_test_block, index] +bicep_test_block_child( + int bicep_test_block: @bicep_test_block ref, + int index: int ref, + unique int child: @bicep_test_block_child_type ref +); + +bicep_test_block_def( + unique int id: @bicep_test_block +); + +@bicep_type_child_type = @bicep_array_type | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type | @bicep_union_type + +bicep_type_def( + unique int id: @bicep_type__, + int child: @bicep_type_child_type ref +); + +#keyset[bicep_type_arguments, index] +bicep_type_arguments_child( + int bicep_type_arguments: @bicep_type_arguments ref, + int index: int ref, + unique int child: @bicep_string__ ref +); + +bicep_type_arguments_def( + unique int id: @bicep_type_arguments +); + +@bicep_type_declaration_child_type = @bicep_array_type | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_token_identifier | @bicep_union_type + +#keyset[bicep_type_declaration, index] +bicep_type_declaration_child( + int bicep_type_declaration: @bicep_type_declaration ref, + int index: int ref, + unique int child: @bicep_type_declaration_child_type ref +); + +bicep_type_declaration_def( + unique int id: @bicep_type_declaration +); + +case @bicep_unary_expression.operator of + 0 = @bicep_unary_expression_bang +| 1 = @bicep_unary_expression_minus +; + + +bicep_unary_expression_def( + unique int id: @bicep_unary_expression, + int argument: @bicep_expression ref, + int operator: int ref +); + +@bicep_union_type_child_type = @bicep_array_type | @bicep_expression | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type + +#keyset[bicep_union_type, index] +bicep_union_type_child( + int bicep_union_type: @bicep_union_type ref, + int index: int ref, + unique int child: @bicep_union_type_child_type ref +); + +bicep_union_type_def( + unique int id: @bicep_union_type +); + +@bicep_user_defined_function_child_type = @bicep_expression | @bicep_parameters + +#keyset[bicep_user_defined_function, index] +bicep_user_defined_function_child( + int bicep_user_defined_function: @bicep_user_defined_function ref, + int index: int ref, + unique int child: @bicep_user_defined_function_child_type ref +); + +bicep_user_defined_function_def( + unique int id: @bicep_user_defined_function, + int name: @bicep_token_identifier ref, + int returns: @bicep_type__ ref +); + +bicep_using_statement_def( + unique int id: @bicep_using_statement, + int child: @bicep_string__ ref +); + +@bicep_variable_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_variable_declaration, index] +bicep_variable_declaration_child( + int bicep_variable_declaration: @bicep_variable_declaration ref, + int index: int ref, + unique int child: @bicep_variable_declaration_child_type ref +); + +bicep_variable_declaration_def( + unique int id: @bicep_variable_declaration +); + +bicep_tokeninfo( + unique int id: @bicep_token, + int kind: int ref, + string value: string ref +); + +case @bicep_token.kind of + 0 = @bicep_reserved_word +| 1 = @bicep_token_boolean +| 2 = @bicep_token_comment +| 3 = @bicep_token_diagnostic_comment +| 4 = @bicep_token_escape_sequence +| 5 = @bicep_token_identifier +| 6 = @bicep_token_loop_enumerator +| 7 = @bicep_token_loop_variable +| 8 = @bicep_token_null +| 9 = @bicep_token_nullable_return_type +| 10 = @bicep_token_number +| 11 = @bicep_token_primitive_type +| 12 = @bicep_token_property_identifier +| 13 = @bicep_token_string_content +; + + +@bicep_ast_node = @bicep_arguments | @bicep_array | @bicep_array_type | @bicep_assert_statement | @bicep_assignment_expression | @bicep_binary_expression | @bicep_call_expression | @bicep_compatible_identifier | @bicep_decorator | @bicep_decorators | @bicep_for_loop_parameters | @bicep_for_statement | @bicep_if_statement | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_infrastructure | @bicep_interpolation | @bicep_lambda_expression | @bicep_member_expression | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_object_property | @bicep_output_declaration | @bicep_parameter | @bicep_parameter_declaration | @bicep_parameterized_type | @bicep_parameters | @bicep_parenthesized_expression | @bicep_parenthesized_type | @bicep_resource_declaration | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_target_scope_assignment | @bicep_ternary_expression | @bicep_test_block | @bicep_token | @bicep_type__ | @bicep_type_arguments | @bicep_type_declaration | @bicep_unary_expression | @bicep_union_type | @bicep_user_defined_function | @bicep_using_statement | @bicep_variable_declaration + +bicep_ast_node_location( + unique int node: @bicep_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +bicep_ast_node_parent( + unique int node: @bicep_ast_node ref, + int parent: @bicep_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/downgrades/qlpack.yml b/iac/downgrades/qlpack.yml new file mode 100644 index 000000000000..ef6a34eb623c --- /dev/null +++ b/iac/downgrades/qlpack.yml @@ -0,0 +1,7 @@ +name: microsoft/iac-downgrades +groups: + - iac + - microsoft-all +downgrades: . +library: true +warnOnImplicitThis: true diff --git a/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/iac.dbscheme b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/iac.dbscheme new file mode 100644 index 000000000000..6b6bd681890e --- /dev/null +++ b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/iac.dbscheme @@ -0,0 +1,955 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Empty location -*/ + +empty_location( + int location: @location_default ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_comments (unique int id: @yaml_comment, + string text: string ref, + string tostring: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error | @yaml_comment; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/old.dbscheme b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/old.dbscheme new file mode 100644 index 000000000000..e360faddae54 --- /dev/null +++ b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/old.dbscheme @@ -0,0 +1,1511 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + +/*- BICEP dbscheme -*/ +#keyset[bicep_arguments, index] +bicep_arguments_child( + int bicep_arguments: @bicep_arguments ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_arguments_def( + unique int id: @bicep_arguments +); + +@bicep_array_child_type = @bicep_decorators | @bicep_expression + +#keyset[bicep_array, index] +bicep_array_child( + int bicep_array: @bicep_array ref, + int index: int ref, + unique int child: @bicep_array_child_type ref +); + +bicep_array_def( + unique int id: @bicep_array +); + +bicep_array_type_def( + unique int id: @bicep_array_type, + int child: @bicep_type__ ref +); + +bicep_assert_statement_def( + unique int id: @bicep_assert_statement, + int name: @bicep_token_identifier ref, + int child: @bicep_expression ref +); + +@bicep_assignment_expression_left_type = @bicep_member_expression | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_subscript_expression | @bicep_token_identifier + +bicep_assignment_expression_def( + unique int id: @bicep_assignment_expression, + int left: @bicep_assignment_expression_left_type ref, + int right: @bicep_expression ref +); + +case @bicep_binary_expression.operator of + 0 = @bicep_binary_expression_bangequal +| 1 = @bicep_binary_expression_bangtilde +| 2 = @bicep_binary_expression_percent +| 3 = @bicep_binary_expression_ampersandampersand +| 4 = @bicep_binary_expression_star +| 5 = @bicep_binary_expression_plus +| 6 = @bicep_binary_expression_minus +| 7 = @bicep_binary_expression_slash +| 8 = @bicep_binary_expression_langle +| 9 = @bicep_binary_expression_langleequal +| 10 = @bicep_binary_expression_equalequal +| 11 = @bicep_binary_expression_equaltilde +| 12 = @bicep_binary_expression_rangle +| 13 = @bicep_binary_expression_rangleequal +| 14 = @bicep_binary_expression_questionquestion +| 15 = @bicep_binary_expression_pipe +| 16 = @bicep_binary_expression_pipepipe +; + + +bicep_binary_expression_def( + unique int id: @bicep_binary_expression, + int left: @bicep_expression ref, + int operator: int ref, + int right: @bicep_expression ref +); + +bicep_call_expression_child( + unique int bicep_call_expression: @bicep_call_expression ref, + unique int child: @bicep_token_nullable_return_type ref +); + +bicep_call_expression_def( + unique int id: @bicep_call_expression, + int arguments: @bicep_arguments ref, + int function: @bicep_expression ref +); + +bicep_compatible_identifier_def( + unique int id: @bicep_compatible_identifier, + int child: @bicep_token_identifier ref +); + +@bicep_declaration = @bicep_assert_statement | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_output_declaration | @bicep_parameter_declaration | @bicep_resource_declaration | @bicep_test_block | @bicep_type_declaration | @bicep_user_defined_function | @bicep_variable_declaration + +bicep_decorator_def( + unique int id: @bicep_decorator, + int child: @bicep_call_expression ref +); + +#keyset[bicep_decorators, index] +bicep_decorators_child( + int bicep_decorators: @bicep_decorators ref, + int index: int ref, + unique int child: @bicep_decorator ref +); + +bicep_decorators_def( + unique int id: @bicep_decorators +); + +@bicep_expression = @bicep_assignment_expression | @bicep_binary_expression | @bicep_lambda_expression | @bicep_primary_expression | @bicep_ternary_expression | @bicep_unary_expression + +@bicep_for_loop_parameters_child_type = @bicep_token_loop_enumerator | @bicep_token_loop_variable + +#keyset[bicep_for_loop_parameters, index] +bicep_for_loop_parameters_child( + int bicep_for_loop_parameters: @bicep_for_loop_parameters ref, + int index: int ref, + unique int child: @bicep_for_loop_parameters_child_type ref +); + +bicep_for_loop_parameters_def( + unique int id: @bicep_for_loop_parameters +); + +@bicep_for_statement_body_type = @bicep_expression | @bicep_if_statement + +bicep_for_statement_initializer( + unique int bicep_for_statement: @bicep_for_statement ref, + unique int initializer: @bicep_token_identifier ref +); + +@bicep_for_statement_child_type = @bicep_expression | @bicep_for_loop_parameters + +#keyset[bicep_for_statement, index] +bicep_for_statement_child( + int bicep_for_statement: @bicep_for_statement ref, + int index: int ref, + unique int child: @bicep_for_statement_child_type ref +); + +bicep_for_statement_def( + unique int id: @bicep_for_statement, + int body: @bicep_for_statement_body_type ref +); + +@bicep_if_statement_child_type = @bicep_object | @bicep_parenthesized_expression + +#keyset[bicep_if_statement, index] +bicep_if_statement_child( + int bicep_if_statement: @bicep_if_statement ref, + int index: int ref, + unique int child: @bicep_if_statement_child_type ref +); + +bicep_if_statement_def( + unique int id: @bicep_if_statement +); + +@bicep_import_functionality_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_functionality, index] +bicep_import_functionality_child( + int bicep_import_functionality: @bicep_import_functionality ref, + int index: int ref, + unique int child: @bicep_import_functionality_child_type ref +); + +bicep_import_functionality_def( + unique int id: @bicep_import_functionality +); + +@bicep_import_statement_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_statement, index] +bicep_import_statement_child( + int bicep_import_statement: @bicep_import_statement ref, + int index: int ref, + unique int child: @bicep_import_statement_child_type ref +); + +bicep_import_statement_def( + unique int id: @bicep_import_statement +); + +@bicep_import_with_statement_child_type = @bicep_expression | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_with_statement, index] +bicep_import_with_statement_child( + int bicep_import_with_statement: @bicep_import_with_statement ref, + int index: int ref, + unique int child: @bicep_import_with_statement_child_type ref +); + +bicep_import_with_statement_def( + unique int id: @bicep_import_with_statement +); + +#keyset[bicep_infrastructure, index] +bicep_infrastructure_child( + int bicep_infrastructure: @bicep_infrastructure ref, + int index: int ref, + unique int child: @bicep_statement ref +); + +bicep_infrastructure_def( + unique int id: @bicep_infrastructure +); + +bicep_interpolation_def( + unique int id: @bicep_interpolation, + int child: @bicep_expression ref +); + +#keyset[bicep_lambda_expression, index] +bicep_lambda_expression_child( + int bicep_lambda_expression: @bicep_lambda_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_lambda_expression_def( + unique int id: @bicep_lambda_expression +); + +@bicep_member_expression_object_type = @bicep_expression | @bicep_parameterized_type + +bicep_member_expression_def( + unique int id: @bicep_member_expression, + int object: @bicep_member_expression_object_type ref, + int property: @bicep_token_property_identifier ref +); + +@bicep_metadata_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_metadata_declaration, index] +bicep_metadata_declaration_child( + int bicep_metadata_declaration: @bicep_metadata_declaration ref, + int index: int ref, + unique int child: @bicep_metadata_declaration_child_type ref +); + +bicep_metadata_declaration_def( + unique int id: @bicep_metadata_declaration +); + +@bicep_module_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_module_declaration, index] +bicep_module_declaration_child( + int bicep_module_declaration: @bicep_module_declaration ref, + int index: int ref, + unique int child: @bicep_module_declaration_child_type ref +); + +bicep_module_declaration_def( + unique int id: @bicep_module_declaration +); + +bicep_negated_type_def( + unique int id: @bicep_negated_type, + int child: @bicep_type__ ref +); + +@bicep_nullable_type_child_type = @bicep_array_type | @bicep_expression | @bicep_parenthesized_type | @bicep_token_primitive_type + +bicep_nullable_type_def( + unique int id: @bicep_nullable_type, + int child: @bicep_nullable_type_child_type ref +); + +@bicep_object_child_type = @bicep_decorators | @bicep_object_property + +#keyset[bicep_object, index] +bicep_object_child( + int bicep_object: @bicep_object ref, + int index: int ref, + unique int child: @bicep_object_child_type ref +); + +bicep_object_def( + unique int id: @bicep_object +); + +@bicep_object_property_child_type = @bicep_array_type | @bicep_compatible_identifier | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_resource_declaration | @bicep_string__ | @bicep_token_identifier | @bicep_token_primitive_type | @bicep_union_type + +#keyset[bicep_object_property, index] +bicep_object_property_child( + int bicep_object_property: @bicep_object_property ref, + int index: int ref, + unique int child: @bicep_object_property_child_type ref +); + +bicep_object_property_def( + unique int id: @bicep_object_property +); + +@bicep_output_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_output_declaration, index] +bicep_output_declaration_child( + int bicep_output_declaration: @bicep_output_declaration ref, + int index: int ref, + unique int child: @bicep_output_declaration_child_type ref +); + +bicep_output_declaration_def( + unique int id: @bicep_output_declaration +); + +@bicep_parameter_child_type = @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter, index] +bicep_parameter_child( + int bicep_parameter: @bicep_parameter ref, + int index: int ref, + unique int child: @bicep_parameter_child_type ref +); + +bicep_parameter_def( + unique int id: @bicep_parameter +); + +@bicep_parameter_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter_declaration, index] +bicep_parameter_declaration_child( + int bicep_parameter_declaration: @bicep_parameter_declaration ref, + int index: int ref, + unique int child: @bicep_parameter_declaration_child_type ref +); + +bicep_parameter_declaration_def( + unique int id: @bicep_parameter_declaration +); + +@bicep_parameterized_type_child_type = @bicep_token_identifier | @bicep_type_arguments + +#keyset[bicep_parameterized_type, index] +bicep_parameterized_type_child( + int bicep_parameterized_type: @bicep_parameterized_type ref, + int index: int ref, + unique int child: @bicep_parameterized_type_child_type ref +); + +bicep_parameterized_type_def( + unique int id: @bicep_parameterized_type +); + +#keyset[bicep_parameters, index] +bicep_parameters_child( + int bicep_parameters: @bicep_parameters ref, + int index: int ref, + unique int child: @bicep_parameter ref +); + +bicep_parameters_def( + unique int id: @bicep_parameters +); + +#keyset[bicep_parenthesized_expression, index] +bicep_parenthesized_expression_child( + int bicep_parenthesized_expression: @bicep_parenthesized_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_parenthesized_expression_def( + unique int id: @bicep_parenthesized_expression +); + +bicep_parenthesized_type_def( + unique int id: @bicep_parenthesized_type, + int child: @bicep_type__ ref +); + +@bicep_primary_expression = @bicep_array | @bicep_call_expression | @bicep_for_statement | @bicep_member_expression | @bicep_object | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number + +@bicep_resource_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_resource_declaration, index] +bicep_resource_declaration_child( + int bicep_resource_declaration: @bicep_resource_declaration ref, + int index: int ref, + unique int child: @bicep_resource_declaration_child_type ref +); + +bicep_resource_declaration_def( + unique int id: @bicep_resource_declaration +); + +bicep_resource_expression_def( + unique int id: @bicep_resource_expression, + int object: @bicep_expression ref, + int resource: @bicep_token_identifier ref +); + +@bicep_statement = @bicep_declaration | @bicep_decorators | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_target_scope_assignment | @bicep_using_statement + +@bicep_string_child_type = @bicep_interpolation | @bicep_token_escape_sequence | @bicep_token_string_content + +#keyset[bicep_string__, index] +bicep_string_child( + int bicep_string__: @bicep_string__ ref, + int index: int ref, + unique int child: @bicep_string_child_type ref +); + +bicep_string_def( + unique int id: @bicep_string__ +); + +bicep_subscript_expression_def( + unique int id: @bicep_subscript_expression, + int index: @bicep_expression ref, + int object: @bicep_expression ref +); + +bicep_target_scope_assignment_def( + unique int id: @bicep_target_scope_assignment, + int child: @bicep_string__ ref +); + +bicep_ternary_expression_def( + unique int id: @bicep_ternary_expression, + int alternative: @bicep_expression ref, + int condition: @bicep_expression ref, + int consequence: @bicep_expression ref +); + +@bicep_test_block_child_type = @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_test_block, index] +bicep_test_block_child( + int bicep_test_block: @bicep_test_block ref, + int index: int ref, + unique int child: @bicep_test_block_child_type ref +); + +bicep_test_block_def( + unique int id: @bicep_test_block +); + +@bicep_type_child_type = @bicep_array_type | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type | @bicep_union_type + +bicep_type_def( + unique int id: @bicep_type__, + int child: @bicep_type_child_type ref +); + +#keyset[bicep_type_arguments, index] +bicep_type_arguments_child( + int bicep_type_arguments: @bicep_type_arguments ref, + int index: int ref, + unique int child: @bicep_string__ ref +); + +bicep_type_arguments_def( + unique int id: @bicep_type_arguments +); + +@bicep_type_declaration_child_type = @bicep_array_type | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_token_identifier | @bicep_union_type + +#keyset[bicep_type_declaration, index] +bicep_type_declaration_child( + int bicep_type_declaration: @bicep_type_declaration ref, + int index: int ref, + unique int child: @bicep_type_declaration_child_type ref +); + +bicep_type_declaration_def( + unique int id: @bicep_type_declaration +); + +case @bicep_unary_expression.operator of + 0 = @bicep_unary_expression_bang +| 1 = @bicep_unary_expression_minus +; + + +bicep_unary_expression_def( + unique int id: @bicep_unary_expression, + int argument: @bicep_expression ref, + int operator: int ref +); + +@bicep_union_type_child_type = @bicep_array_type | @bicep_expression | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type + +#keyset[bicep_union_type, index] +bicep_union_type_child( + int bicep_union_type: @bicep_union_type ref, + int index: int ref, + unique int child: @bicep_union_type_child_type ref +); + +bicep_union_type_def( + unique int id: @bicep_union_type +); + +@bicep_user_defined_function_child_type = @bicep_expression | @bicep_parameters + +#keyset[bicep_user_defined_function, index] +bicep_user_defined_function_child( + int bicep_user_defined_function: @bicep_user_defined_function ref, + int index: int ref, + unique int child: @bicep_user_defined_function_child_type ref +); + +bicep_user_defined_function_def( + unique int id: @bicep_user_defined_function, + int name: @bicep_token_identifier ref, + int returns: @bicep_type__ ref +); + +bicep_using_statement_def( + unique int id: @bicep_using_statement, + int child: @bicep_string__ ref +); + +@bicep_variable_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_variable_declaration, index] +bicep_variable_declaration_child( + int bicep_variable_declaration: @bicep_variable_declaration ref, + int index: int ref, + unique int child: @bicep_variable_declaration_child_type ref +); + +bicep_variable_declaration_def( + unique int id: @bicep_variable_declaration +); + +bicep_tokeninfo( + unique int id: @bicep_token, + int kind: int ref, + string value: string ref +); + +case @bicep_token.kind of + 0 = @bicep_reserved_word +| 1 = @bicep_token_boolean +| 2 = @bicep_token_comment +| 3 = @bicep_token_diagnostic_comment +| 4 = @bicep_token_escape_sequence +| 5 = @bicep_token_identifier +| 6 = @bicep_token_loop_enumerator +| 7 = @bicep_token_loop_variable +| 8 = @bicep_token_null +| 9 = @bicep_token_nullable_return_type +| 10 = @bicep_token_number +| 11 = @bicep_token_primitive_type +| 12 = @bicep_token_property_identifier +| 13 = @bicep_token_string_content +; + + +@bicep_ast_node = @bicep_arguments | @bicep_array | @bicep_array_type | @bicep_assert_statement | @bicep_assignment_expression | @bicep_binary_expression | @bicep_call_expression | @bicep_compatible_identifier | @bicep_decorator | @bicep_decorators | @bicep_for_loop_parameters | @bicep_for_statement | @bicep_if_statement | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_infrastructure | @bicep_interpolation | @bicep_lambda_expression | @bicep_member_expression | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_object_property | @bicep_output_declaration | @bicep_parameter | @bicep_parameter_declaration | @bicep_parameterized_type | @bicep_parameters | @bicep_parenthesized_expression | @bicep_parenthesized_type | @bicep_resource_declaration | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_target_scope_assignment | @bicep_ternary_expression | @bicep_test_block | @bicep_token | @bicep_type__ | @bicep_type_arguments | @bicep_type_declaration | @bicep_unary_expression | @bicep_union_type | @bicep_user_defined_function | @bicep_using_statement | @bicep_variable_declaration + +bicep_ast_node_location( + unique int node: @bicep_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +bicep_ast_node_parent( + unique int node: @bicep_ast_node ref, + int parent: @bicep_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/upgrade.properties b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/upgrade.properties new file mode 100644 index 000000000000..fb26d04d4d71 --- /dev/null +++ b/iac/ql/lib/upgrades/e360faddae54136c353230e45afebcb36bb80a1c/upgrade.properties @@ -0,0 +1,84 @@ +description: Remove Bicep language support (bicep_* relations) +compatibility: backwards +bicep_arguments_child.rel: delete +bicep_arguments_def.rel: delete +bicep_array_child.rel: delete +bicep_array_def.rel: delete +bicep_array_type_def.rel: delete +bicep_assert_statement_def.rel: delete +bicep_assignment_expression_def.rel: delete +bicep_binary_expression_def.rel: delete +bicep_call_expression_child.rel: delete +bicep_call_expression_def.rel: delete +bicep_compatible_identifier_def.rel: delete +bicep_decorator_def.rel: delete +bicep_decorators_child.rel: delete +bicep_decorators_def.rel: delete +bicep_for_loop_parameters_child.rel: delete +bicep_for_loop_parameters_def.rel: delete +bicep_for_statement_initializer.rel: delete +bicep_for_statement_child.rel: delete +bicep_for_statement_def.rel: delete +bicep_if_statement_child.rel: delete +bicep_if_statement_def.rel: delete +bicep_import_functionality_child.rel: delete +bicep_import_functionality_def.rel: delete +bicep_import_statement_child.rel: delete +bicep_import_statement_def.rel: delete +bicep_import_with_statement_child.rel: delete +bicep_import_with_statement_def.rel: delete +bicep_infrastructure_child.rel: delete +bicep_infrastructure_def.rel: delete +bicep_interpolation_def.rel: delete +bicep_lambda_expression_child.rel: delete +bicep_lambda_expression_def.rel: delete +bicep_member_expression_def.rel: delete +bicep_metadata_declaration_child.rel: delete +bicep_metadata_declaration_def.rel: delete +bicep_module_declaration_child.rel: delete +bicep_module_declaration_def.rel: delete +bicep_negated_type_def.rel: delete +bicep_nullable_type_def.rel: delete +bicep_object_child.rel: delete +bicep_object_def.rel: delete +bicep_object_property_child.rel: delete +bicep_object_property_def.rel: delete +bicep_output_declaration_child.rel: delete +bicep_output_declaration_def.rel: delete +bicep_parameter_child.rel: delete +bicep_parameter_def.rel: delete +bicep_parameter_declaration_child.rel: delete +bicep_parameter_declaration_def.rel: delete +bicep_parameterized_type_child.rel: delete +bicep_parameterized_type_def.rel: delete +bicep_parameters_child.rel: delete +bicep_parameters_def.rel: delete +bicep_parenthesized_expression_child.rel: delete +bicep_parenthesized_expression_def.rel: delete +bicep_parenthesized_type_def.rel: delete +bicep_resource_declaration_child.rel: delete +bicep_resource_declaration_def.rel: delete +bicep_resource_expression_def.rel: delete +bicep_string_child.rel: delete +bicep_string_def.rel: delete +bicep_subscript_expression_def.rel: delete +bicep_target_scope_assignment_def.rel: delete +bicep_ternary_expression_def.rel: delete +bicep_test_block_child.rel: delete +bicep_test_block_def.rel: delete +bicep_type_def.rel: delete +bicep_type_arguments_child.rel: delete +bicep_type_arguments_def.rel: delete +bicep_type_declaration_child.rel: delete +bicep_type_declaration_def.rel: delete +bicep_unary_expression_def.rel: delete +bicep_union_type_child.rel: delete +bicep_union_type_def.rel: delete +bicep_user_defined_function_child.rel: delete +bicep_user_defined_function_def.rel: delete +bicep_using_statement_def.rel: delete +bicep_variable_declaration_child.rel: delete +bicep_variable_declaration_def.rel: delete +bicep_tokeninfo.rel: delete +bicep_ast_node_location.rel: delete +bicep_ast_node_parent.rel: delete diff --git a/iac/ql/lib/upgrades/initial/iac.dbscheme b/iac/ql/lib/upgrades/initial/iac.dbscheme new file mode 100644 index 000000000000..e360faddae54 --- /dev/null +++ b/iac/ql/lib/upgrades/initial/iac.dbscheme @@ -0,0 +1,1511 @@ +// CodeQL database schema for HCL +// Automatically generated from the tree-sitter grammar; do not edit + +/*- Files and folders -*/ + +/** + * The location of an element. + * The location spans column `startcolumn` of line `startline` to + * column `endcolumn` of line `endline` in file `file`. + * For more information, see + * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). + */ +locations_default( + unique int id: @location_default, + int file: @file ref, + int beginLine: int ref, + int beginColumn: int ref, + int endLine: int ref, + int endColumn: int ref +); + +files( + unique int id: @file, + string name: string ref +); + +folders( + unique int id: @folder, + string name: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +/*- Source location prefix -*/ + +/** + * The source location of the snapshot. + */ +sourceLocationPrefix(string prefix : string ref); + +/*- Diagnostic messages -*/ + +diagnostics( + unique int id: @diagnostic, + int severity: int ref, + string error_tag: string ref, + string error_message: string ref, + string full_error_message: string ref, + int location: @location_default ref +); + +/*- Diagnostic messages: severity -*/ + +case @diagnostic.severity of + 10 = @diagnostic_debug +| 20 = @diagnostic_info +| 30 = @diagnostic_warning +| 40 = @diagnostic_error +; + +/*- YAML -*/ + +#keyset[parent, idx] +yaml (unique int id: @yaml_node, + int kind: int ref, + int parent: @yaml_node_parent ref, + int idx: int ref, + string tag: string ref, + string tostring: string ref); + +case @yaml_node.kind of + 0 = @yaml_scalar_node +| 1 = @yaml_mapping_node +| 2 = @yaml_sequence_node +| 3 = @yaml_alias_node +; + +@yaml_collection_node = @yaml_mapping_node | @yaml_sequence_node; + +@yaml_node_parent = @yaml_collection_node | @file; + +yaml_anchors (unique int node: @yaml_node ref, + string anchor: string ref); + +yaml_aliases (unique int alias: @yaml_alias_node ref, + string target: string ref); + +yaml_scalars (unique int scalar: @yaml_scalar_node ref, + int style: int ref, + string value: string ref); + +yaml_errors (unique int id: @yaml_error, + string message: string ref); + +yaml_locations(unique int locatable: @yaml_locatable ref, + int location: @location_default ref); + +@yaml_locatable = @yaml_node | @yaml_error; + +/*- HCL dbscheme -*/ +@hcl_underscore_collection_value = @hcl_object | @hcl_tuple + +@hcl_underscore_expr_term = @hcl_for_expr | @hcl_function_call | @hcl_get_attr_expr | @hcl_index_expr | @hcl_parenthesized_expr | @hcl_splat_expr | @hcl_underscore_collection_value | @hcl_underscore_literal_value | @hcl_underscore_operation | @hcl_underscore_template_expr | @hcl_variable_expr + +@hcl_underscore_expression = @hcl_conditional | @hcl_underscore_expr_term + +@hcl_underscore_literal_value = @hcl_string_lit | @hcl_token_bool_lit | @hcl_token_null_lit | @hcl_token_numeric_lit + +@hcl_underscore_operation = @hcl_binary_operation | @hcl_unary_operation + +@hcl_underscore_splat = @hcl_attr_splat | @hcl_full_splat + +@hcl_underscore_template_directive = @hcl_template_for | @hcl_template_if + +@hcl_underscore_template_expr = @hcl_heredoc_template | @hcl_quoted_template + +#keyset[hcl_attr_splat, index] +hcl_attr_splat_element( + int hcl_attr_splat: @hcl_attr_splat ref, + int index: int ref, + unique int element: @hcl_get_attr ref +); + +hcl_attr_splat_def( + unique int id: @hcl_attr_splat +); + +hcl_attribute_def( + unique int id: @hcl_attribute, + int key__: @hcl_token_identifier ref, + int val: @hcl_underscore_expression ref +); + +case @hcl_binary_operation.operator of + 0 = @hcl_binary_operation_bangequal +| 1 = @hcl_binary_operation_percent +| 2 = @hcl_binary_operation_ampersandampersand +| 3 = @hcl_binary_operation_star +| 4 = @hcl_binary_operation_plus +| 5 = @hcl_binary_operation_minus +| 6 = @hcl_binary_operation_slash +| 7 = @hcl_binary_operation_langle +| 8 = @hcl_binary_operation_langleequal +| 9 = @hcl_binary_operation_equalequal +| 10 = @hcl_binary_operation_rangle +| 11 = @hcl_binary_operation_rangleequal +| 12 = @hcl_binary_operation_pipepipe +; + + +hcl_binary_operation_def( + unique int id: @hcl_binary_operation, + int left: @hcl_underscore_expr_term ref, + int operator: int ref, + int right: @hcl_underscore_expr_term ref +); + +hcl_block_body( + unique int hcl_block: @hcl_block ref, + unique int body: @hcl_body ref +); + +@hcl_block_label_type = @hcl_string_lit | @hcl_token_identifier + +#keyset[hcl_block, index] +hcl_block_label( + int hcl_block: @hcl_block ref, + int index: int ref, + unique int label: @hcl_block_label_type ref +); + +hcl_block_def( + unique int id: @hcl_block, + int type__: @hcl_token_identifier ref +); + +@hcl_body_child_type = @hcl_attribute | @hcl_block + +#keyset[hcl_body, index] +hcl_body_child( + int hcl_body: @hcl_body ref, + int index: int ref, + unique int child: @hcl_body_child_type ref +); + +hcl_body_def( + unique int id: @hcl_body +); + +hcl_conditional_def( + unique int id: @hcl_conditional, + int alternative: @hcl_underscore_expression ref, + int body: @hcl_underscore_expression ref, + int condition: @hcl_underscore_expression ref +); + +@hcl_config_file_child_type = @hcl_body | @hcl_object + +hcl_config_file_child( + unique int hcl_config_file: @hcl_config_file ref, + unique int child: @hcl_config_file_child_type ref +); + +hcl_config_file_def( + unique int id: @hcl_config_file +); + +@hcl_for_expr_child_type = @hcl_for_object_expr | @hcl_for_tuple_expr + +hcl_for_expr_def( + unique int id: @hcl_for_expr, + int child: @hcl_for_expr_child_type ref +); + +hcl_for_object_expr_condition( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_object_expr, index] +hcl_for_object_expr_target( + int hcl_for_object_expr: @hcl_for_object_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_object_expr_child( + unique int hcl_for_object_expr: @hcl_for_object_expr ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_for_object_expr_def( + unique int id: @hcl_for_object_expr, + int iter: @hcl_underscore_expression ref, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_for_tuple_expr_condition( + unique int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + unique int condition: @hcl_underscore_expression ref +); + +#keyset[hcl_for_tuple_expr, index] +hcl_for_tuple_expr_target( + int hcl_for_tuple_expr: @hcl_for_tuple_expr ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_for_tuple_expr_def( + unique int id: @hcl_for_tuple_expr, + int expr: @hcl_underscore_expression ref, + int iter: @hcl_underscore_expression ref +); + +@hcl_full_splat_element_type = @hcl_get_attr | @hcl_index + +#keyset[hcl_full_splat, index] +hcl_full_splat_element( + int hcl_full_splat: @hcl_full_splat ref, + int index: int ref, + unique int element: @hcl_full_splat_element_type ref +); + +hcl_full_splat_def( + unique int id: @hcl_full_splat +); + +#keyset[hcl_function_call, index] +hcl_function_call_argument( + int hcl_function_call: @hcl_function_call ref, + int index: int ref, + unique int argument: @hcl_underscore_expression ref +); + +hcl_function_call_child( + unique int hcl_function_call: @hcl_function_call ref, + unique int child: @hcl_token_ellipsis ref +); + +hcl_function_call_def( + unique int id: @hcl_function_call, + int function: @hcl_token_identifier ref +); + +hcl_get_attr_def( + unique int id: @hcl_get_attr, + int key__: @hcl_token_identifier ref +); + +hcl_get_attr_expr_def( + unique int id: @hcl_get_attr_expr, + int expr: @hcl_underscore_expr_term ref, + int key__: @hcl_token_identifier ref +); + +case @hcl_heredoc_template.start of + 0 = @hcl_heredoc_template_langlelangle +| 1 = @hcl_heredoc_template_langlelangleminus +; + + +@hcl_heredoc_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_heredoc_template, index] +hcl_heredoc_template_child( + int hcl_heredoc_template: @hcl_heredoc_template ref, + int index: int ref, + unique int child: @hcl_heredoc_template_child_type ref +); + +hcl_heredoc_template_def( + unique int id: @hcl_heredoc_template, + int start: int ref +); + +@hcl_index_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_def( + unique int id: @hcl_index, + int index: @hcl_index_index_type ref +); + +@hcl_index_expr_index_type = @hcl_token_numeric_lit | @hcl_underscore_expression + +hcl_index_expr_def( + unique int id: @hcl_index_expr, + int expr: @hcl_underscore_expr_term ref, + int index: @hcl_index_expr_index_type ref +); + +#keyset[hcl_object, index] +hcl_object_element( + int hcl_object: @hcl_object ref, + int index: int ref, + unique int element: @hcl_object_elem ref +); + +hcl_object_def( + unique int id: @hcl_object +); + +hcl_object_elem_def( + unique int id: @hcl_object_elem, + int key__: @hcl_underscore_expression ref, + int val: @hcl_underscore_expression ref +); + +hcl_parenthesized_expr_def( + unique int id: @hcl_parenthesized_expr, + int child: @hcl_underscore_expression ref +); + +@hcl_quoted_template_child_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_quoted_template, index] +hcl_quoted_template_child( + int hcl_quoted_template: @hcl_quoted_template ref, + int index: int ref, + unique int child: @hcl_quoted_template_child_type ref +); + +hcl_quoted_template_def( + unique int id: @hcl_quoted_template +); + +hcl_splat_expr_def( + unique int id: @hcl_splat_expr, + int expr: @hcl_underscore_expr_term ref, + int splat: @hcl_underscore_splat ref +); + +hcl_string_lit_child( + unique int hcl_string_lit: @hcl_string_lit ref, + unique int child: @hcl_token_template_literal ref +); + +hcl_string_lit_def( + unique int id: @hcl_string_lit +); + +@hcl_template_for_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_for, index] +hcl_template_for_body( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int body: @hcl_template_for_body_type ref +); + +#keyset[hcl_template_for, index] +hcl_template_for_target( + int hcl_template_for: @hcl_template_for ref, + int index: int ref, + unique int target: @hcl_token_identifier ref +); + +hcl_template_for_def( + unique int id: @hcl_template_for, + int iter: @hcl_underscore_expression ref +); + +@hcl_template_if_alternative_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_alternative( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int alternative: @hcl_template_if_alternative_type ref +); + +@hcl_template_if_body_type = @hcl_template_interpolation | @hcl_token_template_literal | @hcl_underscore_template_directive + +#keyset[hcl_template_if, index] +hcl_template_if_body( + int hcl_template_if: @hcl_template_if ref, + int index: int ref, + unique int body: @hcl_template_if_body_type ref +); + +hcl_template_if_def( + unique int id: @hcl_template_if, + int condition: @hcl_underscore_expression ref +); + +hcl_template_interpolation_expr( + unique int hcl_template_interpolation: @hcl_template_interpolation ref, + unique int expr: @hcl_underscore_expression ref +); + +hcl_template_interpolation_def( + unique int id: @hcl_template_interpolation +); + +#keyset[hcl_tuple, index] +hcl_tuple_element( + int hcl_tuple: @hcl_tuple ref, + int index: int ref, + unique int element: @hcl_underscore_expression ref +); + +hcl_tuple_def( + unique int id: @hcl_tuple +); + +case @hcl_unary_operation.operator of + 0 = @hcl_unary_operation_bang +| 1 = @hcl_unary_operation_minus +; + + +hcl_unary_operation_def( + unique int id: @hcl_unary_operation, + int operand: @hcl_underscore_expr_term ref, + int operator: int ref +); + +hcl_variable_expr_def( + unique int id: @hcl_variable_expr, + int name: @hcl_token_identifier ref +); + +hcl_tokeninfo( + unique int id: @hcl_token, + int kind: int ref, + string value: string ref +); + +case @hcl_token.kind of + 0 = @hcl_reserved_word +| 1 = @hcl_token_bool_lit +| 2 = @hcl_token_comment +| 3 = @hcl_token_ellipsis +| 4 = @hcl_token_identifier +| 5 = @hcl_token_null_lit +| 6 = @hcl_token_numeric_lit +| 7 = @hcl_token_template_literal +; + + +@hcl_ast_node = @hcl_attr_splat | @hcl_attribute | @hcl_binary_operation | @hcl_block | @hcl_body | @hcl_conditional | @hcl_config_file | @hcl_for_expr | @hcl_for_object_expr | @hcl_for_tuple_expr | @hcl_full_splat | @hcl_function_call | @hcl_get_attr | @hcl_get_attr_expr | @hcl_heredoc_template | @hcl_index | @hcl_index_expr | @hcl_object | @hcl_object_elem | @hcl_parenthesized_expr | @hcl_quoted_template | @hcl_splat_expr | @hcl_string_lit | @hcl_template_for | @hcl_template_if | @hcl_template_interpolation | @hcl_token | @hcl_tuple | @hcl_unary_operation | @hcl_variable_expr + +hcl_ast_node_location( + unique int node: @hcl_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +hcl_ast_node_parent( + unique int node: @hcl_ast_node ref, + int parent: @hcl_ast_node ref, + int parent_index: int ref +); + +/*- DOCKERFILE dbscheme -*/ +@dockerfile_add_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_add_instruction, index] +dockerfile_add_instruction_child( + int dockerfile_add_instruction: @dockerfile_add_instruction ref, + int index: int ref, + unique int child: @dockerfile_add_instruction_child_type ref +); + +dockerfile_add_instruction_def( + unique int id: @dockerfile_add_instruction +); + +@dockerfile_arg_instruction_default_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_arg_instruction_default( + unique int dockerfile_arg_instruction: @dockerfile_arg_instruction ref, + unique int default: @dockerfile_arg_instruction_default_type ref +); + +dockerfile_arg_instruction_def( + unique int id: @dockerfile_arg_instruction, + int name: @dockerfile_unquoted_string ref +); + +@dockerfile_cmd_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_cmd_instruction_def( + unique int id: @dockerfile_cmd_instruction, + int child: @dockerfile_cmd_instruction_child_type ref +); + +@dockerfile_copy_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_path | @dockerfile_token_param + +#keyset[dockerfile_copy_instruction, index] +dockerfile_copy_instruction_child( + int dockerfile_copy_instruction: @dockerfile_copy_instruction ref, + int index: int ref, + unique int child: @dockerfile_copy_instruction_child_type ref +); + +dockerfile_copy_instruction_def( + unique int id: @dockerfile_copy_instruction +); + +@dockerfile_double_quoted_string_child_type = @dockerfile_expansion | @dockerfile_token_escape_sequence + +#keyset[dockerfile_double_quoted_string, index] +dockerfile_double_quoted_string_child( + int dockerfile_double_quoted_string: @dockerfile_double_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_double_quoted_string_child_type ref +); + +dockerfile_double_quoted_string_def( + unique int id: @dockerfile_double_quoted_string +); + +@dockerfile_entrypoint_instruction_child_type = @dockerfile_json_string_array | @dockerfile_shell_command + +dockerfile_entrypoint_instruction_def( + unique int id: @dockerfile_entrypoint_instruction, + int child: @dockerfile_entrypoint_instruction_child_type ref +); + +#keyset[dockerfile_env_instruction, index] +dockerfile_env_instruction_child( + int dockerfile_env_instruction: @dockerfile_env_instruction ref, + int index: int ref, + unique int child: @dockerfile_env_pair ref +); + +dockerfile_env_instruction_def( + unique int id: @dockerfile_env_instruction +); + +@dockerfile_env_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_env_pair_value( + unique int dockerfile_env_pair: @dockerfile_env_pair ref, + unique int value: @dockerfile_env_pair_value_type ref +); + +dockerfile_env_pair_def( + unique int id: @dockerfile_env_pair, + int name: @dockerfile_unquoted_string ref +); + +dockerfile_expansion_def( + unique int id: @dockerfile_expansion, + int child: @dockerfile_token_variable ref +); + +@dockerfile_expose_instruction_child_type = @dockerfile_expansion | @dockerfile_token_expose_port + +#keyset[dockerfile_expose_instruction, index] +dockerfile_expose_instruction_child( + int dockerfile_expose_instruction: @dockerfile_expose_instruction ref, + int index: int ref, + unique int child: @dockerfile_expose_instruction_child_type ref +); + +dockerfile_expose_instruction_def( + unique int id: @dockerfile_expose_instruction +); + +dockerfile_from_instruction_as( + unique int dockerfile_from_instruction: @dockerfile_from_instruction ref, + unique int as: @dockerfile_image_alias ref +); + +@dockerfile_from_instruction_child_type = @dockerfile_image_spec | @dockerfile_token_param + +#keyset[dockerfile_from_instruction, index] +dockerfile_from_instruction_child( + int dockerfile_from_instruction: @dockerfile_from_instruction ref, + int index: int ref, + unique int child: @dockerfile_from_instruction_child_type ref +); + +dockerfile_from_instruction_def( + unique int id: @dockerfile_from_instruction +); + +@dockerfile_healthcheck_instruction_child_type = @dockerfile_cmd_instruction | @dockerfile_token_param + +#keyset[dockerfile_healthcheck_instruction, index] +dockerfile_healthcheck_instruction_child( + int dockerfile_healthcheck_instruction: @dockerfile_healthcheck_instruction ref, + int index: int ref, + unique int child: @dockerfile_healthcheck_instruction_child_type ref +); + +dockerfile_healthcheck_instruction_def( + unique int id: @dockerfile_healthcheck_instruction +); + +@dockerfile_heredoc_block_child_type = @dockerfile_token_heredoc_end | @dockerfile_token_heredoc_line + +#keyset[dockerfile_heredoc_block, index] +dockerfile_heredoc_block_child( + int dockerfile_heredoc_block: @dockerfile_heredoc_block ref, + int index: int ref, + unique int child: @dockerfile_heredoc_block_child_type ref +); + +dockerfile_heredoc_block_def( + unique int id: @dockerfile_heredoc_block +); + +#keyset[dockerfile_image_alias, index] +dockerfile_image_alias_child( + int dockerfile_image_alias: @dockerfile_image_alias ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_alias_def( + unique int id: @dockerfile_image_alias +); + +#keyset[dockerfile_image_digest, index] +dockerfile_image_digest_child( + int dockerfile_image_digest: @dockerfile_image_digest ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_digest_def( + unique int id: @dockerfile_image_digest +); + +#keyset[dockerfile_image_name, index] +dockerfile_image_name_child( + int dockerfile_image_name: @dockerfile_image_name ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_name_def( + unique int id: @dockerfile_image_name +); + +dockerfile_image_spec_digest( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int digest: @dockerfile_image_digest ref +); + +dockerfile_image_spec_tag( + unique int dockerfile_image_spec: @dockerfile_image_spec ref, + unique int tag: @dockerfile_image_tag ref +); + +dockerfile_image_spec_def( + unique int id: @dockerfile_image_spec, + int name: @dockerfile_image_name ref +); + +#keyset[dockerfile_image_tag, index] +dockerfile_image_tag_child( + int dockerfile_image_tag: @dockerfile_image_tag ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_image_tag_def( + unique int id: @dockerfile_image_tag +); + +#keyset[dockerfile_json_string, index] +dockerfile_json_string_child( + int dockerfile_json_string: @dockerfile_json_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_json_string_def( + unique int id: @dockerfile_json_string +); + +#keyset[dockerfile_json_string_array, index] +dockerfile_json_string_array_child( + int dockerfile_json_string_array: @dockerfile_json_string_array ref, + int index: int ref, + unique int child: @dockerfile_json_string ref +); + +dockerfile_json_string_array_def( + unique int id: @dockerfile_json_string_array +); + +#keyset[dockerfile_label_instruction, index] +dockerfile_label_instruction_child( + int dockerfile_label_instruction: @dockerfile_label_instruction ref, + int index: int ref, + unique int child: @dockerfile_label_pair ref +); + +dockerfile_label_instruction_def( + unique int id: @dockerfile_label_instruction +); + +@dockerfile_label_pair_key_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +@dockerfile_label_pair_value_type = @dockerfile_double_quoted_string | @dockerfile_single_quoted_string | @dockerfile_unquoted_string + +dockerfile_label_pair_def( + unique int id: @dockerfile_label_pair, + int key__: @dockerfile_label_pair_key_type ref, + int value: @dockerfile_label_pair_value_type ref +); + +case @dockerfile_mount_param.name of + 0 = @dockerfile_mount_param_mount +; + + +@dockerfile_mount_param_value_type = @dockerfile_reserved_word | @dockerfile_token_mount_param_param + +#keyset[dockerfile_mount_param, index] +dockerfile_mount_param_value( + int dockerfile_mount_param: @dockerfile_mount_param ref, + int index: int ref, + unique int value: @dockerfile_mount_param_value_type ref +); + +dockerfile_mount_param_def( + unique int id: @dockerfile_mount_param, + int name: int ref +); + +@dockerfile_onbuild_instruction_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_onbuild_instruction_def( + unique int id: @dockerfile_onbuild_instruction, + int child: @dockerfile_onbuild_instruction_child_type ref +); + +@dockerfile_path_child_type = @dockerfile_expansion | @dockerfile_token_heredoc_marker + +#keyset[dockerfile_path, index] +dockerfile_path_child( + int dockerfile_path: @dockerfile_path ref, + int index: int ref, + unique int child: @dockerfile_path_child_type ref +); + +dockerfile_path_def( + unique int id: @dockerfile_path +); + +@dockerfile_run_instruction_child_type = @dockerfile_heredoc_block | @dockerfile_json_string_array | @dockerfile_mount_param | @dockerfile_shell_command | @dockerfile_token_param + +#keyset[dockerfile_run_instruction, index] +dockerfile_run_instruction_child( + int dockerfile_run_instruction: @dockerfile_run_instruction ref, + int index: int ref, + unique int child: @dockerfile_run_instruction_child_type ref +); + +dockerfile_run_instruction_def( + unique int id: @dockerfile_run_instruction +); + +@dockerfile_shell_command_child_type = @dockerfile_shell_fragment | @dockerfile_token_line_continuation + +#keyset[dockerfile_shell_command, index] +dockerfile_shell_command_child( + int dockerfile_shell_command: @dockerfile_shell_command ref, + int index: int ref, + unique int child: @dockerfile_shell_command_child_type ref +); + +dockerfile_shell_command_def( + unique int id: @dockerfile_shell_command +); + +#keyset[dockerfile_shell_fragment, index] +dockerfile_shell_fragment_child( + int dockerfile_shell_fragment: @dockerfile_shell_fragment ref, + int index: int ref, + unique int child: @dockerfile_token_heredoc_marker ref +); + +dockerfile_shell_fragment_def( + unique int id: @dockerfile_shell_fragment +); + +dockerfile_shell_instruction_def( + unique int id: @dockerfile_shell_instruction, + int child: @dockerfile_json_string_array ref +); + +#keyset[dockerfile_single_quoted_string, index] +dockerfile_single_quoted_string_child( + int dockerfile_single_quoted_string: @dockerfile_single_quoted_string ref, + int index: int ref, + unique int child: @dockerfile_token_escape_sequence ref +); + +dockerfile_single_quoted_string_def( + unique int id: @dockerfile_single_quoted_string +); + +@dockerfile_source_file_child_type = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_label_instruction | @dockerfile_onbuild_instruction | @dockerfile_run_instruction | @dockerfile_shell_instruction | @dockerfile_stopsignal_instruction | @dockerfile_token_cross_build_instruction | @dockerfile_token_maintainer_instruction | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +#keyset[dockerfile_source_file, index] +dockerfile_source_file_child( + int dockerfile_source_file: @dockerfile_source_file ref, + int index: int ref, + unique int child: @dockerfile_source_file_child_type ref +); + +dockerfile_source_file_def( + unique int id: @dockerfile_source_file +); + +#keyset[dockerfile_stopsignal_instruction, index] +dockerfile_stopsignal_instruction_child( + int dockerfile_stopsignal_instruction: @dockerfile_stopsignal_instruction ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_stopsignal_instruction_def( + unique int id: @dockerfile_stopsignal_instruction +); + +#keyset[dockerfile_unquoted_string, index] +dockerfile_unquoted_string_child( + int dockerfile_unquoted_string: @dockerfile_unquoted_string ref, + int index: int ref, + unique int child: @dockerfile_expansion ref +); + +dockerfile_unquoted_string_def( + unique int id: @dockerfile_unquoted_string +); + +dockerfile_user_instruction_group( + unique int dockerfile_user_instruction: @dockerfile_user_instruction ref, + unique int group: @dockerfile_unquoted_string ref +); + +dockerfile_user_instruction_def( + unique int id: @dockerfile_user_instruction, + int user: @dockerfile_unquoted_string ref +); + +@dockerfile_volume_instruction_child_type = @dockerfile_json_string_array | @dockerfile_path + +#keyset[dockerfile_volume_instruction, index] +dockerfile_volume_instruction_child( + int dockerfile_volume_instruction: @dockerfile_volume_instruction ref, + int index: int ref, + unique int child: @dockerfile_volume_instruction_child_type ref +); + +dockerfile_volume_instruction_def( + unique int id: @dockerfile_volume_instruction +); + +dockerfile_workdir_instruction_def( + unique int id: @dockerfile_workdir_instruction, + int child: @dockerfile_path ref +); + +dockerfile_tokeninfo( + unique int id: @dockerfile_token, + int kind: int ref, + string value: string ref +); + +case @dockerfile_token.kind of + 0 = @dockerfile_reserved_word +| 1 = @dockerfile_token_comment +| 2 = @dockerfile_token_cross_build_instruction +| 3 = @dockerfile_token_escape_sequence +| 4 = @dockerfile_token_expose_port +| 5 = @dockerfile_token_heredoc_end +| 6 = @dockerfile_token_heredoc_line +| 7 = @dockerfile_token_heredoc_marker +| 8 = @dockerfile_token_line_continuation +| 9 = @dockerfile_token_maintainer_instruction +| 10 = @dockerfile_token_mount_param_param +| 11 = @dockerfile_token_param +| 12 = @dockerfile_token_variable +; + + +@dockerfile_ast_node = @dockerfile_add_instruction | @dockerfile_arg_instruction | @dockerfile_cmd_instruction | @dockerfile_copy_instruction | @dockerfile_double_quoted_string | @dockerfile_entrypoint_instruction | @dockerfile_env_instruction | @dockerfile_env_pair | @dockerfile_expansion | @dockerfile_expose_instruction | @dockerfile_from_instruction | @dockerfile_healthcheck_instruction | @dockerfile_heredoc_block | @dockerfile_image_alias | @dockerfile_image_digest | @dockerfile_image_name | @dockerfile_image_spec | @dockerfile_image_tag | @dockerfile_json_string | @dockerfile_json_string_array | @dockerfile_label_instruction | @dockerfile_label_pair | @dockerfile_mount_param | @dockerfile_onbuild_instruction | @dockerfile_path | @dockerfile_run_instruction | @dockerfile_shell_command | @dockerfile_shell_fragment | @dockerfile_shell_instruction | @dockerfile_single_quoted_string | @dockerfile_source_file | @dockerfile_stopsignal_instruction | @dockerfile_token | @dockerfile_unquoted_string | @dockerfile_user_instruction | @dockerfile_volume_instruction | @dockerfile_workdir_instruction + +dockerfile_ast_node_location( + unique int node: @dockerfile_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +dockerfile_ast_node_parent( + unique int node: @dockerfile_ast_node ref, + int parent: @dockerfile_ast_node ref, + int parent_index: int ref +); + +/*- BICEP dbscheme -*/ +#keyset[bicep_arguments, index] +bicep_arguments_child( + int bicep_arguments: @bicep_arguments ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_arguments_def( + unique int id: @bicep_arguments +); + +@bicep_array_child_type = @bicep_decorators | @bicep_expression + +#keyset[bicep_array, index] +bicep_array_child( + int bicep_array: @bicep_array ref, + int index: int ref, + unique int child: @bicep_array_child_type ref +); + +bicep_array_def( + unique int id: @bicep_array +); + +bicep_array_type_def( + unique int id: @bicep_array_type, + int child: @bicep_type__ ref +); + +bicep_assert_statement_def( + unique int id: @bicep_assert_statement, + int name: @bicep_token_identifier ref, + int child: @bicep_expression ref +); + +@bicep_assignment_expression_left_type = @bicep_member_expression | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_subscript_expression | @bicep_token_identifier + +bicep_assignment_expression_def( + unique int id: @bicep_assignment_expression, + int left: @bicep_assignment_expression_left_type ref, + int right: @bicep_expression ref +); + +case @bicep_binary_expression.operator of + 0 = @bicep_binary_expression_bangequal +| 1 = @bicep_binary_expression_bangtilde +| 2 = @bicep_binary_expression_percent +| 3 = @bicep_binary_expression_ampersandampersand +| 4 = @bicep_binary_expression_star +| 5 = @bicep_binary_expression_plus +| 6 = @bicep_binary_expression_minus +| 7 = @bicep_binary_expression_slash +| 8 = @bicep_binary_expression_langle +| 9 = @bicep_binary_expression_langleequal +| 10 = @bicep_binary_expression_equalequal +| 11 = @bicep_binary_expression_equaltilde +| 12 = @bicep_binary_expression_rangle +| 13 = @bicep_binary_expression_rangleequal +| 14 = @bicep_binary_expression_questionquestion +| 15 = @bicep_binary_expression_pipe +| 16 = @bicep_binary_expression_pipepipe +; + + +bicep_binary_expression_def( + unique int id: @bicep_binary_expression, + int left: @bicep_expression ref, + int operator: int ref, + int right: @bicep_expression ref +); + +bicep_call_expression_child( + unique int bicep_call_expression: @bicep_call_expression ref, + unique int child: @bicep_token_nullable_return_type ref +); + +bicep_call_expression_def( + unique int id: @bicep_call_expression, + int arguments: @bicep_arguments ref, + int function: @bicep_expression ref +); + +bicep_compatible_identifier_def( + unique int id: @bicep_compatible_identifier, + int child: @bicep_token_identifier ref +); + +@bicep_declaration = @bicep_assert_statement | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_output_declaration | @bicep_parameter_declaration | @bicep_resource_declaration | @bicep_test_block | @bicep_type_declaration | @bicep_user_defined_function | @bicep_variable_declaration + +bicep_decorator_def( + unique int id: @bicep_decorator, + int child: @bicep_call_expression ref +); + +#keyset[bicep_decorators, index] +bicep_decorators_child( + int bicep_decorators: @bicep_decorators ref, + int index: int ref, + unique int child: @bicep_decorator ref +); + +bicep_decorators_def( + unique int id: @bicep_decorators +); + +@bicep_expression = @bicep_assignment_expression | @bicep_binary_expression | @bicep_lambda_expression | @bicep_primary_expression | @bicep_ternary_expression | @bicep_unary_expression + +@bicep_for_loop_parameters_child_type = @bicep_token_loop_enumerator | @bicep_token_loop_variable + +#keyset[bicep_for_loop_parameters, index] +bicep_for_loop_parameters_child( + int bicep_for_loop_parameters: @bicep_for_loop_parameters ref, + int index: int ref, + unique int child: @bicep_for_loop_parameters_child_type ref +); + +bicep_for_loop_parameters_def( + unique int id: @bicep_for_loop_parameters +); + +@bicep_for_statement_body_type = @bicep_expression | @bicep_if_statement + +bicep_for_statement_initializer( + unique int bicep_for_statement: @bicep_for_statement ref, + unique int initializer: @bicep_token_identifier ref +); + +@bicep_for_statement_child_type = @bicep_expression | @bicep_for_loop_parameters + +#keyset[bicep_for_statement, index] +bicep_for_statement_child( + int bicep_for_statement: @bicep_for_statement ref, + int index: int ref, + unique int child: @bicep_for_statement_child_type ref +); + +bicep_for_statement_def( + unique int id: @bicep_for_statement, + int body: @bicep_for_statement_body_type ref +); + +@bicep_if_statement_child_type = @bicep_object | @bicep_parenthesized_expression + +#keyset[bicep_if_statement, index] +bicep_if_statement_child( + int bicep_if_statement: @bicep_if_statement ref, + int index: int ref, + unique int child: @bicep_if_statement_child_type ref +); + +bicep_if_statement_def( + unique int id: @bicep_if_statement +); + +@bicep_import_functionality_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_functionality, index] +bicep_import_functionality_child( + int bicep_import_functionality: @bicep_import_functionality ref, + int index: int ref, + unique int child: @bicep_import_functionality_child_type ref +); + +bicep_import_functionality_def( + unique int id: @bicep_import_functionality +); + +@bicep_import_statement_child_type = @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_statement, index] +bicep_import_statement_child( + int bicep_import_statement: @bicep_import_statement ref, + int index: int ref, + unique int child: @bicep_import_statement_child_type ref +); + +bicep_import_statement_def( + unique int id: @bicep_import_statement +); + +@bicep_import_with_statement_child_type = @bicep_expression | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_import_with_statement, index] +bicep_import_with_statement_child( + int bicep_import_with_statement: @bicep_import_with_statement ref, + int index: int ref, + unique int child: @bicep_import_with_statement_child_type ref +); + +bicep_import_with_statement_def( + unique int id: @bicep_import_with_statement +); + +#keyset[bicep_infrastructure, index] +bicep_infrastructure_child( + int bicep_infrastructure: @bicep_infrastructure ref, + int index: int ref, + unique int child: @bicep_statement ref +); + +bicep_infrastructure_def( + unique int id: @bicep_infrastructure +); + +bicep_interpolation_def( + unique int id: @bicep_interpolation, + int child: @bicep_expression ref +); + +#keyset[bicep_lambda_expression, index] +bicep_lambda_expression_child( + int bicep_lambda_expression: @bicep_lambda_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_lambda_expression_def( + unique int id: @bicep_lambda_expression +); + +@bicep_member_expression_object_type = @bicep_expression | @bicep_parameterized_type + +bicep_member_expression_def( + unique int id: @bicep_member_expression, + int object: @bicep_member_expression_object_type ref, + int property: @bicep_token_property_identifier ref +); + +@bicep_metadata_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_metadata_declaration, index] +bicep_metadata_declaration_child( + int bicep_metadata_declaration: @bicep_metadata_declaration ref, + int index: int ref, + unique int child: @bicep_metadata_declaration_child_type ref +); + +bicep_metadata_declaration_def( + unique int id: @bicep_metadata_declaration +); + +@bicep_module_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_module_declaration, index] +bicep_module_declaration_child( + int bicep_module_declaration: @bicep_module_declaration ref, + int index: int ref, + unique int child: @bicep_module_declaration_child_type ref +); + +bicep_module_declaration_def( + unique int id: @bicep_module_declaration +); + +bicep_negated_type_def( + unique int id: @bicep_negated_type, + int child: @bicep_type__ ref +); + +@bicep_nullable_type_child_type = @bicep_array_type | @bicep_expression | @bicep_parenthesized_type | @bicep_token_primitive_type + +bicep_nullable_type_def( + unique int id: @bicep_nullable_type, + int child: @bicep_nullable_type_child_type ref +); + +@bicep_object_child_type = @bicep_decorators | @bicep_object_property + +#keyset[bicep_object, index] +bicep_object_child( + int bicep_object: @bicep_object ref, + int index: int ref, + unique int child: @bicep_object_child_type ref +); + +bicep_object_def( + unique int id: @bicep_object +); + +@bicep_object_property_child_type = @bicep_array_type | @bicep_compatible_identifier | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_resource_declaration | @bicep_string__ | @bicep_token_identifier | @bicep_token_primitive_type | @bicep_union_type + +#keyset[bicep_object_property, index] +bicep_object_property_child( + int bicep_object_property: @bicep_object_property ref, + int index: int ref, + unique int child: @bicep_object_property_child_type ref +); + +bicep_object_property_def( + unique int id: @bicep_object_property +); + +@bicep_output_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_output_declaration, index] +bicep_output_declaration_child( + int bicep_output_declaration: @bicep_output_declaration ref, + int index: int ref, + unique int child: @bicep_output_declaration_child_type ref +); + +bicep_output_declaration_def( + unique int id: @bicep_output_declaration +); + +@bicep_parameter_child_type = @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter, index] +bicep_parameter_child( + int bicep_parameter: @bicep_parameter ref, + int index: int ref, + unique int child: @bicep_parameter_child_type ref +); + +bicep_parameter_def( + unique int id: @bicep_parameter +); + +@bicep_parameter_declaration_child_type = @bicep_expression | @bicep_token_identifier | @bicep_type__ + +#keyset[bicep_parameter_declaration, index] +bicep_parameter_declaration_child( + int bicep_parameter_declaration: @bicep_parameter_declaration ref, + int index: int ref, + unique int child: @bicep_parameter_declaration_child_type ref +); + +bicep_parameter_declaration_def( + unique int id: @bicep_parameter_declaration +); + +@bicep_parameterized_type_child_type = @bicep_token_identifier | @bicep_type_arguments + +#keyset[bicep_parameterized_type, index] +bicep_parameterized_type_child( + int bicep_parameterized_type: @bicep_parameterized_type ref, + int index: int ref, + unique int child: @bicep_parameterized_type_child_type ref +); + +bicep_parameterized_type_def( + unique int id: @bicep_parameterized_type +); + +#keyset[bicep_parameters, index] +bicep_parameters_child( + int bicep_parameters: @bicep_parameters ref, + int index: int ref, + unique int child: @bicep_parameter ref +); + +bicep_parameters_def( + unique int id: @bicep_parameters +); + +#keyset[bicep_parenthesized_expression, index] +bicep_parenthesized_expression_child( + int bicep_parenthesized_expression: @bicep_parenthesized_expression ref, + int index: int ref, + unique int child: @bicep_expression ref +); + +bicep_parenthesized_expression_def( + unique int id: @bicep_parenthesized_expression +); + +bicep_parenthesized_type_def( + unique int id: @bicep_parenthesized_type, + int child: @bicep_type__ ref +); + +@bicep_primary_expression = @bicep_array | @bicep_call_expression | @bicep_for_statement | @bicep_member_expression | @bicep_object | @bicep_parenthesized_expression | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number + +@bicep_resource_declaration_child_type = @bicep_for_statement | @bicep_if_statement | @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_resource_declaration, index] +bicep_resource_declaration_child( + int bicep_resource_declaration: @bicep_resource_declaration ref, + int index: int ref, + unique int child: @bicep_resource_declaration_child_type ref +); + +bicep_resource_declaration_def( + unique int id: @bicep_resource_declaration +); + +bicep_resource_expression_def( + unique int id: @bicep_resource_expression, + int object: @bicep_expression ref, + int resource: @bicep_token_identifier ref +); + +@bicep_statement = @bicep_declaration | @bicep_decorators | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_target_scope_assignment | @bicep_using_statement + +@bicep_string_child_type = @bicep_interpolation | @bicep_token_escape_sequence | @bicep_token_string_content + +#keyset[bicep_string__, index] +bicep_string_child( + int bicep_string__: @bicep_string__ ref, + int index: int ref, + unique int child: @bicep_string_child_type ref +); + +bicep_string_def( + unique int id: @bicep_string__ +); + +bicep_subscript_expression_def( + unique int id: @bicep_subscript_expression, + int index: @bicep_expression ref, + int object: @bicep_expression ref +); + +bicep_target_scope_assignment_def( + unique int id: @bicep_target_scope_assignment, + int child: @bicep_string__ ref +); + +bicep_ternary_expression_def( + unique int id: @bicep_ternary_expression, + int alternative: @bicep_expression ref, + int condition: @bicep_expression ref, + int consequence: @bicep_expression ref +); + +@bicep_test_block_child_type = @bicep_object | @bicep_string__ | @bicep_token_identifier + +#keyset[bicep_test_block, index] +bicep_test_block_child( + int bicep_test_block: @bicep_test_block ref, + int index: int ref, + unique int child: @bicep_test_block_child_type ref +); + +bicep_test_block_def( + unique int id: @bicep_test_block +); + +@bicep_type_child_type = @bicep_array_type | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type | @bicep_union_type + +bicep_type_def( + unique int id: @bicep_type__, + int child: @bicep_type_child_type ref +); + +#keyset[bicep_type_arguments, index] +bicep_type_arguments_child( + int bicep_type_arguments: @bicep_type_arguments ref, + int index: int ref, + unique int child: @bicep_string__ ref +); + +bicep_type_arguments_def( + unique int id: @bicep_type_arguments +); + +@bicep_type_declaration_child_type = @bicep_array_type | @bicep_expression | @bicep_nullable_type | @bicep_parameterized_type | @bicep_token_identifier | @bicep_union_type + +#keyset[bicep_type_declaration, index] +bicep_type_declaration_child( + int bicep_type_declaration: @bicep_type_declaration ref, + int index: int ref, + unique int child: @bicep_type_declaration_child_type ref +); + +bicep_type_declaration_def( + unique int id: @bicep_type_declaration +); + +case @bicep_unary_expression.operator of + 0 = @bicep_unary_expression_bang +| 1 = @bicep_unary_expression_minus +; + + +bicep_unary_expression_def( + unique int id: @bicep_unary_expression, + int argument: @bicep_expression ref, + int operator: int ref +); + +@bicep_union_type_child_type = @bicep_array_type | @bicep_expression | @bicep_member_expression | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_parameterized_type | @bicep_parenthesized_type | @bicep_string__ | @bicep_token_boolean | @bicep_token_identifier | @bicep_token_null | @bicep_token_number | @bicep_token_primitive_type + +#keyset[bicep_union_type, index] +bicep_union_type_child( + int bicep_union_type: @bicep_union_type ref, + int index: int ref, + unique int child: @bicep_union_type_child_type ref +); + +bicep_union_type_def( + unique int id: @bicep_union_type +); + +@bicep_user_defined_function_child_type = @bicep_expression | @bicep_parameters + +#keyset[bicep_user_defined_function, index] +bicep_user_defined_function_child( + int bicep_user_defined_function: @bicep_user_defined_function ref, + int index: int ref, + unique int child: @bicep_user_defined_function_child_type ref +); + +bicep_user_defined_function_def( + unique int id: @bicep_user_defined_function, + int name: @bicep_token_identifier ref, + int returns: @bicep_type__ ref +); + +bicep_using_statement_def( + unique int id: @bicep_using_statement, + int child: @bicep_string__ ref +); + +@bicep_variable_declaration_child_type = @bicep_expression | @bicep_token_identifier + +#keyset[bicep_variable_declaration, index] +bicep_variable_declaration_child( + int bicep_variable_declaration: @bicep_variable_declaration ref, + int index: int ref, + unique int child: @bicep_variable_declaration_child_type ref +); + +bicep_variable_declaration_def( + unique int id: @bicep_variable_declaration +); + +bicep_tokeninfo( + unique int id: @bicep_token, + int kind: int ref, + string value: string ref +); + +case @bicep_token.kind of + 0 = @bicep_reserved_word +| 1 = @bicep_token_boolean +| 2 = @bicep_token_comment +| 3 = @bicep_token_diagnostic_comment +| 4 = @bicep_token_escape_sequence +| 5 = @bicep_token_identifier +| 6 = @bicep_token_loop_enumerator +| 7 = @bicep_token_loop_variable +| 8 = @bicep_token_null +| 9 = @bicep_token_nullable_return_type +| 10 = @bicep_token_number +| 11 = @bicep_token_primitive_type +| 12 = @bicep_token_property_identifier +| 13 = @bicep_token_string_content +; + + +@bicep_ast_node = @bicep_arguments | @bicep_array | @bicep_array_type | @bicep_assert_statement | @bicep_assignment_expression | @bicep_binary_expression | @bicep_call_expression | @bicep_compatible_identifier | @bicep_decorator | @bicep_decorators | @bicep_for_loop_parameters | @bicep_for_statement | @bicep_if_statement | @bicep_import_functionality | @bicep_import_statement | @bicep_import_with_statement | @bicep_infrastructure | @bicep_interpolation | @bicep_lambda_expression | @bicep_member_expression | @bicep_metadata_declaration | @bicep_module_declaration | @bicep_negated_type | @bicep_nullable_type | @bicep_object | @bicep_object_property | @bicep_output_declaration | @bicep_parameter | @bicep_parameter_declaration | @bicep_parameterized_type | @bicep_parameters | @bicep_parenthesized_expression | @bicep_parenthesized_type | @bicep_resource_declaration | @bicep_resource_expression | @bicep_string__ | @bicep_subscript_expression | @bicep_target_scope_assignment | @bicep_ternary_expression | @bicep_test_block | @bicep_token | @bicep_type__ | @bicep_type_arguments | @bicep_type_declaration | @bicep_unary_expression | @bicep_union_type | @bicep_user_defined_function | @bicep_using_statement | @bicep_variable_declaration + +bicep_ast_node_location( + unique int node: @bicep_ast_node ref, + int loc: @location_default ref +); + +#keyset[parent, parent_index] +bicep_ast_node_parent( + unique int node: @bicep_ast_node ref, + int parent: @bicep_ast_node ref, + int parent_index: int ref +); + diff --git a/iac/scripts/create-extractor-pack.ps1 b/iac/scripts/create-extractor-pack.ps1 index 65b4dfc348a4..af4ca07b06c1 100644 --- a/iac/scripts/create-extractor-pack.ps1 +++ b/iac/scripts/create-extractor-pack.ps1 @@ -1,14 +1,14 @@ cargo build --release -cargo run --release -p ql-generator -- --dbscheme ql/src/ql.dbscheme --library ql/src/codeql_ql/ast/internal/TreeSitter.qll -codeql query format -i ql\src\codeql_ql\ast\internal\TreeSitter.qll +cargo run --release --bin codeql-extractor-iac -- generate --dbscheme ql/lib/iac.dbscheme --library ql/lib/codeql/iac/ast/internal/TreeSitter.qll +codeql query format -i ql\lib\codeql\iac\ast\internal\TreeSitter.qll if (Test-Path -Path extractor-pack) { rm -Recurse -Force extractor-pack } mkdir extractor-pack | Out-Null -cp codeql-extractor.yml, ql\src\ql.dbscheme, ql\src\ql.dbscheme.stats extractor-pack +cp codeql-extractor.yml, ql\lib\iac.dbscheme, ql\lib\iac.dbscheme.stats extractor-pack +cp -Recurse downgrades extractor-pack cp -Recurse tools extractor-pack mkdir extractor-pack\tools\win64 | Out-Null -cp target\release\ql-extractor.exe extractor-pack\tools\win64\extractor.exe -cp target\release\ql-autobuilder.exe extractor-pack\tools\win64\autobuilder.exe +cp target\release\codeql-extractor-iac.exe extractor-pack\tools\win64\extractor.exe diff --git a/misc/scripts/prepare-db-upgrade.sh b/misc/scripts/prepare-db-upgrade.sh index 4a47be886a10..75faea078ebd 100755 --- a/misc/scripts/prepare-db-upgrade.sh +++ b/misc/scripts/prepare-db-upgrade.sh @@ -86,7 +86,7 @@ case "${lang}" in csharp | cpp | javascript | python | powershell) scheme_file="${lang}/ql/lib/semmlecode.${lang}.dbscheme" ;; - go | ruby | rust | swift) + go | ruby | rust | swift | iac) scheme_file="${lang}/ql/lib/${lang}.dbscheme" ;; *)