From 7e80632fb24b6c7a7160beddf2b3b41358130ac1 Mon Sep 17 00:00:00 2001 From: Jeroen van Straten Date: Wed, 21 Sep 2022 15:43:40 +0200 Subject: [PATCH] feat: extend exported proto data structures for simple extension information (#50) Some pattern semantics (primarily bindings) have also changed to better align behavior with intuition. BREAKING CHANGE: validator.proto has been split up into three files. Some existing fields relating to extensions have now also been deprecated. --- .../validator/simple_extensions.proto | 359 ++++++++++ .../validator/{validator.proto => tree.proto} | 224 +------ proto/substrait/validator/type_system.proto | 613 ++++++++++++++++++ py/substrait_validator/__init__.py | 2 +- rs/src/export/proto.rs | 57 +- rs/src/output/extension/simple/function.rs | 4 + rs/src/output/extension/simple/module.rs | 10 + rs/src/output/extension/simple/type_class.rs | 7 + .../output/extension/simple/type_variation.rs | 35 +- rs/src/output/type_system/data/variation.rs | 11 +- rs/src/output/type_system/meta/pattern.rs | 174 ++--- rs/src/parse/extensions/simple/builder.rs | 12 + .../simple/derivations/SubstraitType.g4 | 95 +-- .../extensions/simple/derivations/mod.rs | 51 +- .../simple/derivations/substraittypeparser.rs | 495 +++++++------- rs/src/parse/types.rs | 4 +- 16 files changed, 1515 insertions(+), 638 deletions(-) create mode 100644 proto/substrait/validator/simple_extensions.proto rename proto/substrait/validator/{validator.proto => tree.proto} (67%) create mode 100644 proto/substrait/validator/type_system.proto diff --git a/proto/substrait/validator/simple_extensions.proto b/proto/substrait/validator/simple_extensions.proto new file mode 100644 index 00000000..5d87b555 --- /dev/null +++ b/proto/substrait/validator/simple_extensions.proto @@ -0,0 +1,359 @@ +// SPDX-License-Identifier: Apache-2.0 +syntax = "proto3"; + +// This proto file defines a machine-readable form of simple extension YAML +// files. + +package substrait.validator; + +import "google/protobuf/empty.proto"; +import "substrait/validator/type_system.proto"; + +option csharp_namespace = "Substrait.Validator.Protobuf"; +option java_multiple_files = true; +option java_package = "io.substrait.validator.proto"; + +// Root message returned by the validator as a result of converting a simple +// extension module to machine-readable form. +message SimpleExtension { + // Metadata about the simple extension module. + ExtensionDefinition.Module module = 1; + + // All extensions defined in the type class namespace of this extension. All + // names are case-insensitively unique. + repeated ExtensionDefinition.TypeClass type_classes = 2; + + // All type variation extensions. These are grouped by type class, because + // names need only be unique for a given type class. + repeated TypeVariationNamespace type_variations = 3; + message TypeVariationNamespace { + // The type class that these variations are defined for. + DataType.Class class = 1; + + // All variations defined for this type class. All names are + // case-insensitively unique. + repeated ExtensionDefinition.TypeVariation variations = 2; + } + + // All functions defined in the function namespace of this extension. All + // names are case-insensitively unique. + repeated ExtensionDefinition.Function functions = 4; + + // Any resolved extensions defined by dependencies of this module. Note that + // these are not publicly exposed by this extension. + repeated ExtensionDefinition dependencies = 5; +} + +// Definition information for an extension. +message ExtensionDefinition { + oneof kind { + // Represents an extension module (i.e. a YAML file). This only contains + // metadata about the module; the extensions defined in it have their own + // definitions. + Module module = 1; + + // Represents a user-defined type class. + TypeClass type_class = 2; + + // Represents a user-defined type variation. + TypeVariation type_variation = 3; + + // Represents a user-defined function. + Function function = 4; + } + + // Identifying information associated with an extension, that can be used to + // refer to the extension from elsewhere. + message Identifier { + // URI of the extension module that defined the extension. URI matching is + // case sensitive. + string uri = 1; + + // The set of names that may be used to case-insensitively refer to this + // extension within the scope of the above URI. For type classes and type + // variations there will only ever be one of these. For functions, the + // first name is always the compound name. The simple name will only be + // added when there is only one implementation for the function. For + // modules, the name list will be empty, as they are referred to by only + // their URI. + repeated string names = 2; + + // Unique identifier that may be used to refer to this definition elsewhere + // in the tree. Note that extension IDs are only unique within a single tree. + uint64 extension_id = 3; + } + + // Non-functional metadata common to all extension types. + message Metadata { + // Optional description of the extension. Only serves as documentation. + string description = 1; + } + + // Data associated with an extension module definition. + message Module { + // Identifier for the extension. + Identifier identifier = 1; + + // Common metadata for the extension. + Metadata metadata = 2; + + // The URI that was actually used to resolve the extension (the validator + // allows URI overrides to be specified). + string actual_uri = 3; + + // List of immediate dependencies. + repeated Dependency dependencies = 4; + message Dependency { + // URI of the dependency. + string uri = 1; + + // Name used to refer to the dependency internally. + string name = 2; + + // Identifier referring to the module definition of the dependency, if + // resolved by the validator. + int64 extension_id = 3; + } + + // List of references to all extensions publicly defined by this module. + repeated int64 extension_ids = 5; + } + + // Data associated with a type class. + message TypeClass { + // Identifier for the extension. + Identifier identifier = 1; + + // Common metadata for the extension. + Metadata metadata = 2; + + // Set of parameters expected by the type class. If unspecified or empty, + // the type class is a simple type. Otherwise, it is a compound type. + // + // The structure is shared with function arguments because it is very + // similar. Note however that type classes can only accept generics as + // value types. + Pack parameters = 3; + + // Optional pattern for the type representing the structure of the class. + // If not specified, the type class is opaque. + Metapattern structure = 4; + } + + // Data associated with a type variation. + message TypeVariation { + // Identifier for the extension. + Identifier identifier = 1; + + // Common metadata for the extension. + Metadata metadata = 2; + + // The type class that this variation is defined for. + DataType.Class class = 3; + + // Whether the variation is compatible with the "system-preferred" + // variation for the purpose of (function argument) pattern matching. + // Corresponds with the "functions" field in the YAML syntax; INHERITS + // means compatible, SEPARATE means incompatible. + bool compatible = 4; + } + + // Definition information for an extension. + message Function { + // Identifier for the extension. + Identifier identifier = 1; + + // Common metadata for the extension. + Metadata metadata = 2; + + // List of arguments expected by the function. + // + // The structure is shared with user-defined compound type classes because + // it is very similar. Note however that not all pattern and binding types + // are currently applicable: + // + // - required enumeration arguments must be represented using a metaenum + // pattern representing a defined set of values, are not skippable, and + // use "generic" binding type; + // - optional enumeration arguments are represented the same way, but with + // skippable set to true; + // - type arguments are represented using a typename pattern, are not + // skippable, and use "generic" binding type; + // - constant value arguments are represented using a typename pattern, + // are not skippable, and use "literal" binding type; + // - non-constant value arguments are represented using a typename pattern, + // are not skippable, and use "value" binding type. + // + // This may be further generalized in the future. + Pack arguments = 3; + + // The return type of the function, evaluated after the pack is matched. + Metapattern return_type = 4; + + // If set, the behavior of the function is session-dependent. + bool session_dependent = 5; + + // If set, the behavior of the function is non-deterministic, i.e. + // evaluating it twice may yield different values. Note that it is possible + // for a function to be session-dependent without being non-deterministic, + // if the function does always return the same value within a session. + bool non_deterministic = 6; + + // The function type, along with type-specific properties. + oneof kind { + // Represents a user-defined scalar function. + google.protobuf.Empty scalar_function = 7; + + // Represents a user-defined aggregate function. + AggregateProperties aggregate_function = 8; + + // Represents a user-defined window function. + WindowProperties window_function = 9; + } + + // Properties common to aggregate and window functions. + message AggregateProperties { + // When specified, the function is decomposable. + Decomposability decomposability = 1; + message Decomposability { + // The intermediate type, evaluated along with the return type. For + // INITIAL_TO_INTERMEDIATE and INTERMEDIATE_TO_INTERMEDIATE phases, this + // overrides the return type of the function. For + // INTERMEDIATE_TO_INTERMEDIATE and INTERMEDIATE_TO_RESULT phases, this + // (also) replaces the first value argument slot, and the remaining value + // argument slots are removed. + Metapattern intermediate_type = 1; + + // Determines whether the INTERMEDIATE_TO_INTERMEDIATE phase is + // applicable to this function. + bool many = 2; + } + + // Whether the behavior of the aggregate function is sensitive to the order + // in which the input is provided. + bool order_sensitive = 2; + + // If specified, this designates the maximum set size that can be passed to + // the function. + uint64 max_set = 3; + } + + // Properties applicable only to window functions. + message WindowProperties { + // Properties shared with aggregate functions. + AggregateProperties aggregate_properties = 1; + + // If set, the window function can be computed in streaming fashion. If not + // set, the window function can only start working when the complete input + // is available. + bool can_stream = 2; + } + } + + // Represents a parameter pack for a user-defined compound type class or a + // function argument slot list. In the latter case, the patterns will only + // ever be passed typenames. + // + // The order of operations for the various patterns is: + // + // - Match the patterns of each slot against the bound arguments from left + // to right. Note that the pattern in the last slot may be bound zero or + // more times, depending on the variadicity of the pack. + // - Process the constraint statements. + // - Evaluate any patterns in lambda arguments from left to right. + // + // After evaluation of the pack: + // + // - For decomposable aggregate/window functions, evaluate the intermediate + // type pattern. + // - For functions, evaluate the return type pattern. + // - For user-defined compound type classes, evaluate the structure pattern. + // + // If any match or evaluation operation fails, the provided pack is + // considered to be incompatible with the function or type class. + message Pack { + // List of parameter/argument slots. + repeated Slot slots = 1; + message Slot { + // Optional name of the slot. Only serves as documentation. + string name = 1; + + // Optional description of the slot. Only serves as documentation. + string description = 2; + + // The pattern that the metavalue passed to the slot must match. + Metapattern pattern = 3; + + // Whether this slot is skippable. Skippable slots may be skipped with + // null for type parameters or unspecified for function arguments (only + // enumerations can be made optional), but must be *explicitly* set to + // null/unspecified; it's illegal to omit them entirely. + bool skippable = 4; + + // Describes what type of construct should be bound to this slot. + oneof binding_type { + // Only a metavalue is to be bound to the slot. This is the only legal + // option for type parameters. For function argument slots, it is used + // for type, required enumeration, and optional enumeration arguments. + google.protobuf.Empty generic = 5; + + // A literal data value must be bound to the slot. The data type of the + // literal must match the metapattern. This is used for value function + // arguments that are marked as constant. They are particularly useful + // for aggregate and window functions. + google.protobuf.Empty literal = 6; + + // An data value must be bound to the slot. This is done by means of + // binding an expression, but the expression can always be evaluated or + // reduced before the function is invoked. This is used for value + // function arguments that are not marked as constant. The data type of + // the data value must match the pattern. + google.protobuf.Empty value = 7; + + // A lambda expression must be bound to the slot. This is also done by + // means of binding a normal expression, but the function has control + // over when, if, and how the bound expression is evaluated. The + // function can also provide arguments to the expression. + Lambda lambda = 8; + } + + message Lambda { + // The list of arguments that the bound lambda expression may make use + // of. + repeated Argument arguments = 1; + message Argument { + // Optional name of the slot. Only serves as documentation. + string name = 1; + + // Optional description of the slot. Only serves as documentation. + string description = 2; + + // The pattern used to evaluate the data type that will be passed to + // the lambda expression. These patterns are evaluated after all + // slots have been matched and the list of constraints have been + // processed. + Metapattern data_type = 3; + } + } + } + + // Variadic behavior of the last slot, i.e. the number of items that can + // be bound to the slot. Note that all slots before the last slot always + // bind to exactly one argument. This field is only legal if there is at + // least one slot. + Variadicity variadicity = 3; + message Variadicity { + // The minimum number of arguments that can be bound to the slot. May + // be 0. + uint64 minimum = 1; + + // The maximum number of arguments that can be bound to the slot. Zero + // is treated as unspecified/no upper limit. + uint64 maximum = 2; + } + + // Optional additional constraints to apply when determining whether a + // parameter pack is valid. + repeated Metastatement constraints = 4; + } +} diff --git a/proto/substrait/validator/validator.proto b/proto/substrait/validator/tree.proto similarity index 67% rename from proto/substrait/validator/validator.proto rename to proto/substrait/validator/tree.proto index 8c2e55e4..57af9c37 100644 --- a/proto/substrait/validator/validator.proto +++ b/proto/substrait/validator/tree.proto @@ -1,20 +1,23 @@ // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; +// This proto file defines the tree structure that corresponds to the internal +// representation of the validator's parse result. The toplevel message type +// for this is ParseResult. + package substrait.validator; import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; +import "substrait/validator/simple_extensions.proto"; +import "substrait/validator/type_system.proto"; option csharp_namespace = "Substrait.Validator.Protobuf"; option java_multiple_files = true; option java_package = "io.substrait.validator.proto"; -// One of the functions of the validator is to convert Substrait plans to a -// format that is more easy to consume for software geared toward making -// human-readable representations of Substrait. The validator has a few -// builtin text-based exporters, but it can also emit the complete parse -// result via the binary serialization of this message type. +// Root message type returned by the validator as a result of parsing a +// substrait.Plan. message ParseResult { // Root node of the parse result tree. Node root = 1; @@ -83,8 +86,6 @@ message Node { // Semantic classification of this node. Class class = 13; - - // Semantic classification of a node. enum Class { CLASS_UNSPECIFIED = 0; @@ -118,12 +119,10 @@ message Node { // that don't have a logical Substrait type. DataType data_type = 16; - // Data associated with this node. - repeated Data data = 31; - // Data associated with the node. Note that some variants are illegal based // on the node type (for example, a primitive does not have fields, so it // makes no sense for Field data to appear). + repeated Data data = 31; message Data { oneof kind { // Represents a child node in the tree. @@ -137,6 +136,12 @@ message Node { // Unstructured additional information about the node or something in it. Comment comment = 4; + + // Pointer to a function extension. + FunctionUsage function_usage = 5; + + // Simple extension definition. + ExtensionDefinition extension_definition = 6; } } @@ -215,8 +220,6 @@ message Path { // Elements of the path. The first element selects a child node of the root // node, the second selects one of its children, etc. repeated Element elements = 2; - - // Path element structure. message Element { oneof kind { Field field = 1; @@ -301,8 +304,6 @@ message Comment { // Comments consist of one or more "elements," defining formatting // information. repeated Element elements = 1; - - // A comment element. message Element { oneof kind { // A span of text. @@ -342,179 +343,24 @@ message Comment { } } -// Representation of a resolved data type. -message DataType { - // Type class. - Class class = 1; - - // Nullability. - bool nullable = 8; - - // Type variation. - oneof variation { - google.protobuf.Empty system_preferred_variation = 10; - UserDefinedVariation user_defined_variation = 9; - google.protobuf.Empty unresolved_variation = 15; - } - - // Type parameters for non-simple types. - repeated Parameter parameters = 16; - - // A type class. - message Class { - oneof kind { - Simple simple = 1; - Compound compound = 2; - UserDefinedType user_defined_type = 3; - google.protobuf.Empty unresolved_type = 7; - } - } - - // Enumeration of simple types. Message numbers correspond to the ones in - // substrait.Type. Note that UNSPECIFIED should never be emitted by the - // validator. - enum Simple { - SIMPLE_UNSPECIFIED = 0; - SIMPLE_BOOLEAN = 1; - SIMPLE_I8 = 2; - SIMPLE_I16 = 3; - SIMPLE_I32 = 5; - SIMPLE_I64 = 7; - SIMPLE_FP32 = 10; - SIMPLE_FP64 = 11; - SIMPLE_STRING = 12; - SIMPLE_BINARY = 13; - SIMPLE_TIMESTAMP = 14; - SIMPLE_DATE = 16; - SIMPLE_TIME = 17; - SIMPLE_INTERVAL_YEAR = 19; - SIMPLE_INTERVAL_DAY = 20; - SIMPLE_TIMESTAMP_TZ = 29; - SIMPLE_UUID = 32; - } - - // Enumeration of compound types. Message numbers correspond to the ones in - // substrait.Type. Note that UNSPECIFIED should never be emitted by the - // validator. - enum Compound { - COMPOUND_UNSPECIFIED = 0; - COMPOUND_FIXED_CHAR = 21; - COMPOUND_VAR_CHAR = 22; - COMPOUND_FIXED_BINARY = 23; - COMPOUND_DECIMAL = 24; - COMPOUND_STRUCT = 25; - COMPOUND_NAMED_STRUCT = 26; - COMPOUND_LIST = 27; - COMPOUND_MAP = 28; - } - - // Information about a user-defined type. - message UserDefinedType { - // URI of the YAML file that the type is (supposed to be) defined in, if - // known. - string uri = 1; - - // Name of the type within the scope of that YAML file. - string name = 2; - - // Type definition information from the YAML file, if resolution - // succeeded. - Definition definition = 3; - - // Type definition information from a YAML file for a user-defined type. - message Definition { - // The primitive structure of the type. - repeated Element structure = 1; - } - - // Primitive structure element for a user-defined type. - message Element { - // Name of the element. - string name = 1; - - // Type of data. - Simple kind = 2; - } - } - - // Information about a type variation. - message UserDefinedVariation { - // URI of the YAML file that the type variation is (supposed to be) defined - // in, if known. - string uri = 1; - - // Name of the type within the scope of that YAML file. - string name = 2; - - // Type definition information from the YAML file, if resolution - // succeeded. - Definition definition = 3; - - // Type definition information from a YAML file for a user-defined type. - message Definition { - // Base type. - oneof base_type { - Class physical = 1; - UserDefinedVariation logical = 2; - google.protobuf.Empty unresolved = 7; - } - - // Function behavior for this type variation. - FunctionBehavior function_behavior = 8; - } - - // Function behavior for a type variation. - enum FunctionBehavior { - FUNCTION_BEHAVIOR_UNSPECIFIED = 0; - FUNCTION_BEHAVIOR_INHERITS = 1; - FUNCTION_BEHAVIOR_SEPARATE = 2; - } - } - - // Type parameter. - message Parameter { - // Optional name given to the parameter (used for NSTRUCT). - string name = 10; - - // Type of parameter. - oneof kind { - // Anonymous data type parameter, for example the T in LIST. - DataType data_type = 1; - - // Boolean paramater, used only for extension types. - bool boolean = 4; - - // Integer parameter, for example the L in VARCHAR. - int64 integer = 5; - - // Enumeration parameter, used only for extension types. - string enumeration = 6; - - // String parameter, used only for extension types. - string string = 7; - - // Used to skip optional parameters. - google.protobuf.Empty null = 8; - - // Used when the value of a parameter could not be resolved. - google.protobuf.Empty unresolved = 9; - - // Replaced by `integer`. - uint64 unsigned = 3 [deprecated = true]; - - // Replaced by data_type and an assigned name field. - Named named_type = 2 [deprecated = true]; - } - } - - // A named type, used for NSTRUCT (meta)types. - message Named { - option deprecated = true; - - // Name of the struct element. - string name = 1; - - // Data type of the struct element. - DataType data_type = 2; - } +// Information about the usage of a function. +message FunctionUsage { + // URI of the YAML file that the function is (supposed to be) defined in, + // if known. + string uri = 1; + + // Compound name of the function, uniquely identifying a function + // implementation within the scope of the URI. + string compound_name = 2; + + // Simple name of the function, uniquely identifying the function behavior + // description within the scope of the URI. If the function only has a + // single implementation, this name may also be used to refer to it. + string simple_name = 3; + + // If nonzero, points to a function extension definition elsewhere in the + // tree. All extension definitions can be gathered by traversing the tree + // and looking for ExtensionDefinition messages in the data associated with + // each node. Note that extension IDs are only unique within a single tree. + uint64 extension_id = 4; } diff --git a/proto/substrait/validator/type_system.proto b/proto/substrait/validator/type_system.proto new file mode 100644 index 00000000..b559940d --- /dev/null +++ b/proto/substrait/validator/type_system.proto @@ -0,0 +1,613 @@ +// SPDX-License-Identifier: Apache-2.0 +syntax = "proto3"; + +// This proto file defines a representations of Substrait's meta type system, +// including data types. + +package substrait.validator; + +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Substrait.Validator.Protobuf"; +option java_multiple_files = true; +option java_package = "io.substrait.validator.proto"; + +// This is effectively a more homogeneous form of substrait.Type, but should +// otherwise be equally powerful. It is also less context-sensitive, in that +// usage of type class and type variation extensions includes the complete URI +// and name, rather than only a plan-specific link. +message DataType { + // Type class. + Class class = 1; + message Class { + oneof kind { + Simple simple = 1; + Compound compound = 2; + UserDefinedType user_defined_type = 3; + google.protobuf.Empty unresolved_type = 7; + } + } + + // Enumeration of simple types. Message numbers correspond to the ones in + // substrait.Type. Note that UNSPECIFIED should never be emitted by the + // validator. + enum Simple { + SIMPLE_UNSPECIFIED = 0; + SIMPLE_BOOLEAN = 1; + SIMPLE_I8 = 2; + SIMPLE_I16 = 3; + SIMPLE_I32 = 5; + SIMPLE_I64 = 7; + SIMPLE_FP32 = 10; + SIMPLE_FP64 = 11; + SIMPLE_STRING = 12; + SIMPLE_BINARY = 13; + SIMPLE_TIMESTAMP = 14; + SIMPLE_DATE = 16; + SIMPLE_TIME = 17; + SIMPLE_INTERVAL_YEAR = 19; + SIMPLE_INTERVAL_DAY = 20; + SIMPLE_TIMESTAMP_TZ = 29; + SIMPLE_UUID = 32; + } + + // Enumeration of compound types. Message numbers correspond to the ones in + // substrait.Type. Note that UNSPECIFIED should never be emitted by the + // validator. + enum Compound { + COMPOUND_UNSPECIFIED = 0; + COMPOUND_FIXED_CHAR = 21; + COMPOUND_VAR_CHAR = 22; + COMPOUND_FIXED_BINARY = 23; + COMPOUND_DECIMAL = 24; + COMPOUND_STRUCT = 25; + COMPOUND_NAMED_STRUCT = 26; + COMPOUND_LIST = 27; + COMPOUND_MAP = 28; + } + + // Information about a user-defined type. + message UserDefinedType { + // URI of the YAML file that the type is (supposed to be) defined in, if + // known. + string uri = 1; + + // Name of the type within the scope of that YAML file. + string name = 2; + + // If nonzero, points to a variation extension definition elsewhere in the + // tree. All extension definitions can be gathered by traversing the tree + // and looking for ExtensionDefinition messages in the data associated with + // each node. Note that extension IDs are only unique within a single tree. + uint64 extension_id = 4; + + // Deprecated; definitions are referred to via the definition_id field to + // avoid duplication. + Definition definition = 3 [deprecated = true]; + + message Definition { + option deprecated = true; + repeated Element structure = 1; + } + + message Element { + option deprecated = true; + string name = 1; + Simple kind = 2; + } + } + + // Nullability. + bool nullable = 8; + + // Type variation. + oneof variation { + google.protobuf.Empty system_preferred_variation = 10; + UserDefinedVariation user_defined_variation = 9; + google.protobuf.Empty unresolved_variation = 15; + } + + // Information about a type variation. + message UserDefinedVariation { + // URI of the YAML file that the type variation is (supposed to be) defined + // in, if known. + string uri = 1; + + // Name of the type within the scope of that YAML file. + string name = 2; + + // If nonzero, points to a variation extension definition elsewhere in the + // tree. All extension definitions can be gathered by traversing the tree + // and looking for ExtensionDefinition messages in the data associated with + // each node. Note that extension IDs are only unique within a single tree. + uint64 extension_id = 4; + + // Deprecated; definitions are referred to via the definition_id field to + // avoid duplication. + Definition definition = 3 [deprecated = true]; + + message Definition { + option deprecated = true; + oneof base_type { + Class physical = 1; + UserDefinedVariation logical = 2; + google.protobuf.Empty unresolved = 7; + } + FunctionBehavior function_behavior = 8; + } + + enum FunctionBehavior { + option deprecated = true; + FUNCTION_BEHAVIOR_UNSPECIFIED = 0; + FUNCTION_BEHAVIOR_INHERITS = 1; + FUNCTION_BEHAVIOR_SEPARATE = 2; + } + } + + // Type parameters for non-simple types. + repeated Parameter parameters = 16; + message Parameter { + // Optional name given to the parameter (currently used only for NSTRUCT). + string name = 10; + + // Type of parameter. + oneof kind { + // Used to skip optional parameters. + google.protobuf.Empty null = 8; + + // The value that the parameter is set to. + Metavalue value = 11; + + // These are all deprecated in favor of value. + DataType data_type = 1 [deprecated = true]; + Named named_type = 2 [deprecated = true]; + uint64 unsigned = 3 [deprecated = true]; + bool boolean = 4 [deprecated = true]; + int64 integer = 5 [deprecated = true]; + string enumeration = 6 [deprecated = true]; + string string = 7 [deprecated = true]; + google.protobuf.Empty unresolved = 9 [deprecated = true]; + } + } + + message Named { + option deprecated = true; + string name = 1; + DataType data_type = 2; + } +} + +// A value in the meta type system used for type patterns, type derivations, +// and type parameters. +message Metavalue { + oneof kind { + // An unresolved value (i.e., the validator could not determine what the + // value is or should be). + google.protobuf.Empty unresolved = 1; + + // A boolean. + bool metabool = 2; + + // An integer. + int64 metaint = 3; + + // An enumeration variant. + string metaenum = 4; + + // A string. + string metastr = 5; + + // A data type. + DataType typename = 6; + } +} + +// A pattern within the meta type system. In most cases, these can be thought +// of as representing a (context-sensitive) set of metavalues. In the special +// case where the set has only one metavalue in it, a pattern can also be +// evaluated to that metavalue. This allows patterns to be used at both the LHS +// and RHS of an assignment statement, for matching incoming metavalues or data +// types, and for deriving data types. Note however, that some binding patterns +// may evaluate to a value despite representing a non-unit set, or even +// evaluate to something not in the matched set. +// +// Matching or evaluating patterns may have side effects in the form of names +// being bound to a metavalue or rebound to a different metavalue. Evaluation +// and matching is strictly done in left-to-right order unless otherwise +// specified. +message Metapattern { + oneof kind { + // An unresolved pattern (i.e., the validator could not determine what the + // pattern is or should be). + google.protobuf.Empty unresolved = 1; + + // Represents the set of all metavalues. + google.protobuf.Empty any = 2; + + // Represents sets of metabools. + Metabool metabool = 3; + + // Represents sets of metaints. + Metaint metaint = 4; + + // Represents sets of metaenums. + Metaenum metaenum = 5; + + // Represents sets of metastrs. + Metastr metastr = 6; + + // Represents sets of typenames. + Typename typename = 7; + + // Represents context-sensitive sets based on named bindings. + Binding binding = 8; + + // Represents a single metavalue based on the evaluation of a function. + Function function = 9; + } + + // A pattern that matches metabools. + message Metabool { + oneof kind { + // Represents the set of all metabools. + google.protobuf.Empty any = 1; + + // Represents the set containing only this metabool. + bool exactly = 2; + } + } + + // A pattern that matches metaints. + message Metaint { + oneof kind { + // Represents the set of all metaints. + google.protobuf.Empty any = 1; + + // Represents the set containing only this metaint. + int64 exactly = 2; + + // Represents the set of all metaints greater than or equal to this + // value. + int64 at_least = 3; + + // Represents the set of all metaints less than or equal to this value. + int64 at_most = 4; + + // Represents the set of all metaints within the given range. + Range range = 5; + } + + message Range { + int64 minimum = 1; + int64 maximum = 2; + } + } + + // A pattern that matches metaenums. + message Metaenum { + oneof kind { + // Represents the set of all metaenums. + google.protobuf.Empty any = 1; + + // Represents the set containing only this metaenum. + string exactly = 2; + + // Represents a specific set of metaenum variants. + Set set = 3; + } + + message Set { + // List of at least two case-insensitively unique variants. + repeated string variants = 1; + } + } + + // A pattern that matches metastrs. + message Metastr { + oneof kind { + // Represents the set of all metastrs. + google.protobuf.Empty any = 1; + + // Represents the set containing only this metastr. + string exactly = 2; + } + } + + // A pattern that matches typenames. + message Typename { + // Pattern for nullability. If false is not contained in this set, only + // nullable typenames are contained; if true is not contained in this + // set, only non-nullable typenames are contained. Evaluation will only + // succeed if this evaluates to a boolean. + Metapattern nullability = 1; + + oneof kind { + // Represents the set of all typenames. + google.protobuf.Empty any = 2; + + // Represents the set of all valid nullability, variation, and parameter + // combinations of a specific type class. + WithClass with_class = 3; + } + + message WithClass { + // The specific data type class that all typenames in the matched set are + // based on. + DataType.Class class = 1; + + // Pattern for the type variation. + Variation variation = 2; + + // Pattern for the parameters. + ParameterPack parameter_pack = 3; + } + + message Variation { + oneof kind { + // Represents the set of all variations accepted by the type class. + // This corresponds to the [?] suffix in the DSL. + google.protobuf.Empty any = 1; + + // Represents the set of all variations accepted by the type class that + // are compatible with the system-preferred variation, i.e. variations + // with "INHERITS" function behavior. When evaluated, the + // system-preferred variation is used. This corresponds to the lack of + // a variation suffix in the DSL. + google.protobuf.Empty compatible = 2; + + // Only typenames using the system-preferred variation are included in + // the set. This corresponds to the [0] suffix in the DSL. + google.protobuf.Empty exactly_system_preferred = 3; + + // Only typenames using the specified variation are included in the + // set. + DataType.UserDefinedVariation exactly_user_defined = 4; + } + } + + message ParameterPack { + oneof kind { + // Represents the set of all parameter packs accepted by the type + // class. + google.protobuf.Empty any = 1; + + // Represents a subset of acceptable parameter packs with a specific + // number of specified parameters. + Parameters parameters = 2; + } + } + + message Parameters { + // The pattern for each parameter in the parameter pack. + repeated Parameter parameters = 1; + } + + message Parameter { + // Optional name for parameters. Only used when evaluated, and only used + // by the NSTRUCT pseudotype. No functional significance to Substrait; + // only serves as optional user-facing documentation. + string name = 1; + + oneof kind { + // The set containing both the special null value (used for skipping + // optional parameters) and all metavalues in the given pattern. + Metapattern null_or_specified = 2; + + // The set containing only the special null value (used for skipping + // optional parameters). + google.protobuf.Empty only_null = 3; + + // The specified set of metavalues (so, excluding null). + Metapattern only_specified = 4; + } + } + } + + // A context-sensitive pattern based on named bindings. + message Binding { + // The case-insensitive name of the binding. + string name = 1; + + oneof kind { + // A consistent binding. When a name is first used as a binding, this + // pattern represents the set of all metavalues except nullable + // typenames. When matched, however, the name is bound to the matched + // metavalue. For later usages, the pattern represents the set containing + // only the previously bound value. This makes this pattern act more or + // less like single-assignment variables. + google.protobuf.Empty consistent = 2; + + // An inconsistent binding. This is a variation on consistent bindings with + // some special rules that come in handy for representing "mirror" + // nullability and inconsistent variadic argument slots. + // + // When matched, this binding *always* represents the set of all + // metavalues except nullable typenames. The name is bound to the + // incoming metavalue in the following cases: + // - the name was not previously bound; + // - the name was previously bound to false, and the incoming value is + // true. + // The former is useful for inconsistent argument slots, while the latter + // is useful for mirror nullability in argument slots. + // + // Inconsistent bindings can always be evaluated. If the name was bound, + // they evaluate to the bound value (just like a consistent binding), but + // if the name was not yet bound, they evaluate to false. This is useful + // for mirror nullability in the return type derivation; together with + // the binding update rule, it makes the return type non-nullable (false) + // if no nullable (true) arguments were matched. + google.protobuf.Empty inconsistent = 3; + + // A variation on a normal binding that includes a nullability override. + // + // When matched, they behave more or less like normal bindings, but only + // match typenames, and only match them if their nullability matches the + // contained (boolean) pattern; i.e., if a non-nullable type is matched, + // the contained pattern is matched against false, and if a nullable + // pattern is matched, the contained pattern is matched against true. + // When binding, the bound typename is always the non-nullable variant of + // the matched typename. If the name of the binding was bound to a + // metavalue previously, its nullability is ignored in the matching + // process; the nullability check is always based on the contained + // nullability pattern. + // + // When evaluated, the nullability of the previously bound metavalue will + // be overridden with the evaluation result of the contained pattern + // (again, false = non-nullable, true = nullable). If no metavalue was + // bound to the name, if the bound metavalue was not a typename, or if + // the contained pattern does not evaluate to a boolean, evaluation + // fails. + // + // These rules are useful (and necessary) for specifying functions that + // can accept any type class, but have specific rules for nullability + // behavior. + Metapattern normal_with_nullability = 4; + + // The combination of an inconsistent binding and a binding with + // nullability override. + // + // When matched, they only match typenames, and only match them if their + // nullability matches the contained (boolean) pattern. The bound + // typename is always the non-nullable variant of the matched typename. + // Otherwise, the rules are the same as for inconsistent bindings. + // + // When evaluated, the nullability of the previously bound metavalue will + // be overridden with the evaluation result of the contained pattern + // (false = non-nullable, true = nullable). If no metavalue was bound to + // the name, if the bound metavalue was not a typename, or if the + // contained pattern does not evaluate to a boolean, evaluation fails. + // + // These rules are useful (and necessary) for specifying inconsistent + // variadic functions that will accept any type class, but have specific + // rules for nullability behavior. + Metapattern inconsistent_with_nullability = 5; + } + } + + // A pattern that represents a set of metavalues for which the sole value is + // determined by evaluating a function. + message Function { + // The type of function being evaluated. + FunctionType function_type = 1; + + // The arguments passed to the function. + repeated Metapattern arguments = 2; + + enum FunctionType { + FUNCTION_TYPE_UNSPECIFIED = 0; + + // Used when the validator could not determine which function was used. + FUNCTION_TYPE_UNRESOLVED = 1; + + // Unary boolean NOT. Takes a single metabool as argument, and returns its + // complementary value. + FUNCTION_TYPE_NOT = 2; + + // Boolean AND. Accepts any number of metabools as arguments, and returns + // the AND of all of them, i.e. whether all of them are true. If no + // arguments are specified, returns true. + FUNCTION_TYPE_AND = 3; + + // Boolean OR. Accepts any number of metabools as arguments, and returns + // the OR of all of them, i.e. whether any of them are true. If no + // arguments are specified, returns false. + FUNCTION_TYPE_OR = 4; + + // Integer negation. Takes a single metaint as argument, and returns its + // inverse. int64 overflow should be detected and result in evaluation + // failure. + FUNCTION_TYPE_NEGATE = 5; + + // Integer addition. Accepts any number of metaints, and returns their + // sum. int64 overflow should be detected and result in evaluation + // failure. Overflow for intermediate values when evaluating + // left-to-right *may* result in evaluation failure. + FUNCTION_TYPE_ADD = 6; + + // Integer subtraction. Accepts two metaints, and returns their difference. + // int64 overflow should be detected and result in evaluation failure. + FUNCTION_TYPE_SUBTRACT = 7; + + // Integer multiplication. Accepts any number of metaints, and returns + // their product. int64 overflow should be detected and result in + // evaluation failure. Overflow for intermediate values when evaluating + // left-to-right *may* result in evaluation failure. + FUNCTION_TYPE_MULTIPLY = 8; + + // Truncating integer division (rounding toward zero). Accepts two + // metaints, and returns their quotient. Division by zero should be + // detected and result in evaluation failure. + FUNCTION_TYPE_DIVIDE = 9; + + // Returns the minimum value of one or more metaints. + FUNCTION_TYPE_MIN = 10; + + // Returns the maximum value of one or more metaints. + FUNCTION_TYPE_MAX = 11; + + // Returns whether two metavalues are equal. When matching data types, + // NSTRUCT parameter names are *not* considered. + FUNCTION_TYPE_EQUAL = 12; + + // Returns whether one metaint is strictly greater than another. Not + // defined for metavalues other than metaint. + FUNCTION_TYPE_GREATER_THAN = 13; + + // Returns whether one metaint is strictly greater than another. Not + // defined for metavalues other than metaint. + FUNCTION_TYPE_LESS_THAN = 14; + + // Returns whether two metavalues are not equal. When matching data + // types, NSTRUCT parameter names are *not* considered. This is the exact + // complement of equal(). + FUNCTION_TYPE_NOT_EQUAL = 15; + + // Returns whether one metaint is less than or equal to another. Not + // defined for metavalues other than metaint. This is the exact + // complement of greater_than(). + FUNCTION_TYPE_LESS_EQUAL = 16; + + // Returns whether one metaint is greater than or equal to another. Not + // defined for metavalues other than metaint. This is the exact + // complement of less_than(). + FUNCTION_TYPE_GREATER_EQUAL = 17; + + // Matches the metavalue evaluated from the first argument against the + // pattern passed via the second argument (the second argument is *not* + // evaluated). Returns whether this match was successful. Any side + // effects of the pattern match (i.e. names being bound or rebound) shall + // be supressed if the final pattern does not match. + FUNCTION_TYPE_COVERS = 18; + + // Requires exactly three arguments. Evaluates the first argument. If + // this returns true, the second argument is evaluated and returned; the + // third argument is not evaluated or matched in this case. If false, + // the third argument is evaluated and returned; the second argument is + // not evaluated in this case. If not a metabool, evaluation fails. + FUNCTION_TYPE_IF_THEN_ELSE = 19; + } + } +} + +// Represents a statement. These are used to specify constraints, and to allow +// common subexpressions in return type derivations etc. to be eliminated. +message Metastatement { + oneof kind { + // An assignment statement. Assertion statements are also represented + // using these: matching assertions are simply an assignment with LHS + // and RHS flipped around for readability, while normal assertions are + // just sugar for a match against the "true" pattern. + Assignment assignment = 1; + } + + message Assignment { + // The pattern to be evaluated. This is always done first, even though it + // appears on the right-hand side of an assignment statement in the DSL. + Metapattern evaluate = 1; + + // The pattern to match the result of the evaluation against. This is + // always done after the evaluation, even though it appears on the + // left-hand side of an assignment statement in the DSL. + Metapattern match = 2; + } +} diff --git a/py/substrait_validator/__init__.py b/py/substrait_validator/__init__.py index af54696e..5d3e2ebc 100644 --- a/py/substrait_validator/__init__.py +++ b/py/substrait_validator/__init__.py @@ -18,7 +18,7 @@ get_substrait_version as _get_substrait_version, ) from .substrait.plan_pb2 import Plan -from .substrait.validator.validator_pb2 import ParseResult, Diagnostic, Path +from .substrait.validator.tree_pb2 import ParseResult, Diagnostic, Path __VERSION__ = _get_version() diff --git a/rs/src/export/proto.rs b/rs/src/export/proto.rs index edaed2d6..053e760b 100644 --- a/rs/src/export/proto.rs +++ b/rs/src/export/proto.rs @@ -339,10 +339,16 @@ impl From<&data::class::Compound> for i32 { impl From<&extension::simple::type_class::Reference> for validator::data_type::UserDefinedType { fn from(node: &extension::simple::type_class::Reference) -> Self { + #[allow(deprecated)] Self { uri: node.uri.name().unwrap_or_default().to_string(), name: node.name.name().unwrap_or_default().to_string(), - definition: node.definition.as_ref().map(|x| x.as_ref().into()), + definition: None, + extension_id: node + .definition + .as_ref() + .map(|x| x.extension_id) + .unwrap_or_default(), } } } @@ -373,44 +379,21 @@ impl From<&data::Variation> for validator::data_type::Variation { validator::data_type::Variation::SystemPreferredVariation(()) } data::Variation::UserDefined(variation) => { - if let Some(definition) = &variation.definition { - validator::data_type::Variation::UserDefinedVariation( - validator::data_type::UserDefinedVariation { - uri: variation.uri.name().unwrap_or_default().to_string(), - name: variation.name.name().unwrap_or_default().to_string(), - definition: Some(Box::new(definition.as_ref().into())), - }, - ) - } else { - validator::data_type::Variation::UnresolvedVariation(()) - } - } - } - } -} - -impl From<&extension::simple::type_variation::Definition> - for validator::data_type::user_defined_variation::Definition -{ - fn from(node: &extension::simple::type_variation::Definition) -> Self { - Self { - base_type: None, - function_behavior: (&node.function_behavior).into(), - } - } -} - -impl From<&extension::simple::type_variation::FunctionBehavior> for i32 { - fn from(node: &extension::simple::type_variation::FunctionBehavior) -> Self { - match node { - extension::simple::type_variation::FunctionBehavior::Inherits => { - validator::data_type::user_defined_variation::FunctionBehavior::Inherits - } - extension::simple::type_variation::FunctionBehavior::Separate => { - validator::data_type::user_defined_variation::FunctionBehavior::Separate + validator::data_type::Variation::UserDefinedVariation( + #[allow(deprecated)] + validator::data_type::UserDefinedVariation { + uri: variation.uri.name().unwrap_or_default().to_string(), + name: variation.name.name().unwrap_or_default().to_string(), + definition: None, + extension_id: variation + .definition + .as_ref() + .map(|x| x.extension_id) + .unwrap_or_default(), + }, + ) } } - .into() } } diff --git a/rs/src/output/extension/simple/function.rs b/rs/src/output/extension/simple/function.rs index 83c535f1..3521e51e 100644 --- a/rs/src/output/extension/simple/function.rs +++ b/rs/src/output/extension/simple/function.rs @@ -11,6 +11,10 @@ use std::sync::Arc; /// The definition of a function implementation. #[derive(Clone, Debug)] pub struct Definition { + /// Unique number within the tree that can be used to refer to this + /// extension when exporting in protobuf form. + pub extension_id: u64, + /// Link to information common to a set of function implementations going by /// the same name. pub common: Arc, diff --git a/rs/src/output/extension/simple/module.rs b/rs/src/output/extension/simple/module.rs index 52cdd931..6d92bc95 100644 --- a/rs/src/output/extension/simple/module.rs +++ b/rs/src/output/extension/simple/module.rs @@ -74,6 +74,16 @@ impl DynScope for T { /// A parsed simple extension module/file. #[derive(Clone, Debug, Default)] pub struct Definition { + /// Unique number within the tree that can be used to refer to this + /// extension when exporting in protobuf form. + pub extension_id: u64, + + /// Description of the module. + pub description: String, + + /// The URI that was actually used to resolve the module. + pub actual_uri: String, + /// Map with references to dependencies. pub dependencies: HashMap, diff --git a/rs/src/output/extension/simple/type_class.rs b/rs/src/output/extension/simple/type_class.rs index b1ed3385..0765f725 100644 --- a/rs/src/output/extension/simple/type_class.rs +++ b/rs/src/output/extension/simple/type_class.rs @@ -12,6 +12,13 @@ use crate::output::type_system::meta::pattern::Pattern; /// A definition of a user-defined type class. #[derive(Clone, Debug, PartialEq, Eq, Default)] pub struct Definition { + /// Unique number within the tree that can be used to refer to this + /// extension when exporting in protobuf form. + pub extension_id: u64, + + /// Description of the type class. + pub description: String, + /// The underlying structure of the type. pub structure: Vec<(String, data::class::Simple)>, diff --git a/rs/src/output/extension/simple/type_variation.rs b/rs/src/output/extension/simple/type_variation.rs index a1b6c479..28dea1a0 100644 --- a/rs/src/output/extension/simple/type_variation.rs +++ b/rs/src/output/extension/simple/type_variation.rs @@ -8,32 +8,21 @@ use crate::output::type_system::data; /// Type variation extension. #[derive(Clone, Debug, PartialEq, Eq, Default)] pub struct Definition { - /// The base type for this variation. - pub base: data::Class, + /// Unique number within the tree that can be used to refer to this + /// extension when exporting in protobuf form. + pub extension_id: u64, - /// Function behavior for this variation. - pub function_behavior: FunctionBehavior, -} + /// Description of the type variation. + pub description: String, -/// Type variation function behavior. -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum FunctionBehavior { - /// This variation is compatible with the system-preferred variation. This - /// means that values of this type can be passed to functions that support - /// any variation compatible with the system-preferred variation, which is - /// the default behavior. - Inherits, - - /// This variation is not compatible with the system-preferred variation. - /// This means that values of this type can only be passed to functions - /// that expect specifically this variation. - Separate, -} + /// The base type for this variation. + pub base: data::Class, -impl Default for FunctionBehavior { - fn default() -> Self { - FunctionBehavior::Inherits - } + /// Whether this variation is compatible with the "system-preferred" + // variation for the purpose of (function argument) pattern matching. + // Corresponds with the "functions" field in the YAML syntax; INHERITS + // means compatible, SEPARATE means incompatible. + pub compatible: bool, } /// A reference to a completed type variation namespace. diff --git a/rs/src/output/type_system/data/variation.rs b/rs/src/output/type_system/data/variation.rs index ea3e9977..f8b464cb 100644 --- a/rs/src/output/type_system/data/variation.rs +++ b/rs/src/output/type_system/data/variation.rs @@ -48,14 +48,9 @@ impl Variation { pub fn is_compatible_with_system_preferred(&self) -> bool { match self { Variation::SystemPreferred => true, - Variation::UserDefined(x) => x - .definition - .as_ref() - .map(|x| { - x.function_behavior - == extension::simple::type_variation::FunctionBehavior::Inherits - }) - .unwrap_or(true), + Variation::UserDefined(x) => { + x.definition.as_ref().map(|x| x.compatible).unwrap_or(true) + } } } } diff --git a/rs/src/output/type_system/meta/pattern.rs b/rs/src/output/type_system/meta/pattern.rs index 98fd9c5c..afa6658f 100644 --- a/rs/src/output/type_system/meta/pattern.rs +++ b/rs/src/output/type_system/meta/pattern.rs @@ -102,12 +102,10 @@ pub enum Value { /// string. Syntax: quoted string. String(Option), - /// Pattern for data types. - /// - None: matches any data type. Cannot be evaluated. Syntax: `typename`. - /// - Some(_): matches what the contained pattern matches, and evaluates to - /// what it evaluates to. Syntax: - /// ``. - DataType(Option), + /// Pattern for data types. Syntax: + /// `` or + /// `typename`. + DataType(DataType), /// A function applied to a number of patterns. Functions cannot be /// matched; they can only be evaluated. Syntax: @@ -146,8 +144,7 @@ impl Describe for Value { } Value::String(None) => write!(f, "metastr"), Value::String(Some(text)) => util::string::describe_string(f, text, limit), - Value::DataType(None) => write!(f, "typename"), - Value::DataType(Some(pattern)) => pattern.describe(f, limit), + Value::DataType(pattern) => pattern.describe(f, limit), Value::Function(func, args) => { write!(f, "{func}(")?; util::string::describe_sequence(f, args, limit, 10, |f, arg, _, limit| { @@ -230,11 +227,7 @@ impl Value { } Value::DataType(expected) => { if let Some(value) = value.get_data_type() { - if let Some(expected) = expected { - expected.match_pattern_with_context(context, &value)? - } else { - true - } + expected.match_pattern_with_context(context, &value)? } else { false } @@ -252,7 +245,12 @@ impl Value { meta::Type::Integer => Value::Integer(i64::MIN, i64::MAX), meta::Type::Enum => Value::Enum(None), meta::Type::String => Value::String(None), - meta::Type::DataType => Value::DataType(None), + meta::Type::DataType => Value::DataType(DataType { + class: None, + nullable: Arc::new(Value::Boolean(None)), + variation: Variation::Compatible, + parameters: None, + }), } } @@ -282,7 +280,7 @@ impl Pattern for Value { meta::Value::Integer(x) => Value::Integer(x, x), meta::Value::Enum(x) => Value::Enum(Some(vec![x])), meta::Value::String(x) => Value::String(Some(x)), - meta::Value::DataType(x) => Value::DataType(Some(DataType::exactly(x))), + meta::Value::DataType(x) => Value::DataType(DataType::exactly(x)), } } @@ -352,16 +350,7 @@ impl Pattern for Value { )) } } - Value::DataType(value) => { - if let Some(value) = value { - value.evaluate_with_context(context).map(meta::Value::from) - } else { - Err(cause!( - TypeDerivationInvalid, - "cannot evaluate undefined data type" - )) - } - } + Value::DataType(value) => value.evaluate_with_context(context).map(meta::Value::from), Value::Function(func, args) => func.evaluate(context, args), } } @@ -375,8 +364,7 @@ impl Pattern for Value { Value::Integer(a, b) => a == b, Value::Enum(x) => x.is_some(), Value::String(x) => x.is_some(), - Value::DataType(None) => false, - Value::DataType(Some(x)) => x.can_evaluate(), + Value::DataType(x) => x.can_evaluate(), Value::Function(_, _) => true, } } @@ -384,58 +372,58 @@ impl Pattern for Value { /// Binding matching structure. Four variations exist, as detailed below. /// -/// ## Normal bindings +/// ## Consistent bindings without nullability suffix /// /// (inconsistent = false, nullability = None) /// -/// When the binding is first matched against a value, it acts like Any and -/// assumes that value. When it is matched again in the same context later, -/// it only matches meta::Values that are exactly equal to the previous -/// match. When evaluated, it evaluates to the value that the binding was -/// bound to, or fails if it was not bound. Syntax: any identifier that -/// isn't recognized as anything else. +/// When the binding is first matched against a value, it matches any +/// non-typename metavalue and any non-nullable typename and binds the name to +/// that value. When it is matched again in the same context later, it only +/// matches metavalues that are exactly equal to the previous match. When +/// evaluated, it evaluates to the value that the name was bound to, or fails +/// if it was not bound. Syntax: any identifier that isn't recognized as +/// anything else. /// -/// ## Inconsistent bindings +/// ## Inconsistent bindings without nullability suffix /// /// (inconsistent = true, nullability = None) /// -/// A special binding that always accepts any metavalue. When the binding -/// is first matched against a value, the binding assumes the value. When -/// it is matched again in the same context later, the binding assumes the -/// boolean OR of the previous value of the binding and the matched value -/// if both values happen to be booleans; this is used to handle MIRROR -/// nullability behavior. If one or neither of the values is not a boolean, -/// the binding is not modified; this is used to handle inconsistent -/// variadic function arguments. When evaluated, it evaluates to the value -/// that the binding was bound to, or to false if it was not found; this, -/// again, is used for MIRROR nullability behavior (in the return -/// derivation this time). Syntax: a `?` followed by any identifier. +/// Behaves exactly like a consistent binding without nullability, except for +/// the following. +/// +/// - When matched and the name is already bound, it still matches any +/// non-typename metavalue and any non-nullable typename. This is used for +/// inconsistently-typed variadic argument slots. +/// - When matched against `true` and the name was previously bound to +/// `false`, the name is rebound to `true`. This is used to handle +/// `MIRROR` nullability behavior. +/// - When evaluated while the name is not yet bound, yields `false` as a +/// default value instead of failing. This is, again, used to handle +/// `MIRROR` nullability behavior. +/// +/// Syntax: a `?` followed by any identifier. /// -/// ## Normal bindings with nullability override +/// ## Consistent bindings with nullability suffix /// /// (inconsistent = false, nullability = Some(pattern)) /// /// A normal binding, but with overrides for nullability. Both the incoming -/// and (if any) previously bound value must be typenames. When matching -/// against a previously bound value, the nullability field of the type is -/// ignored; instead, the nullability of the incoming type is always -/// matched against the contained pattern. When evaluating, the nullability -/// of the previously bound value is overridden with the nullability as -/// evaluated by the contained pattern. Otherwise, the rules are the same +/// and (if any) previously bound value must be typenames. The bound typename +/// is always the non-nullable variant of the matched typename. When matching +/// against a previously bound typename, the nullability field of said typename +/// is ignored; instead, the nullability of the matched typename is always +/// matched against the contained nullability pattern. When evaluating, the +/// nullability of the previously bound value is overridden by the nullability +/// as evaluated by the contained pattern. Otherwise, the rules are the same /// as for normal bindings. /// -/// ## Inconsistent bindings with nullability override +/// ## Inconsistent bindings with nullability suffix /// /// (inconsistent = true, nullability = Some(pattern)) /// -/// An inconsistent binding, but with overrides for nullability. Both the -/// incoming and (if any) previously bound value must be typenames. When -/// matching, the nullability of the incoming type is matched against the -/// contained pattern. When evaluating, the nullability of the previously -/// bound value is overridden with the nullability as evaluated by the -/// contained pattern. Unlike for normal inconsistent bindings, the binding -/// must have been previously bound for evaluation to succeed. Otherwise, -/// the rules are the same as for normal inconsistent bindings. +/// Behaves exactly like a consistent binding with nullability suffix, except +/// that any previously bound value is ignored when matching. The name is never +/// rebound if it was previously bound. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Binding { /// The name of the binding, using its original case convention. Note that @@ -536,10 +524,15 @@ impl Binding { Value::exactly(current.clone()).match_strictly(context, value) } } else { - // Bind the incoming value to the binding. + // Bind the non-nullable version of the incoming value to the name. + let value_to_bind = if let meta::Value::DataType(dt) = value { + meta::Value::DataType(dt.override_nullable(false)) + } else { + value.clone() + }; context .bindings - .insert(self.name.to_ascii_lowercase(), value.clone()); + .insert(self.name.to_ascii_lowercase(), value_to_bind); // Match anything. Ok(true) @@ -605,10 +598,12 @@ impl Binding { /// Data type matching structure. #[derive(Clone, Debug, PartialEq, Eq)] pub struct DataType { - /// Type class (simple, compound, or user-defined). This must always match - /// exactly. [DataType] patterns are wrapped in an Option if the class can - /// also be omitted. - pub class: data::Class, + /// Type class (simple, compound, or user-defined) to be matched, if any. + /// The syntax for omitting the class name is to use the `typename` keyword + /// instead. In this case, the variation and parameter pack fields are + /// unused, and must be set to [Variation::Compatible] and None + /// respectively. + pub class: Option, /// Nullability, defined using a (boolean) Pattern. Syntax: /// - no suffix: Boolean(Some(false)) @@ -639,7 +634,11 @@ impl Describe for DataType { limit: util::string::Limit, ) -> std::fmt::Result { let mut non_recursive = String::new(); - write!(&mut non_recursive, "{}", self.class)?; + if let Some(class) = &self.class { + write!(&mut non_recursive, "{}", class)?; + } else { + write!(&mut non_recursive, "typename")?; + } match self.nullable.as_ref() { Value::Boolean(Some(false)) => (), Value::Boolean(Some(true)) => write!(&mut non_recursive, "?")?, @@ -678,9 +677,6 @@ impl DataType { value: &data::Type, ignore_nullability: bool, ) -> diagnostic::Result { - if !value.class().weak_equals(&self.class) { - return Ok(false); - } if !ignore_nullability && !self .nullable @@ -688,18 +684,23 @@ impl DataType { { return Ok(false); } - if !self.variation.match_pattern(value.variation())? { - return Ok(false); - } - if let Some(expected) = &self.parameters { - let parameters = value.parameters(); - if parameters.len() != expected.len() { + if let Some(class) = &self.class { + if !value.class().weak_equals(class) { return Ok(false); } - for (parameter, expected) in parameters.iter().zip(expected.iter()) { - if !expected.match_pattern_with_context(context, parameter)? { + if !self.variation.match_pattern(value.variation())? { + return Ok(false); + } + if let Some(expected) = &self.parameters { + let parameters = value.parameters(); + if parameters.len() != expected.len() { return Ok(false); } + for (parameter, expected) in parameters.iter().zip(expected.iter()) { + if !expected.match_pattern_with_context(context, parameter)? { + return Ok(false); + } + } } } Ok(true) @@ -711,7 +712,7 @@ impl Pattern for DataType { fn exactly(value: Self::Value) -> Self { DataType { - class: value.class().clone(), + class: Some(value.class().clone()), nullable: Arc::new(Value::exactly(meta::Value::from(value.nullable()))), variation: Variation::Exactly(value.variation().clone()), parameters: Some( @@ -737,7 +738,14 @@ impl Pattern for DataType { &self, context: &mut meta::Context, ) -> diagnostic::Result { - let class = self.class.clone(); + let class = if let Some(class) = self.class.clone() { + class + } else { + return Err(cause!( + TypeDerivationInvalid, + "typename pattern cannot be evaluated" + )); + }; let nullable = self .nullable .evaluate_with_context(context)? @@ -766,7 +774,7 @@ impl Pattern for DataType { return false; } } - self.nullable.can_evaluate() && self.variation.can_evaluate() + self.class.is_some() && self.nullable.can_evaluate() && self.variation.can_evaluate() } } diff --git a/rs/src/parse/extensions/simple/builder.rs b/rs/src/parse/extensions/simple/builder.rs index bc596cc9..37845c9d 100644 --- a/rs/src/parse/extensions/simple/builder.rs +++ b/rs/src/parse/extensions/simple/builder.rs @@ -9,6 +9,15 @@ use std::sync::Arc; #[derive(Clone, Debug, Default)] pub struct Builder { + /// Unique identifier for this extension. + pub extension_id: u64, + + /// Description of the extension. + pub description: String, + + /// The URI that was actually used to resolve this extension. + pub actual_uri: String, + /// Map with references to dependencies. pub dependencies: HashMap, @@ -28,6 +37,9 @@ pub struct Builder { impl From for extension::simple::module::Definition { fn from(builder: Builder) -> Self { extension::simple::module::Definition { + extension_id: builder.extension_id, + description: builder.description, + actual_uri: builder.actual_uri, dependencies: builder.dependencies, type_classes: Arc::new(builder.type_classes), type_variations: Arc::new(builder.type_variations), diff --git a/rs/src/parse/extensions/simple/derivations/SubstraitType.g4 b/rs/src/parse/extensions/simple/derivations/SubstraitType.g4 index 3c4f148b..17ac7040 100644 --- a/rs/src/parse/extensions/simple/derivations/SubstraitType.g4 +++ b/rs/src/parse/extensions/simple/derivations/SubstraitType.g4 @@ -310,8 +310,9 @@ patternMisc // Matches and evaluates to exactly the given string. | String #strExactly - // Matches any data type. - | Typename #dtAny + // Matches any typename for which the nullability matches the nullability + // suffix. Use `typename??` for either nullability. + | Typename nullability? #dtAny // Evaluates a function. When a function is used in match context, the // function (and its arguments) will be *evaluated* instead, and the incoming @@ -446,34 +447,36 @@ patternMisc // - The nullability, variation, and parameters fields are illegal and // must be blank. // - // - Normal binding: - // - If this is the first use of the binding, matches any value. The - // incoming metavalue is bound to the binding as a side effect. - // - If the binding was previously bound, matches only if the incoming + // - Consistent binding without nullability suffix: + // - If this is the first use of the name, matches non-typename + // metavalues and non-nullable typenames. The incoming metavalue is + // bound to the name as a side effect. + // - If the name was previously bound, matches only if the incoming // metavalue is exactly equal to the previous binding. - // - Can only be evaluated if the binding was previously bound, in which + // - Can only be evaluated if the name was previously bound, in which // case it yields the bound value exactly. - // - The variation and parameters fields are illegal and must be blank. + // - The variation and parameter pack fields are illegal and must be + // blank. // - // - Binding with nullability override: - // - If this is the first use of the binding, matches if and only if: + // - Consistent binding with nullability suffix: + // - If this is the first use of the name, matches if and only if: // - the incoming metavalue is a typename; and // - the nullability of the incoming type matches the nullability - // field. - // If the above rules match, the incoming type is bound to the - // binding as a side effect. - // - If the binding was previously bound, matches if and only if: + // suffix. + // If the above rules match, the incoming typename, with its + // nullability overridden to non-nullable, is bound to the name as a + // side effect. + // - If the name was previously bound, matches if and only if: // - the incoming metavalue is a typename; // - the nullability of the incoming type matches the nullability - // field; + // suffix; // - the previously bound metavalue is a typename; and // - the incoming type matches the previously bound type, ignoring - // nullability. - // - Can only be evaluated if the binding was previously bound. If the - // previously bound metavalue is not a typename, this is treated as a - // pattern match failure. The returned type is the previously bound - // type, with its nullability adjusted according to the nullability - // field evaluation rules. + // nullability and parameter names. + // - Can only be evaluated if the name was previously bound. If the + // previously bound metavalue is not a typename, evaluation fails. The + // returned type is the previously bound type, with its nullability + // adjusted according to the nullability suffix evaluation rules. // - The variation and parameters fields are illegal and must be blank. | identifierPath nullability? variation? parameters? #datatypeBindingOrConstant @@ -494,37 +497,38 @@ patternMisc // The exacty behavior for the pattern types is as follows. Rules that differ // from the consistent binding rules are highlighted with (!). // - // - Normal inconsistent binding: - // - If this is the first use of the binding, matches any value. The - // incoming metavalue is bound to the binding as a side effect. - // - (!) If the binding was previously bound, matches any value. If the - // incoming metavalue is boolean true, and the currently bound - // metavalue is boolean false, update the binding to boolean true. - // Otherwise, leave it unchanged. - // - (!) If this is the first use of the binding, evaluation yields + // - Inconsistent binding without nullability suffix: + // - If this is the first use of the name, matches non-typename + // metavalues and non-nullable typenames. The incoming metavalue is + // bound to the name as a side effect. + // - (!) If the name was previously bound, still matches all + // non-typename metavalues and non-nullable typenames. If the + // incoming metavalue is boolean `true`, and the currently bound + // metavalue is boolean `false`, rebind the name to `true` as a side + // effect. Otherwise, leave it unchanged. + // - (!) If this is the first use of the name, evaluation yields // the metabool `false` (for the nullability of the return type in // a MIRROR function). - // - If the binding was previously bound, evaluation yields the bound + // - If the name was previously bound, evaluation yields the bound // value exactly. // // - Inconsistent binding with nullability override: - // - If this is the first use of the binding, matches if and only if: + // - If this is the first use of the name, matches if and only if: // - the incoming metavalue is a typename; and // - the nullability of the incoming type matches the nullability // field. - // If the above rules match, the incoming type is bound to the - // binding as a side effect. + // If the above rules match, the incoming typename, with its + // nullability overridden to non-nullable, is bound to the name as a + // side effect. // - (!) If the binding was previously bound, matches if and only if: // - the incoming metavalue is a typename; and // - the nullability of the incoming type matches the nullability // field. - // The binding is not modified. - // - Can only be evaluated if the binding was previously bound. If the - // previously bound metavalue is not a typename, this is treated as a - // pattern match failure. The returned type is the previously bound - // type, with its nullability adjusted according to the nullability - // field evaluation rules. - // - The variation and parameters fields are illegal and must be blank. + // There are no side effects in this case. + // - Can only be evaluated if the name was previously bound. If the + // previously bound metavalue is not a typename, evaluation fails. The + // returned type is the previously bound type, with its nullability + // adjusted according to the nullability field evaluation rules. | Question Identifier nullability? #inconsistent // Unary negation function. Can only be evaluated and can only be applied to @@ -534,21 +538,20 @@ patternMisc | Minus pattern #unaryNegate ; -// Nullability suffix for a data type pattern. +// Nullability suffix. // // - If there is no such suffix, or the suffix is "!", the pattern matches // only non-nullable types, and also evaluates to a non-nullable type if -// applicable. The "!" suffix is necessary to distinguish between normal -// bindings and bindings with nullability override, but is otherwise -// optional and normally not written. +// applicable. The "!" suffix changes the semantics of bindings slightly +// compared to no suffix (specifically, `x!` only matches non-nullable +// typenames, but `x` also matches non-typename metavalues), but is +// otherwise optional and customarily not written. // - If this suffix is just "?", the pattern matches only nullable types, // and also evaluates to a nullable type if applicable. // - If this suffix is a "?" followed by a pattern, the pattern is matched // against false for non-nullable and true for nullable types. Likewise for // evaluation; if the pattern evaluates to false the type will be // non-nullable, if it evaluates to true it will be nullable. -// -// The "?" is also used for implicit-OR bindings. nullability : Bang #nonNullable | Question #nullable diff --git a/rs/src/parse/extensions/simple/derivations/mod.rs b/rs/src/parse/extensions/simple/derivations/mod.rs index 86f64a66..dc6e62bc 100644 --- a/rs/src/parse/extensions/simple/derivations/mod.rs +++ b/rs/src/parse/extensions/simple/derivations/mod.rs @@ -772,14 +772,12 @@ fn analyze_dtbc( .1 .unwrap_or(meta::pattern::Variation::Compatible); let parameters = antlr_child!(x, y, parameters, 0, analyze_type_parameters, z).1; - Ok(meta::pattern::Value::DataType(Some( - meta::pattern::DataType { - class, - nullable: std::sync::Arc::new(nullable), - variation, - parameters, - }, - ))) + Ok(meta::pattern::Value::DataType(meta::pattern::DataType { + class: Some(class), + nullable: std::sync::Arc::new(nullable), + variation, + parameters, + })) } } } @@ -1074,14 +1072,47 @@ fn analyze_pattern_misc( } Ok(meta::pattern::Value::String(s)) } - PatternMiscContextAll::DtAnyContext(_) => { + PatternMiscContextAll::DtAnyContext(x) => { diagnostic!( y, Error, TypeDerivationNotSupported, "the 'any data type' pattern is not officially supported" ); - Ok(meta::pattern::Value::DataType(None)) + let nullable = if let Some(nullability) = x.nullability() { + match nullability.as_ref() { + NullabilityContextAll::NullableContext(_) => { + meta::pattern::Value::Boolean(Some(true)) + } + NullabilityContextAll::NonNullableContext(_) => { + meta::pattern::Value::Boolean(Some(false)) + } + NullabilityContextAll::NullableIfContext(x) => { + let pattern = antlr_child!(x, y, nullability, 0, analyze_pattern, z) + .1 + .unwrap_or_default(); + let typ = pattern.determine_type(); + if !matches!(typ, meta::Type::Boolean | meta::Type::Unresolved) { + diagnostic!( + y, + Error, + TypeDerivationInvalid, + "nullability pattern must be boolean, but {typ} was found" + ); + } + pattern + } + NullabilityContextAll::Error(_) => meta::pattern::Value::Unresolved, + } + } else { + meta::pattern::Value::Boolean(Some(false)) + }; + Ok(meta::pattern::Value::DataType(meta::pattern::DataType { + class: None, + nullable: Arc::new(nullable), + variation: meta::pattern::Variation::Compatible, + parameters: None, + })) } PatternMiscContextAll::FunctionContext(x) => { let function = x diff --git a/rs/src/parse/extensions/simple/derivations/substraittypeparser.rs b/rs/src/parse/extensions/simple/derivations/substraittypeparser.rs index 92029a9d..3f036c16 100644 --- a/rs/src/parse/extensions/simple/derivations/substraittypeparser.rs +++ b/rs/src/parse/extensions/simple/derivations/substraittypeparser.rs @@ -4321,6 +4321,9 @@ pub trait DtAnyContextAttrs<'input>: SubstraitTypeParserContext<'input>{ fn Typename(&self) -> Option>> where Self:Sized{ self.get_token(Typename, 0) } + fn nullability(&self) -> Option>> where Self:Sized{ + self.child_of_type(0) + } } impl<'input> DtAnyContextAttrs<'input> for DtAnyContext<'input>{} @@ -5196,9 +5199,9 @@ where let mut _la: isize = -1; let result: Result<(), ANTLRError> = (|| { - recog.base.set_state(298); + recog.base.set_state(301); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(29,&mut recog.base)? { + match recog.interpreter.adaptive_predict(30,&mut recog.base)? { 1 =>{ let tmp = ParenthesesContextExt::new(&**_localctx); recog.base.enter_outer_alt(Some(tmp.clone()), 1); @@ -5453,6 +5456,20 @@ where recog.base.set_state(267); recog.base.match_token(Typename,&mut recog.err_handler)?; + recog.base.set_state(269); + recog.err_handler.sync(&mut recog.base)?; + match recog.interpreter.adaptive_predict(23,&mut recog.base)? { + x if x == 1=>{ + { + /*InvokeRule nullability*/ + recog.base.set_state(268); + recog.nullability()?; + + } + } + + _ => {} + } } } , @@ -5461,44 +5478,44 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 18); _localctx = tmp; { - recog.base.set_state(268); + recog.base.set_state(271); recog.base.match_token(Identifier,&mut recog.err_handler)?; - recog.base.set_state(269); + recog.base.set_state(272); recog.base.match_token(OpenParen,&mut recog.err_handler)?; - recog.base.set_state(278); + recog.base.set_state(281); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); if (((_la) & !0x3f) == 0 && ((1usize << _la) & ((1usize << If) | (1usize << True) | (1usize << False) | (1usize << Metabool) | (1usize << Metaint) | (1usize << Metaenum) | (1usize << Metastr) | (1usize << Typename) | (1usize << Question) | (1usize << Bang) | (1usize << OpenParen) | (1usize << OpenCurly))) != 0) || ((((_la - 40)) & !0x3f) == 0 && ((1usize << (_la - 40)) & ((1usize << (Plus - 40)) | (1usize << (Minus - 40)) | (1usize << (Range - 40)) | (1usize << (Nonzero - 40)) | (1usize << (Zero - 40)) | (1usize << (String - 40)) | (1usize << (Identifier - 40)))) != 0) { { /*InvokeRule pattern*/ - recog.base.set_state(270); + recog.base.set_state(273); recog.pattern()?; - recog.base.set_state(275); + recog.base.set_state(278); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); while _la==Comma { { { - recog.base.set_state(271); + recog.base.set_state(274); recog.base.match_token(Comma,&mut recog.err_handler)?; /*InvokeRule pattern*/ - recog.base.set_state(272); + recog.base.set_state(275); recog.pattern()?; } } - recog.base.set_state(277); + recog.base.set_state(280); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); } } } - recog.base.set_state(280); + recog.base.set_state(283); recog.base.match_token(CloseParen,&mut recog.err_handler)?; } @@ -5510,16 +5527,16 @@ where _localctx = tmp; { /*InvokeRule identifierPath*/ - recog.base.set_state(281); + recog.base.set_state(284); recog.identifierPath()?; - recog.base.set_state(283); + recog.base.set_state(286); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(25,&mut recog.base)? { + match recog.interpreter.adaptive_predict(26,&mut recog.base)? { x if x == 1=>{ { /*InvokeRule nullability*/ - recog.base.set_state(282); + recog.base.set_state(285); recog.nullability()?; } @@ -5527,13 +5544,13 @@ where _ => {} } - recog.base.set_state(286); + recog.base.set_state(289); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(26,&mut recog.base)? { + match recog.interpreter.adaptive_predict(27,&mut recog.base)? { x if x == 1=>{ { /*InvokeRule variation*/ - recog.base.set_state(285); + recog.base.set_state(288); recog.variation()?; } @@ -5541,13 +5558,13 @@ where _ => {} } - recog.base.set_state(289); + recog.base.set_state(292); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(27,&mut recog.base)? { + match recog.interpreter.adaptive_predict(28,&mut recog.base)? { x if x == 1=>{ { /*InvokeRule parameters*/ - recog.base.set_state(288); + recog.base.set_state(291); recog.parameters()?; } @@ -5563,19 +5580,19 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 20); _localctx = tmp; { - recog.base.set_state(291); + recog.base.set_state(294); recog.base.match_token(Question,&mut recog.err_handler)?; - recog.base.set_state(292); + recog.base.set_state(295); recog.base.match_token(Identifier,&mut recog.err_handler)?; - recog.base.set_state(294); + recog.base.set_state(297); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(28,&mut recog.base)? { + match recog.interpreter.adaptive_predict(29,&mut recog.base)? { x if x == 1=>{ { /*InvokeRule nullability*/ - recog.base.set_state(293); + recog.base.set_state(296); recog.nullability()?; } @@ -5591,11 +5608,11 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 21); _localctx = tmp; { - recog.base.set_state(296); + recog.base.set_state(299); recog.base.match_token(Minus,&mut recog.err_handler)?; /*InvokeRule pattern*/ - recog.base.set_state(297); + recog.base.set_state(300); recog.pattern()?; } @@ -5879,15 +5896,15 @@ where let mut _localctx: Rc = _localctx; let result: Result<(), ANTLRError> = (|| { - recog.base.set_state(304); + recog.base.set_state(307); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(30,&mut recog.base)? { + match recog.interpreter.adaptive_predict(31,&mut recog.base)? { 1 =>{ let tmp = NonNullableContextExt::new(&**_localctx); recog.base.enter_outer_alt(Some(tmp.clone()), 1); _localctx = tmp; { - recog.base.set_state(300); + recog.base.set_state(303); recog.base.match_token(Bang,&mut recog.err_handler)?; } @@ -5898,7 +5915,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 2); _localctx = tmp; { - recog.base.set_state(301); + recog.base.set_state(304); recog.base.match_token(Question,&mut recog.err_handler)?; } @@ -5909,11 +5926,11 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 3); _localctx = tmp; { - recog.base.set_state(302); + recog.base.set_state(305); recog.base.match_token(Question,&mut recog.err_handler)?; /*InvokeRule pattern*/ - recog.base.set_state(303); + recog.base.set_state(306); recog.pattern()?; } @@ -6015,14 +6032,14 @@ where //recog.base.enter_outer_alt(_localctx.clone(), 1); recog.base.enter_outer_alt(None, 1); { - recog.base.set_state(306); + recog.base.set_state(309); recog.base.match_token(OpenSquare,&mut recog.err_handler)?; /*InvokeRule variationBody*/ - recog.base.set_state(307); + recog.base.set_state(310); recog.variationBody()?; - recog.base.set_state(308); + recog.base.set_state(311); recog.base.match_token(CloseSquare,&mut recog.err_handler)?; } @@ -6297,7 +6314,7 @@ where let mut _localctx: Rc = _localctx; let result: Result<(), ANTLRError> = (|| { - recog.base.set_state(313); + recog.base.set_state(316); recog.err_handler.sync(&mut recog.base)?; match recog.base.input.la(1) { Question @@ -6306,7 +6323,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 1); _localctx = tmp; { - recog.base.set_state(310); + recog.base.set_state(313); recog.base.match_token(Question,&mut recog.err_handler)?; } @@ -6318,7 +6335,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 2); _localctx = tmp; { - recog.base.set_state(311); + recog.base.set_state(314); recog.base.match_token(Zero,&mut recog.err_handler)?; } @@ -6331,7 +6348,7 @@ where _localctx = tmp; { /*InvokeRule identifierPath*/ - recog.base.set_state(312); + recog.base.set_state(315); recog.identifierPath()?; } @@ -6446,41 +6463,41 @@ where //recog.base.enter_outer_alt(_localctx.clone(), 1); recog.base.enter_outer_alt(None, 1); { - recog.base.set_state(315); + recog.base.set_state(318); recog.base.match_token(LessThan,&mut recog.err_handler)?; - recog.base.set_state(324); + recog.base.set_state(327); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); if (((_la) & !0x3f) == 0 && ((1usize << _la) & ((1usize << If) | (1usize << Null) | (1usize << True) | (1usize << False) | (1usize << Metabool) | (1usize << Metaint) | (1usize << Metaenum) | (1usize << Metastr) | (1usize << Typename) | (1usize << Question) | (1usize << Bang) | (1usize << OpenParen) | (1usize << OpenCurly))) != 0) || ((((_la - 40)) & !0x3f) == 0 && ((1usize << (_la - 40)) & ((1usize << (Plus - 40)) | (1usize << (Minus - 40)) | (1usize << (Range - 40)) | (1usize << (Nonzero - 40)) | (1usize << (Zero - 40)) | (1usize << (String - 40)) | (1usize << (Identifier - 40)))) != 0) { { /*InvokeRule parameter*/ - recog.base.set_state(316); + recog.base.set_state(319); recog.parameter()?; - recog.base.set_state(321); + recog.base.set_state(324); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); while _la==Comma { { { - recog.base.set_state(317); + recog.base.set_state(320); recog.base.match_token(Comma,&mut recog.err_handler)?; /*InvokeRule parameter*/ - recog.base.set_state(318); + recog.base.set_state(321); recog.parameter()?; } } - recog.base.set_state(323); + recog.base.set_state(326); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); } } } - recog.base.set_state(326); + recog.base.set_state(329); recog.base.match_token(GreaterThan,&mut recog.err_handler)?; } @@ -6576,16 +6593,16 @@ where //recog.base.enter_outer_alt(_localctx.clone(), 1); recog.base.enter_outer_alt(None, 1); { - recog.base.set_state(331); + recog.base.set_state(334); recog.err_handler.sync(&mut recog.base)?; - match recog.interpreter.adaptive_predict(34,&mut recog.base)? { + match recog.interpreter.adaptive_predict(35,&mut recog.base)? { x if x == 1=>{ { /*InvokeRule identifierOrString*/ - recog.base.set_state(328); + recog.base.set_state(331); recog.identifierOrString()?; - recog.base.set_state(329); + recog.base.set_state(332); recog.base.match_token(Colon,&mut recog.err_handler)?; } @@ -6594,7 +6611,7 @@ where _ => {} } /*InvokeRule parameterValue*/ - recog.base.set_state(333); + recog.base.set_state(336); recog.parameterValue()?; } @@ -6810,7 +6827,7 @@ where let mut _localctx: Rc = _localctx; let result: Result<(), ANTLRError> = (|| { - recog.base.set_state(337); + recog.base.set_state(340); recog.err_handler.sync(&mut recog.base)?; match recog.base.input.la(1) { Null @@ -6819,7 +6836,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 1); _localctx = tmp; { - recog.base.set_state(335); + recog.base.set_state(338); recog.base.match_token(Null,&mut recog.err_handler)?; } @@ -6834,7 +6851,7 @@ where _localctx = tmp; { /*InvokeRule pattern*/ - recog.base.set_state(336); + recog.base.set_state(339); recog.pattern()?; } @@ -6944,12 +6961,12 @@ where //recog.base.enter_outer_alt(_localctx.clone(), 1); recog.base.enter_outer_alt(None, 1); { - recog.base.set_state(340); + recog.base.set_state(343); recog.err_handler.sync(&mut recog.base)?; _la = recog.base.input.la(1); if _la==Plus || _la==Minus { { - recog.base.set_state(339); + recog.base.set_state(342); _la = recog.base.input.la(1); if { !(_la==Plus || _la==Minus) } { recog.err_handler.recover_inline(&mut recog.base)?; @@ -6963,7 +6980,7 @@ where } } - recog.base.set_state(342); + recog.base.set_state(345); _la = recog.base.input.la(1); if { !(_la==Nonzero || _la==Zero) } { recog.err_handler.recover_inline(&mut recog.base)?; @@ -7075,27 +7092,27 @@ where //recog.base.enter_outer_alt(_localctx.clone(), 1); recog.base.enter_outer_alt(None, 1); { - recog.base.set_state(348); + recog.base.set_state(351); recog.err_handler.sync(&mut recog.base)?; - _alt = recog.interpreter.adaptive_predict(37,&mut recog.base)?; + _alt = recog.interpreter.adaptive_predict(38,&mut recog.base)?; while { _alt!=2 && _alt!=INVALID_ALT } { if _alt==1 { { { - recog.base.set_state(344); + recog.base.set_state(347); recog.base.match_token(Identifier,&mut recog.err_handler)?; - recog.base.set_state(345); + recog.base.set_state(348); recog.base.match_token(Period,&mut recog.err_handler)?; } } } - recog.base.set_state(350); + recog.base.set_state(353); recog.err_handler.sync(&mut recog.base)?; - _alt = recog.interpreter.adaptive_predict(37,&mut recog.base)?; + _alt = recog.interpreter.adaptive_predict(38,&mut recog.base)?; } - recog.base.set_state(351); + recog.base.set_state(354); recog.base.match_token(Identifier,&mut recog.err_handler)?; } @@ -7313,7 +7330,7 @@ where let mut _localctx: Rc = _localctx; let result: Result<(), ANTLRError> = (|| { - recog.base.set_state(355); + recog.base.set_state(358); recog.err_handler.sync(&mut recog.base)?; match recog.base.input.la(1) { String @@ -7322,7 +7339,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 1); _localctx = tmp; { - recog.base.set_state(353); + recog.base.set_state(356); recog.base.match_token(String,&mut recog.err_handler)?; } @@ -7334,7 +7351,7 @@ where recog.base.enter_outer_alt(Some(tmp.clone()), 2); _localctx = tmp; { - recog.base.set_state(354); + recog.base.set_state(357); recog.base.match_token(Identifier,&mut recog.err_handler)?; } @@ -7380,7 +7397,7 @@ lazy_static! { const _serializedATN:&'static str = "\x03\u{608b}\u{a72a}\u{8133}\u{b9ed}\u{417c}\u{3be7}\u{7786}\u{5964}\x03\ - \x32\u{168}\x04\x02\x09\x02\x04\x03\x09\x03\x04\x04\x09\x04\x04\x05\x09\ + \x32\u{16b}\x04\x02\x09\x02\x04\x03\x09\x03\x04\x04\x09\x04\x04\x05\x09\ \x05\x04\x06\x09\x06\x04\x07\x09\x07\x04\x08\x09\x08\x04\x09\x09\x09\x04\ \x0a\x09\x0a\x04\x0b\x09\x0b\x04\x0c\x09\x0c\x04\x0d\x09\x0d\x04\x0e\x09\ \x0e\x04\x0f\x09\x0f\x04\x10\x09\x10\x04\x11\x09\x11\x04\x12\x09\x12\x04\ @@ -7412,171 +7429,173 @@ const _serializedATN:&'static str = \x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\ \x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\ \x15\x03\x15\x03\x15\x07\x15\u{106}\x0a\x15\x0c\x15\x0e\x15\u{109}\x0b\x15\ - \x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\ - \x07\x15\u{114}\x0a\x15\x0c\x15\x0e\x15\u{117}\x0b\x15\x05\x15\u{119}\x0a\ - \x15\x03\x15\x03\x15\x03\x15\x05\x15\u{11e}\x0a\x15\x03\x15\x05\x15\u{121}\ - \x0a\x15\x03\x15\x05\x15\u{124}\x0a\x15\x03\x15\x03\x15\x03\x15\x05\x15\ - \u{129}\x0a\x15\x03\x15\x03\x15\x05\x15\u{12d}\x0a\x15\x03\x16\x03\x16\x03\ - \x16\x03\x16\x05\x16\u{133}\x0a\x16\x03\x17\x03\x17\x03\x17\x03\x17\x03\ - \x18\x03\x18\x03\x18\x05\x18\u{13c}\x0a\x18\x03\x19\x03\x19\x03\x19\x03\ - \x19\x07\x19\u{142}\x0a\x19\x0c\x19\x0e\x19\u{145}\x0b\x19\x05\x19\u{147}\ - \x0a\x19\x03\x19\x03\x19\x03\x1a\x03\x1a\x03\x1a\x05\x1a\u{14e}\x0a\x1a\ - \x03\x1a\x03\x1a\x03\x1b\x03\x1b\x05\x1b\u{154}\x0a\x1b\x03\x1c\x05\x1c\ - \u{157}\x0a\x1c\x03\x1c\x03\x1c\x03\x1d\x03\x1d\x07\x1d\u{15d}\x0a\x1d\x0c\ - \x1d\x0e\x1d\u{160}\x0b\x1d\x03\x1d\x03\x1d\x03\x1e\x03\x1e\x05\x1e\u{166}\ - \x0a\x1e\x03\x1e\x02\x02\x1f\x02\x04\x06\x08\x0a\x0c\x0e\x10\x12\x14\x16\ - \x18\x1a\x1c\x1e\x20\x22\x24\x26\x28\x2a\x2c\x2e\x30\x32\x34\x36\x38\x3a\ - \x02\x04\x03\x02\x2a\x2b\x03\x02\x2f\x30\x02\u{189}\x02\x3f\x03\x02\x02\ - \x02\x04\x54\x03\x02\x02\x02\x06\x6b\x03\x02\x02\x02\x08\x73\x03\x02\x02\ - \x02\x0a\u{8b}\x03\x02\x02\x02\x0c\u{8d}\x03\x02\x02\x02\x0e\u{96}\x03\x02\ - \x02\x02\x10\u{98}\x03\x02\x02\x02\x12\u{a1}\x03\x02\x02\x02\x14\u{a3}\x03\ - \x02\x02\x02\x16\u{ac}\x03\x02\x02\x02\x18\u{ae}\x03\x02\x02\x02\x1a\u{b9}\ - \x03\x02\x02\x02\x1c\u{bb}\x03\x02\x02\x02\x1e\u{c8}\x03\x02\x02\x02\x20\ - \u{ca}\x03\x02\x02\x02\x22\u{d5}\x03\x02\x02\x02\x24\u{d7}\x03\x02\x02\x02\ - \x26\u{e2}\x03\x02\x02\x02\x28\u{12c}\x03\x02\x02\x02\x2a\u{132}\x03\x02\ - \x02\x02\x2c\u{134}\x03\x02\x02\x02\x2e\u{13b}\x03\x02\x02\x02\x30\u{13d}\ - \x03\x02\x02\x02\x32\u{14d}\x03\x02\x02\x02\x34\u{153}\x03\x02\x02\x02\x36\ - \u{156}\x03\x02\x02\x02\x38\u{15e}\x03\x02\x02\x02\x3a\u{165}\x03\x02\x02\ - \x02\x3c\x3e\x07\x05\x02\x02\x3d\x3c\x03\x02\x02\x02\x3e\x41\x03\x02\x02\ - \x02\x3f\x3d\x03\x02\x02\x02\x3f\x40\x03\x02\x02\x02\x40\x45\x03\x02\x02\ - \x02\x41\x3f\x03\x02\x02\x02\x42\x44\x07\x06\x02\x02\x43\x42\x03\x02\x02\ - \x02\x44\x47\x03\x02\x02\x02\x45\x43\x03\x02\x02\x02\x45\x46\x03\x02\x02\ - \x02\x46\x48\x03\x02\x02\x02\x47\x45\x03\x02\x02\x02\x48\x4c\x05\x0c\x07\ - \x02\x49\x4b\x07\x06\x02\x02\x4a\x49\x03\x02\x02\x02\x4b\x4e\x03\x02\x02\ - \x02\x4c\x4a\x03\x02\x02\x02\x4c\x4d\x03\x02\x02\x02\x4d\x4f\x03\x02\x02\ - \x02\x4e\x4c\x03\x02\x02\x02\x4f\x50\x07\x02\x02\x03\x50\x03\x03\x02\x02\ - \x02\x51\x53\x07\x05\x02\x02\x52\x51\x03\x02\x02\x02\x53\x56\x03\x02\x02\ - \x02\x54\x52\x03\x02\x02\x02\x54\x55\x03\x02\x02\x02\x55\x5a\x03\x02\x02\ - \x02\x56\x54\x03\x02\x02\x02\x57\x59\x07\x06\x02\x02\x58\x57\x03\x02\x02\ - \x02\x59\x5c\x03\x02\x02\x02\x5a\x58\x03\x02\x02\x02\x5a\x5b\x03\x02\x02\ - \x02\x5b\x5d\x03\x02\x02\x02\x5c\x5a\x03\x02\x02\x02\x5d\x61\x05\x06\x04\ - \x02\x5e\x60\x07\x06\x02\x02\x5f\x5e\x03\x02\x02\x02\x60\x63\x03\x02\x02\ - \x02\x61\x5f\x03\x02\x02\x02\x61\x62\x03\x02\x02\x02\x62\x64\x03\x02\x02\ - \x02\x63\x61\x03\x02\x02\x02\x64\x65\x07\x02\x02\x03\x65\x05\x03\x02\x02\ - \x02\x66\x67\x05\x0a\x06\x02\x67\x68\x05\x08\x05\x02\x68\x6a\x03\x02\x02\ - \x02\x69\x66\x03\x02\x02\x02\x6a\x6d\x03\x02\x02\x02\x6b\x69\x03\x02\x02\ - \x02\x6b\x6c\x03\x02\x02\x02\x6c\x6e\x03\x02\x02\x02\x6d\x6b\x03\x02\x02\ - \x02\x6e\x6f\x05\x0c\x07\x02\x6f\x07\x03\x02\x02\x02\x70\x72\x07\x06\x02\ - \x02\x71\x70\x03\x02\x02\x02\x72\x75\x03\x02\x02\x02\x73\x71\x03\x02\x02\ - \x02\x73\x74\x03\x02\x02\x02\x74\x7e\x03\x02\x02\x02\x75\x73\x03\x02\x02\ - \x02\x76\x7f\x07\x06\x02\x02\x77\x7b\x07\x18\x02\x02\x78\x7a\x07\x06\x02\ - \x02\x79\x78\x03\x02\x02\x02\x7a\x7d\x03\x02\x02\x02\x7b\x79\x03\x02\x02\ - \x02\x7b\x7c\x03\x02\x02\x02\x7c\x7f\x03\x02\x02\x02\x7d\x7b\x03\x02\x02\ - \x02\x7e\x76\x03\x02\x02\x02\x7e\x77\x03\x02\x02\x02\x7f\x09\x03\x02\x02\ - \x02\u{80}\u{81}\x05\x0c\x07\x02\u{81}\u{82}\x07\x21\x02\x02\u{82}\u{83}\ - \x05\x0c\x07\x02\u{83}\u{8c}\x03\x02\x02\x02\u{84}\u{85}\x07\x08\x02\x02\ - \u{85}\u{86}\x05\x0c\x07\x02\u{86}\u{87}\x07\x09\x02\x02\u{87}\u{88}\x05\ - \x0c\x07\x02\u{88}\u{8c}\x03\x02\x02\x02\u{89}\u{8a}\x07\x08\x02\x02\u{8a}\ - \u{8c}\x05\x0c\x07\x02\u{8b}\u{80}\x03\x02\x02\x02\u{8b}\u{84}\x03\x02\x02\ - \x02\u{8b}\u{89}\x03\x02\x02\x02\u{8c}\x0b\x03\x02\x02\x02\u{8d}\u{8e}\x05\ - \x0e\x08\x02\u{8e}\x0d\x03\x02\x02\x02\u{8f}\u{97}\x05\x10\x09\x02\u{90}\ - \u{91}\x05\x10\x09\x02\u{91}\u{92}\x07\x19\x02\x02\u{92}\u{93}\x05\x10\x09\ - \x02\u{93}\u{94}\x07\x17\x02\x02\u{94}\u{95}\x05\x0c\x07\x02\u{95}\u{97}\ - \x03\x02\x02\x02\u{96}\u{8f}\x03\x02\x02\x02\u{96}\u{90}\x03\x02\x02\x02\ - \u{97}\x0f\x03\x02\x02\x02\u{98}\u{9e}\x05\x14\x0b\x02\u{99}\u{9a}\x05\x12\ - \x0a\x02\u{9a}\u{9b}\x05\x14\x0b\x02\u{9b}\u{9d}\x03\x02\x02\x02\u{9c}\u{99}\ - \x03\x02\x02\x02\u{9d}\u{a0}\x03\x02\x02\x02\u{9e}\u{9c}\x03\x02\x02\x02\ - \u{9e}\u{9f}\x03\x02\x02\x02\u{9f}\x11\x03\x02\x02\x02\u{a0}\u{9e}\x03\x02\ - \x02\x02\u{a1}\u{a2}\x07\x22\x02\x02\u{a2}\x13\x03\x02\x02\x02\u{a3}\u{a9}\ - \x05\x18\x0d\x02\u{a4}\u{a5}\x05\x16\x0c\x02\u{a5}\u{a6}\x05\x18\x0d\x02\ - \u{a6}\u{a8}\x03\x02\x02\x02\u{a7}\u{a4}\x03\x02\x02\x02\u{a8}\u{ab}\x03\ - \x02\x02\x02\u{a9}\u{a7}\x03\x02\x02\x02\u{a9}\u{aa}\x03\x02\x02\x02\u{aa}\ - \x15\x03\x02\x02\x02\u{ab}\u{a9}\x03\x02\x02\x02\u{ac}\u{ad}\x07\x23\x02\ - \x02\u{ad}\x17\x03\x02\x02\x02\u{ae}\u{b4}\x05\x1c\x0f\x02\u{af}\u{b0}\x05\ - \x1a\x0e\x02\u{b0}\u{b1}\x05\x1c\x0f\x02\u{b1}\u{b3}\x03\x02\x02\x02\u{b2}\ - \u{af}\x03\x02\x02\x02\u{b3}\u{b6}\x03\x02\x02\x02\u{b4}\u{b2}\x03\x02\x02\ - \x02\u{b4}\u{b5}\x03\x02\x02\x02\u{b5}\x19\x03\x02\x02\x02\u{b6}\u{b4}\x03\ - \x02\x02\x02\u{b7}\u{ba}\x07\x24\x02\x02\u{b8}\u{ba}\x07\x25\x02\x02\u{b9}\ - \u{b7}\x03\x02\x02\x02\u{b9}\u{b8}\x03\x02\x02\x02\u{ba}\x1b\x03\x02\x02\ - \x02\u{bb}\u{c1}\x05\x20\x11\x02\u{bc}\u{bd}\x05\x1e\x10\x02\u{bd}\u{be}\ - \x05\x20\x11\x02\u{be}\u{c0}\x03\x02\x02\x02\u{bf}\u{bc}\x03\x02\x02\x02\ - \u{c0}\u{c3}\x03\x02\x02\x02\u{c1}\u{bf}\x03\x02\x02\x02\u{c1}\u{c2}\x03\ - \x02\x02\x02\u{c2}\x1d\x03\x02\x02\x02\u{c3}\u{c1}\x03\x02\x02\x02\u{c4}\ - \u{c9}\x07\x26\x02\x02\u{c5}\u{c9}\x07\x27\x02\x02\u{c6}\u{c9}\x07\x28\x02\ - \x02\u{c7}\u{c9}\x07\x29\x02\x02\u{c8}\u{c4}\x03\x02\x02\x02\u{c8}\u{c5}\ - \x03\x02\x02\x02\u{c8}\u{c6}\x03\x02\x02\x02\u{c8}\u{c7}\x03\x02\x02\x02\ - \u{c9}\x1f\x03\x02\x02\x02\u{ca}\u{d0}\x05\x24\x13\x02\u{cb}\u{cc}\x05\x22\ - \x12\x02\u{cc}\u{cd}\x05\x24\x13\x02\u{cd}\u{cf}\x03\x02\x02\x02\u{ce}\u{cb}\ - \x03\x02\x02\x02\u{cf}\u{d2}\x03\x02\x02\x02\u{d0}\u{ce}\x03\x02\x02\x02\ - \u{d0}\u{d1}\x03\x02\x02\x02\u{d1}\x21\x03\x02\x02\x02\u{d2}\u{d0}\x03\x02\ - \x02\x02\u{d3}\u{d6}\x07\x2a\x02\x02\u{d4}\u{d6}\x07\x2b\x02\x02\u{d5}\u{d3}\ - \x03\x02\x02\x02\u{d5}\u{d4}\x03\x02\x02\x02\u{d6}\x23\x03\x02\x02\x02\u{d7}\ - \u{dd}\x05\x28\x15\x02\u{d8}\u{d9}\x05\x26\x14\x02\u{d9}\u{da}\x05\x28\x15\ - \x02\u{da}\u{dc}\x03\x02\x02\x02\u{db}\u{d8}\x03\x02\x02\x02\u{dc}\u{df}\ - \x03\x02\x02\x02\u{dd}\u{db}\x03\x02\x02\x02\u{dd}\u{de}\x03\x02\x02\x02\ - \u{de}\x25\x03\x02\x02\x02\u{df}\u{dd}\x03\x02\x02\x02\u{e0}\u{e3}\x07\x2c\ - \x02\x02\u{e1}\u{e3}\x07\x2d\x02\x02\u{e2}\u{e0}\x03\x02\x02\x02\u{e2}\u{e1}\ - \x03\x02\x02\x02\u{e3}\x27\x03\x02\x02\x02\u{e4}\u{e5}\x07\x1b\x02\x02\u{e5}\ - \u{e6}\x05\x0c\x07\x02\u{e6}\u{e7}\x07\x1c\x02\x02\u{e7}\u{12d}\x03\x02\ - \x02\x02\u{e8}\u{e9}\x07\x0a\x02\x02\u{e9}\u{ea}\x05\x0c\x07\x02\u{ea}\u{eb}\ - \x07\x0b\x02\x02\u{eb}\u{ec}\x05\x0c\x07\x02\u{ec}\u{ed}\x07\x0c\x02\x02\ - \u{ed}\u{ee}\x05\x0c\x07\x02\u{ee}\u{12d}\x03\x02\x02\x02\u{ef}\u{f0}\x07\ - \x1a\x02\x02\u{f0}\u{12d}\x05\x0c\x07\x02\u{f1}\u{12d}\x07\x19\x02\x02\u{f2}\ - \u{12d}\x07\x10\x02\x02\u{f3}\u{12d}\x07\x0e\x02\x02\u{f4}\u{12d}\x07\x0f\ - \x02\x02\u{f5}\u{12d}\x07\x11\x02\x02\u{f6}\u{f7}\x05\x36\x1c\x02\u{f7}\ - \u{f8}\x07\x2e\x02\x02\u{f8}\u{f9}\x05\x36\x1c\x02\u{f9}\u{12d}\x03\x02\ - \x02\x02\u{fa}\u{fb}\x05\x36\x1c\x02\u{fb}\u{fc}\x07\x2e\x02\x02\u{fc}\u{12d}\ - \x03\x02\x02\x02\u{fd}\u{fe}\x07\x2e\x02\x02\u{fe}\u{12d}\x05\x36\x1c\x02\ - \u{ff}\u{12d}\x05\x36\x1c\x02\u{100}\u{12d}\x07\x12\x02\x02\u{101}\u{102}\ - \x07\x1d\x02\x02\u{102}\u{107}\x07\x32\x02\x02\u{103}\u{104}\x07\x16\x02\ - \x02\u{104}\u{106}\x07\x32\x02\x02\u{105}\u{103}\x03\x02\x02\x02\u{106}\ - \u{109}\x03\x02\x02\x02\u{107}\u{105}\x03\x02\x02\x02\u{107}\u{108}\x03\ - \x02\x02\x02\u{108}\u{10a}\x03\x02\x02\x02\u{109}\u{107}\x03\x02\x02\x02\ - \u{10a}\u{12d}\x07\x1e\x02\x02\u{10b}\u{12d}\x07\x13\x02\x02\u{10c}\u{12d}\ - \x07\x31\x02\x02\u{10d}\u{12d}\x07\x14\x02\x02\u{10e}\u{10f}\x07\x32\x02\ - \x02\u{10f}\u{118}\x07\x1b\x02\x02\u{110}\u{115}\x05\x0c\x07\x02\u{111}\ - \u{112}\x07\x16\x02\x02\u{112}\u{114}\x05\x0c\x07\x02\u{113}\u{111}\x03\ - \x02\x02\x02\u{114}\u{117}\x03\x02\x02\x02\u{115}\u{113}\x03\x02\x02\x02\ - \u{115}\u{116}\x03\x02\x02\x02\u{116}\u{119}\x03\x02\x02\x02\u{117}\u{115}\ - \x03\x02\x02\x02\u{118}\u{110}\x03\x02\x02\x02\u{118}\u{119}\x03\x02\x02\ - \x02\u{119}\u{11a}\x03\x02\x02\x02\u{11a}\u{12d}\x07\x1c\x02\x02\u{11b}\ - \u{11d}\x05\x38\x1d\x02\u{11c}\u{11e}\x05\x2a\x16\x02\u{11d}\u{11c}\x03\ - \x02\x02\x02\u{11d}\u{11e}\x03\x02\x02\x02\u{11e}\u{120}\x03\x02\x02\x02\ - \u{11f}\u{121}\x05\x2c\x17\x02\u{120}\u{11f}\x03\x02\x02\x02\u{120}\u{121}\ - \x03\x02\x02\x02\u{121}\u{123}\x03\x02\x02\x02\u{122}\u{124}\x05\x30\x19\ - \x02\u{123}\u{122}\x03\x02\x02\x02\u{123}\u{124}\x03\x02\x02\x02\u{124}\ - \u{12d}\x03\x02\x02\x02\u{125}\u{126}\x07\x19\x02\x02\u{126}\u{128}\x07\ - \x32\x02\x02\u{127}\u{129}\x05\x2a\x16\x02\u{128}\u{127}\x03\x02\x02\x02\ - \u{128}\u{129}\x03\x02\x02\x02\u{129}\u{12d}\x03\x02\x02\x02\u{12a}\u{12b}\ - \x07\x2b\x02\x02\u{12b}\u{12d}\x05\x0c\x07\x02\u{12c}\u{e4}\x03\x02\x02\ - \x02\u{12c}\u{e8}\x03\x02\x02\x02\u{12c}\u{ef}\x03\x02\x02\x02\u{12c}\u{f1}\ - \x03\x02\x02\x02\u{12c}\u{f2}\x03\x02\x02\x02\u{12c}\u{f3}\x03\x02\x02\x02\ - \u{12c}\u{f4}\x03\x02\x02\x02\u{12c}\u{f5}\x03\x02\x02\x02\u{12c}\u{f6}\ - \x03\x02\x02\x02\u{12c}\u{fa}\x03\x02\x02\x02\u{12c}\u{fd}\x03\x02\x02\x02\ - \u{12c}\u{ff}\x03\x02\x02\x02\u{12c}\u{100}\x03\x02\x02\x02\u{12c}\u{101}\ - \x03\x02\x02\x02\u{12c}\u{10b}\x03\x02\x02\x02\u{12c}\u{10c}\x03\x02\x02\ - \x02\u{12c}\u{10d}\x03\x02\x02\x02\u{12c}\u{10e}\x03\x02\x02\x02\u{12c}\ - \u{11b}\x03\x02\x02\x02\u{12c}\u{125}\x03\x02\x02\x02\u{12c}\u{12a}\x03\ - \x02\x02\x02\u{12d}\x29\x03\x02\x02\x02\u{12e}\u{133}\x07\x1a\x02\x02\u{12f}\ - \u{133}\x07\x19\x02\x02\u{130}\u{131}\x07\x19\x02\x02\u{131}\u{133}\x05\ - \x0c\x07\x02\u{132}\u{12e}\x03\x02\x02\x02\u{132}\u{12f}\x03\x02\x02\x02\ - \u{132}\u{130}\x03\x02\x02\x02\u{133}\x2b\x03\x02\x02\x02\u{134}\u{135}\ - \x07\x1f\x02\x02\u{135}\u{136}\x05\x2e\x18\x02\u{136}\u{137}\x07\x20\x02\ - \x02\u{137}\x2d\x03\x02\x02\x02\u{138}\u{13c}\x07\x19\x02\x02\u{139}\u{13c}\ - \x07\x30\x02\x02\u{13a}\u{13c}\x05\x38\x1d\x02\u{13b}\u{138}\x03\x02\x02\ - \x02\u{13b}\u{139}\x03\x02\x02\x02\u{13b}\u{13a}\x03\x02\x02\x02\u{13c}\ - \x2f\x03\x02\x02\x02\u{13d}\u{146}\x07\x26\x02\x02\u{13e}\u{143}\x05\x32\ - \x1a\x02\u{13f}\u{140}\x07\x16\x02\x02\u{140}\u{142}\x05\x32\x1a\x02\u{141}\ - \u{13f}\x03\x02\x02\x02\u{142}\u{145}\x03\x02\x02\x02\u{143}\u{141}\x03\ - \x02\x02\x02\u{143}\u{144}\x03\x02\x02\x02\u{144}\u{147}\x03\x02\x02\x02\ - \u{145}\u{143}\x03\x02\x02\x02\u{146}\u{13e}\x03\x02\x02\x02\u{146}\u{147}\ - \x03\x02\x02\x02\u{147}\u{148}\x03\x02\x02\x02\u{148}\u{149}\x07\x28\x02\ - \x02\u{149}\x31\x03\x02\x02\x02\u{14a}\u{14b}\x05\x3a\x1e\x02\u{14b}\u{14c}\ - \x07\x17\x02\x02\u{14c}\u{14e}\x03\x02\x02\x02\u{14d}\u{14a}\x03\x02\x02\ - \x02\u{14d}\u{14e}\x03\x02\x02\x02\u{14e}\u{14f}\x03\x02\x02\x02\u{14f}\ - \u{150}\x05\x34\x1b\x02\u{150}\x33\x03\x02\x02\x02\u{151}\u{154}\x07\x0d\ - \x02\x02\u{152}\u{154}\x05\x0c\x07\x02\u{153}\u{151}\x03\x02\x02\x02\u{153}\ - \u{152}\x03\x02\x02\x02\u{154}\x35\x03\x02\x02\x02\u{155}\u{157}\x09\x02\ - \x02\x02\u{156}\u{155}\x03\x02\x02\x02\u{156}\u{157}\x03\x02\x02\x02\u{157}\ - \u{158}\x03\x02\x02\x02\u{158}\u{159}\x09\x03\x02\x02\u{159}\x37\x03\x02\ - \x02\x02\u{15a}\u{15b}\x07\x32\x02\x02\u{15b}\u{15d}\x07\x15\x02\x02\u{15c}\ - \u{15a}\x03\x02\x02\x02\u{15d}\u{160}\x03\x02\x02\x02\u{15e}\u{15c}\x03\ - \x02\x02\x02\u{15e}\u{15f}\x03\x02\x02\x02\u{15f}\u{161}\x03\x02\x02\x02\ - \u{160}\u{15e}\x03\x02\x02\x02\u{161}\u{162}\x07\x32\x02\x02\u{162}\x39\ - \x03\x02\x02\x02\u{163}\u{166}\x07\x31\x02\x02\u{164}\u{166}\x07\x32\x02\ - \x02\u{165}\u{163}\x03\x02\x02\x02\u{165}\u{164}\x03\x02\x02\x02\u{166}\ - \x3b\x03\x02\x02\x02\x29\x3f\x45\x4c\x54\x5a\x61\x6b\x73\x7b\x7e\u{8b}\u{96}\ - \u{9e}\u{a9}\u{b4}\u{b9}\u{c1}\u{c8}\u{d0}\u{d5}\u{dd}\u{e2}\u{107}\u{115}\ - \u{118}\u{11d}\u{120}\u{123}\u{128}\u{12c}\u{132}\u{13b}\u{143}\u{146}\u{14d}\ - \u{153}\u{156}\u{15e}\u{165}"; + \x03\x15\x03\x15\x03\x15\x03\x15\x03\x15\x05\x15\u{110}\x0a\x15\x03\x15\ + \x03\x15\x03\x15\x03\x15\x03\x15\x07\x15\u{117}\x0a\x15\x0c\x15\x0e\x15\ + \u{11a}\x0b\x15\x05\x15\u{11c}\x0a\x15\x03\x15\x03\x15\x03\x15\x05\x15\u{121}\ + \x0a\x15\x03\x15\x05\x15\u{124}\x0a\x15\x03\x15\x05\x15\u{127}\x0a\x15\x03\ + \x15\x03\x15\x03\x15\x05\x15\u{12c}\x0a\x15\x03\x15\x03\x15\x05\x15\u{130}\ + \x0a\x15\x03\x16\x03\x16\x03\x16\x03\x16\x05\x16\u{136}\x0a\x16\x03\x17\ + \x03\x17\x03\x17\x03\x17\x03\x18\x03\x18\x03\x18\x05\x18\u{13f}\x0a\x18\ + \x03\x19\x03\x19\x03\x19\x03\x19\x07\x19\u{145}\x0a\x19\x0c\x19\x0e\x19\ + \u{148}\x0b\x19\x05\x19\u{14a}\x0a\x19\x03\x19\x03\x19\x03\x1a\x03\x1a\x03\ + \x1a\x05\x1a\u{151}\x0a\x1a\x03\x1a\x03\x1a\x03\x1b\x03\x1b\x05\x1b\u{157}\ + \x0a\x1b\x03\x1c\x05\x1c\u{15a}\x0a\x1c\x03\x1c\x03\x1c\x03\x1d\x03\x1d\ + \x07\x1d\u{160}\x0a\x1d\x0c\x1d\x0e\x1d\u{163}\x0b\x1d\x03\x1d\x03\x1d\x03\ + \x1e\x03\x1e\x05\x1e\u{169}\x0a\x1e\x03\x1e\x02\x02\x1f\x02\x04\x06\x08\ + \x0a\x0c\x0e\x10\x12\x14\x16\x18\x1a\x1c\x1e\x20\x22\x24\x26\x28\x2a\x2c\ + \x2e\x30\x32\x34\x36\x38\x3a\x02\x04\x03\x02\x2a\x2b\x03\x02\x2f\x30\x02\ + \u{18d}\x02\x3f\x03\x02\x02\x02\x04\x54\x03\x02\x02\x02\x06\x6b\x03\x02\ + \x02\x02\x08\x73\x03\x02\x02\x02\x0a\u{8b}\x03\x02\x02\x02\x0c\u{8d}\x03\ + \x02\x02\x02\x0e\u{96}\x03\x02\x02\x02\x10\u{98}\x03\x02\x02\x02\x12\u{a1}\ + \x03\x02\x02\x02\x14\u{a3}\x03\x02\x02\x02\x16\u{ac}\x03\x02\x02\x02\x18\ + \u{ae}\x03\x02\x02\x02\x1a\u{b9}\x03\x02\x02\x02\x1c\u{bb}\x03\x02\x02\x02\ + \x1e\u{c8}\x03\x02\x02\x02\x20\u{ca}\x03\x02\x02\x02\x22\u{d5}\x03\x02\x02\ + \x02\x24\u{d7}\x03\x02\x02\x02\x26\u{e2}\x03\x02\x02\x02\x28\u{12f}\x03\ + \x02\x02\x02\x2a\u{135}\x03\x02\x02\x02\x2c\u{137}\x03\x02\x02\x02\x2e\u{13e}\ + \x03\x02\x02\x02\x30\u{140}\x03\x02\x02\x02\x32\u{150}\x03\x02\x02\x02\x34\ + \u{156}\x03\x02\x02\x02\x36\u{159}\x03\x02\x02\x02\x38\u{161}\x03\x02\x02\ + \x02\x3a\u{168}\x03\x02\x02\x02\x3c\x3e\x07\x05\x02\x02\x3d\x3c\x03\x02\ + \x02\x02\x3e\x41\x03\x02\x02\x02\x3f\x3d\x03\x02\x02\x02\x3f\x40\x03\x02\ + \x02\x02\x40\x45\x03\x02\x02\x02\x41\x3f\x03\x02\x02\x02\x42\x44\x07\x06\ + \x02\x02\x43\x42\x03\x02\x02\x02\x44\x47\x03\x02\x02\x02\x45\x43\x03\x02\ + \x02\x02\x45\x46\x03\x02\x02\x02\x46\x48\x03\x02\x02\x02\x47\x45\x03\x02\ + \x02\x02\x48\x4c\x05\x0c\x07\x02\x49\x4b\x07\x06\x02\x02\x4a\x49\x03\x02\ + \x02\x02\x4b\x4e\x03\x02\x02\x02\x4c\x4a\x03\x02\x02\x02\x4c\x4d\x03\x02\ + \x02\x02\x4d\x4f\x03\x02\x02\x02\x4e\x4c\x03\x02\x02\x02\x4f\x50\x07\x02\ + \x02\x03\x50\x03\x03\x02\x02\x02\x51\x53\x07\x05\x02\x02\x52\x51\x03\x02\ + \x02\x02\x53\x56\x03\x02\x02\x02\x54\x52\x03\x02\x02\x02\x54\x55\x03\x02\ + \x02\x02\x55\x5a\x03\x02\x02\x02\x56\x54\x03\x02\x02\x02\x57\x59\x07\x06\ + \x02\x02\x58\x57\x03\x02\x02\x02\x59\x5c\x03\x02\x02\x02\x5a\x58\x03\x02\ + \x02\x02\x5a\x5b\x03\x02\x02\x02\x5b\x5d\x03\x02\x02\x02\x5c\x5a\x03\x02\ + \x02\x02\x5d\x61\x05\x06\x04\x02\x5e\x60\x07\x06\x02\x02\x5f\x5e\x03\x02\ + \x02\x02\x60\x63\x03\x02\x02\x02\x61\x5f\x03\x02\x02\x02\x61\x62\x03\x02\ + \x02\x02\x62\x64\x03\x02\x02\x02\x63\x61\x03\x02\x02\x02\x64\x65\x07\x02\ + \x02\x03\x65\x05\x03\x02\x02\x02\x66\x67\x05\x0a\x06\x02\x67\x68\x05\x08\ + \x05\x02\x68\x6a\x03\x02\x02\x02\x69\x66\x03\x02\x02\x02\x6a\x6d\x03\x02\ + \x02\x02\x6b\x69\x03\x02\x02\x02\x6b\x6c\x03\x02\x02\x02\x6c\x6e\x03\x02\ + \x02\x02\x6d\x6b\x03\x02\x02\x02\x6e\x6f\x05\x0c\x07\x02\x6f\x07\x03\x02\ + \x02\x02\x70\x72\x07\x06\x02\x02\x71\x70\x03\x02\x02\x02\x72\x75\x03\x02\ + \x02\x02\x73\x71\x03\x02\x02\x02\x73\x74\x03\x02\x02\x02\x74\x7e\x03\x02\ + \x02\x02\x75\x73\x03\x02\x02\x02\x76\x7f\x07\x06\x02\x02\x77\x7b\x07\x18\ + \x02\x02\x78\x7a\x07\x06\x02\x02\x79\x78\x03\x02\x02\x02\x7a\x7d\x03\x02\ + \x02\x02\x7b\x79\x03\x02\x02\x02\x7b\x7c\x03\x02\x02\x02\x7c\x7f\x03\x02\ + \x02\x02\x7d\x7b\x03\x02\x02\x02\x7e\x76\x03\x02\x02\x02\x7e\x77\x03\x02\ + \x02\x02\x7f\x09\x03\x02\x02\x02\u{80}\u{81}\x05\x0c\x07\x02\u{81}\u{82}\ + \x07\x21\x02\x02\u{82}\u{83}\x05\x0c\x07\x02\u{83}\u{8c}\x03\x02\x02\x02\ + \u{84}\u{85}\x07\x08\x02\x02\u{85}\u{86}\x05\x0c\x07\x02\u{86}\u{87}\x07\ + \x09\x02\x02\u{87}\u{88}\x05\x0c\x07\x02\u{88}\u{8c}\x03\x02\x02\x02\u{89}\ + \u{8a}\x07\x08\x02\x02\u{8a}\u{8c}\x05\x0c\x07\x02\u{8b}\u{80}\x03\x02\x02\ + \x02\u{8b}\u{84}\x03\x02\x02\x02\u{8b}\u{89}\x03\x02\x02\x02\u{8c}\x0b\x03\ + \x02\x02\x02\u{8d}\u{8e}\x05\x0e\x08\x02\u{8e}\x0d\x03\x02\x02\x02\u{8f}\ + \u{97}\x05\x10\x09\x02\u{90}\u{91}\x05\x10\x09\x02\u{91}\u{92}\x07\x19\x02\ + \x02\u{92}\u{93}\x05\x10\x09\x02\u{93}\u{94}\x07\x17\x02\x02\u{94}\u{95}\ + \x05\x0c\x07\x02\u{95}\u{97}\x03\x02\x02\x02\u{96}\u{8f}\x03\x02\x02\x02\ + \u{96}\u{90}\x03\x02\x02\x02\u{97}\x0f\x03\x02\x02\x02\u{98}\u{9e}\x05\x14\ + \x0b\x02\u{99}\u{9a}\x05\x12\x0a\x02\u{9a}\u{9b}\x05\x14\x0b\x02\u{9b}\u{9d}\ + \x03\x02\x02\x02\u{9c}\u{99}\x03\x02\x02\x02\u{9d}\u{a0}\x03\x02\x02\x02\ + \u{9e}\u{9c}\x03\x02\x02\x02\u{9e}\u{9f}\x03\x02\x02\x02\u{9f}\x11\x03\x02\ + \x02\x02\u{a0}\u{9e}\x03\x02\x02\x02\u{a1}\u{a2}\x07\x22\x02\x02\u{a2}\x13\ + \x03\x02\x02\x02\u{a3}\u{a9}\x05\x18\x0d\x02\u{a4}\u{a5}\x05\x16\x0c\x02\ + \u{a5}\u{a6}\x05\x18\x0d\x02\u{a6}\u{a8}\x03\x02\x02\x02\u{a7}\u{a4}\x03\ + \x02\x02\x02\u{a8}\u{ab}\x03\x02\x02\x02\u{a9}\u{a7}\x03\x02\x02\x02\u{a9}\ + \u{aa}\x03\x02\x02\x02\u{aa}\x15\x03\x02\x02\x02\u{ab}\u{a9}\x03\x02\x02\ + \x02\u{ac}\u{ad}\x07\x23\x02\x02\u{ad}\x17\x03\x02\x02\x02\u{ae}\u{b4}\x05\ + \x1c\x0f\x02\u{af}\u{b0}\x05\x1a\x0e\x02\u{b0}\u{b1}\x05\x1c\x0f\x02\u{b1}\ + \u{b3}\x03\x02\x02\x02\u{b2}\u{af}\x03\x02\x02\x02\u{b3}\u{b6}\x03\x02\x02\ + \x02\u{b4}\u{b2}\x03\x02\x02\x02\u{b4}\u{b5}\x03\x02\x02\x02\u{b5}\x19\x03\ + \x02\x02\x02\u{b6}\u{b4}\x03\x02\x02\x02\u{b7}\u{ba}\x07\x24\x02\x02\u{b8}\ + \u{ba}\x07\x25\x02\x02\u{b9}\u{b7}\x03\x02\x02\x02\u{b9}\u{b8}\x03\x02\x02\ + \x02\u{ba}\x1b\x03\x02\x02\x02\u{bb}\u{c1}\x05\x20\x11\x02\u{bc}\u{bd}\x05\ + \x1e\x10\x02\u{bd}\u{be}\x05\x20\x11\x02\u{be}\u{c0}\x03\x02\x02\x02\u{bf}\ + \u{bc}\x03\x02\x02\x02\u{c0}\u{c3}\x03\x02\x02\x02\u{c1}\u{bf}\x03\x02\x02\ + \x02\u{c1}\u{c2}\x03\x02\x02\x02\u{c2}\x1d\x03\x02\x02\x02\u{c3}\u{c1}\x03\ + \x02\x02\x02\u{c4}\u{c9}\x07\x26\x02\x02\u{c5}\u{c9}\x07\x27\x02\x02\u{c6}\ + \u{c9}\x07\x28\x02\x02\u{c7}\u{c9}\x07\x29\x02\x02\u{c8}\u{c4}\x03\x02\x02\ + \x02\u{c8}\u{c5}\x03\x02\x02\x02\u{c8}\u{c6}\x03\x02\x02\x02\u{c8}\u{c7}\ + \x03\x02\x02\x02\u{c9}\x1f\x03\x02\x02\x02\u{ca}\u{d0}\x05\x24\x13\x02\u{cb}\ + \u{cc}\x05\x22\x12\x02\u{cc}\u{cd}\x05\x24\x13\x02\u{cd}\u{cf}\x03\x02\x02\ + \x02\u{ce}\u{cb}\x03\x02\x02\x02\u{cf}\u{d2}\x03\x02\x02\x02\u{d0}\u{ce}\ + \x03\x02\x02\x02\u{d0}\u{d1}\x03\x02\x02\x02\u{d1}\x21\x03\x02\x02\x02\u{d2}\ + \u{d0}\x03\x02\x02\x02\u{d3}\u{d6}\x07\x2a\x02\x02\u{d4}\u{d6}\x07\x2b\x02\ + \x02\u{d5}\u{d3}\x03\x02\x02\x02\u{d5}\u{d4}\x03\x02\x02\x02\u{d6}\x23\x03\ + \x02\x02\x02\u{d7}\u{dd}\x05\x28\x15\x02\u{d8}\u{d9}\x05\x26\x14\x02\u{d9}\ + \u{da}\x05\x28\x15\x02\u{da}\u{dc}\x03\x02\x02\x02\u{db}\u{d8}\x03\x02\x02\ + \x02\u{dc}\u{df}\x03\x02\x02\x02\u{dd}\u{db}\x03\x02\x02\x02\u{dd}\u{de}\ + \x03\x02\x02\x02\u{de}\x25\x03\x02\x02\x02\u{df}\u{dd}\x03\x02\x02\x02\u{e0}\ + \u{e3}\x07\x2c\x02\x02\u{e1}\u{e3}\x07\x2d\x02\x02\u{e2}\u{e0}\x03\x02\x02\ + \x02\u{e2}\u{e1}\x03\x02\x02\x02\u{e3}\x27\x03\x02\x02\x02\u{e4}\u{e5}\x07\ + \x1b\x02\x02\u{e5}\u{e6}\x05\x0c\x07\x02\u{e6}\u{e7}\x07\x1c\x02\x02\u{e7}\ + \u{130}\x03\x02\x02\x02\u{e8}\u{e9}\x07\x0a\x02\x02\u{e9}\u{ea}\x05\x0c\ + \x07\x02\u{ea}\u{eb}\x07\x0b\x02\x02\u{eb}\u{ec}\x05\x0c\x07\x02\u{ec}\u{ed}\ + \x07\x0c\x02\x02\u{ed}\u{ee}\x05\x0c\x07\x02\u{ee}\u{130}\x03\x02\x02\x02\ + \u{ef}\u{f0}\x07\x1a\x02\x02\u{f0}\u{130}\x05\x0c\x07\x02\u{f1}\u{130}\x07\ + \x19\x02\x02\u{f2}\u{130}\x07\x10\x02\x02\u{f3}\u{130}\x07\x0e\x02\x02\u{f4}\ + \u{130}\x07\x0f\x02\x02\u{f5}\u{130}\x07\x11\x02\x02\u{f6}\u{f7}\x05\x36\ + \x1c\x02\u{f7}\u{f8}\x07\x2e\x02\x02\u{f8}\u{f9}\x05\x36\x1c\x02\u{f9}\u{130}\ + \x03\x02\x02\x02\u{fa}\u{fb}\x05\x36\x1c\x02\u{fb}\u{fc}\x07\x2e\x02\x02\ + \u{fc}\u{130}\x03\x02\x02\x02\u{fd}\u{fe}\x07\x2e\x02\x02\u{fe}\u{130}\x05\ + \x36\x1c\x02\u{ff}\u{130}\x05\x36\x1c\x02\u{100}\u{130}\x07\x12\x02\x02\ + \u{101}\u{102}\x07\x1d\x02\x02\u{102}\u{107}\x07\x32\x02\x02\u{103}\u{104}\ + \x07\x16\x02\x02\u{104}\u{106}\x07\x32\x02\x02\u{105}\u{103}\x03\x02\x02\ + \x02\u{106}\u{109}\x03\x02\x02\x02\u{107}\u{105}\x03\x02\x02\x02\u{107}\ + \u{108}\x03\x02\x02\x02\u{108}\u{10a}\x03\x02\x02\x02\u{109}\u{107}\x03\ + \x02\x02\x02\u{10a}\u{130}\x07\x1e\x02\x02\u{10b}\u{130}\x07\x13\x02\x02\ + \u{10c}\u{130}\x07\x31\x02\x02\u{10d}\u{10f}\x07\x14\x02\x02\u{10e}\u{110}\ + \x05\x2a\x16\x02\u{10f}\u{10e}\x03\x02\x02\x02\u{10f}\u{110}\x03\x02\x02\ + \x02\u{110}\u{130}\x03\x02\x02\x02\u{111}\u{112}\x07\x32\x02\x02\u{112}\ + \u{11b}\x07\x1b\x02\x02\u{113}\u{118}\x05\x0c\x07\x02\u{114}\u{115}\x07\ + \x16\x02\x02\u{115}\u{117}\x05\x0c\x07\x02\u{116}\u{114}\x03\x02\x02\x02\ + \u{117}\u{11a}\x03\x02\x02\x02\u{118}\u{116}\x03\x02\x02\x02\u{118}\u{119}\ + \x03\x02\x02\x02\u{119}\u{11c}\x03\x02\x02\x02\u{11a}\u{118}\x03\x02\x02\ + \x02\u{11b}\u{113}\x03\x02\x02\x02\u{11b}\u{11c}\x03\x02\x02\x02\u{11c}\ + \u{11d}\x03\x02\x02\x02\u{11d}\u{130}\x07\x1c\x02\x02\u{11e}\u{120}\x05\ + \x38\x1d\x02\u{11f}\u{121}\x05\x2a\x16\x02\u{120}\u{11f}\x03\x02\x02\x02\ + \u{120}\u{121}\x03\x02\x02\x02\u{121}\u{123}\x03\x02\x02\x02\u{122}\u{124}\ + \x05\x2c\x17\x02\u{123}\u{122}\x03\x02\x02\x02\u{123}\u{124}\x03\x02\x02\ + \x02\u{124}\u{126}\x03\x02\x02\x02\u{125}\u{127}\x05\x30\x19\x02\u{126}\ + \u{125}\x03\x02\x02\x02\u{126}\u{127}\x03\x02\x02\x02\u{127}\u{130}\x03\ + \x02\x02\x02\u{128}\u{129}\x07\x19\x02\x02\u{129}\u{12b}\x07\x32\x02\x02\ + \u{12a}\u{12c}\x05\x2a\x16\x02\u{12b}\u{12a}\x03\x02\x02\x02\u{12b}\u{12c}\ + \x03\x02\x02\x02\u{12c}\u{130}\x03\x02\x02\x02\u{12d}\u{12e}\x07\x2b\x02\ + \x02\u{12e}\u{130}\x05\x0c\x07\x02\u{12f}\u{e4}\x03\x02\x02\x02\u{12f}\u{e8}\ + \x03\x02\x02\x02\u{12f}\u{ef}\x03\x02\x02\x02\u{12f}\u{f1}\x03\x02\x02\x02\ + \u{12f}\u{f2}\x03\x02\x02\x02\u{12f}\u{f3}\x03\x02\x02\x02\u{12f}\u{f4}\ + \x03\x02\x02\x02\u{12f}\u{f5}\x03\x02\x02\x02\u{12f}\u{f6}\x03\x02\x02\x02\ + \u{12f}\u{fa}\x03\x02\x02\x02\u{12f}\u{fd}\x03\x02\x02\x02\u{12f}\u{ff}\ + \x03\x02\x02\x02\u{12f}\u{100}\x03\x02\x02\x02\u{12f}\u{101}\x03\x02\x02\ + \x02\u{12f}\u{10b}\x03\x02\x02\x02\u{12f}\u{10c}\x03\x02\x02\x02\u{12f}\ + \u{10d}\x03\x02\x02\x02\u{12f}\u{111}\x03\x02\x02\x02\u{12f}\u{11e}\x03\ + \x02\x02\x02\u{12f}\u{128}\x03\x02\x02\x02\u{12f}\u{12d}\x03\x02\x02\x02\ + \u{130}\x29\x03\x02\x02\x02\u{131}\u{136}\x07\x1a\x02\x02\u{132}\u{136}\ + \x07\x19\x02\x02\u{133}\u{134}\x07\x19\x02\x02\u{134}\u{136}\x05\x0c\x07\ + \x02\u{135}\u{131}\x03\x02\x02\x02\u{135}\u{132}\x03\x02\x02\x02\u{135}\ + \u{133}\x03\x02\x02\x02\u{136}\x2b\x03\x02\x02\x02\u{137}\u{138}\x07\x1f\ + \x02\x02\u{138}\u{139}\x05\x2e\x18\x02\u{139}\u{13a}\x07\x20\x02\x02\u{13a}\ + \x2d\x03\x02\x02\x02\u{13b}\u{13f}\x07\x19\x02\x02\u{13c}\u{13f}\x07\x30\ + \x02\x02\u{13d}\u{13f}\x05\x38\x1d\x02\u{13e}\u{13b}\x03\x02\x02\x02\u{13e}\ + \u{13c}\x03\x02\x02\x02\u{13e}\u{13d}\x03\x02\x02\x02\u{13f}\x2f\x03\x02\ + \x02\x02\u{140}\u{149}\x07\x26\x02\x02\u{141}\u{146}\x05\x32\x1a\x02\u{142}\ + \u{143}\x07\x16\x02\x02\u{143}\u{145}\x05\x32\x1a\x02\u{144}\u{142}\x03\ + \x02\x02\x02\u{145}\u{148}\x03\x02\x02\x02\u{146}\u{144}\x03\x02\x02\x02\ + \u{146}\u{147}\x03\x02\x02\x02\u{147}\u{14a}\x03\x02\x02\x02\u{148}\u{146}\ + \x03\x02\x02\x02\u{149}\u{141}\x03\x02\x02\x02\u{149}\u{14a}\x03\x02\x02\ + \x02\u{14a}\u{14b}\x03\x02\x02\x02\u{14b}\u{14c}\x07\x28\x02\x02\u{14c}\ + \x31\x03\x02\x02\x02\u{14d}\u{14e}\x05\x3a\x1e\x02\u{14e}\u{14f}\x07\x17\ + \x02\x02\u{14f}\u{151}\x03\x02\x02\x02\u{150}\u{14d}\x03\x02\x02\x02\u{150}\ + \u{151}\x03\x02\x02\x02\u{151}\u{152}\x03\x02\x02\x02\u{152}\u{153}\x05\ + \x34\x1b\x02\u{153}\x33\x03\x02\x02\x02\u{154}\u{157}\x07\x0d\x02\x02\u{155}\ + \u{157}\x05\x0c\x07\x02\u{156}\u{154}\x03\x02\x02\x02\u{156}\u{155}\x03\ + \x02\x02\x02\u{157}\x35\x03\x02\x02\x02\u{158}\u{15a}\x09\x02\x02\x02\u{159}\ + \u{158}\x03\x02\x02\x02\u{159}\u{15a}\x03\x02\x02\x02\u{15a}\u{15b}\x03\ + \x02\x02\x02\u{15b}\u{15c}\x09\x03\x02\x02\u{15c}\x37\x03\x02\x02\x02\u{15d}\ + \u{15e}\x07\x32\x02\x02\u{15e}\u{160}\x07\x15\x02\x02\u{15f}\u{15d}\x03\ + \x02\x02\x02\u{160}\u{163}\x03\x02\x02\x02\u{161}\u{15f}\x03\x02\x02\x02\ + \u{161}\u{162}\x03\x02\x02\x02\u{162}\u{164}\x03\x02\x02\x02\u{163}\u{161}\ + \x03\x02\x02\x02\u{164}\u{165}\x07\x32\x02\x02\u{165}\x39\x03\x02\x02\x02\ + \u{166}\u{169}\x07\x31\x02\x02\u{167}\u{169}\x07\x32\x02\x02\u{168}\u{166}\ + \x03\x02\x02\x02\u{168}\u{167}\x03\x02\x02\x02\u{169}\x3b\x03\x02\x02\x02\ + \x2a\x3f\x45\x4c\x54\x5a\x61\x6b\x73\x7b\x7e\u{8b}\u{96}\u{9e}\u{a9}\u{b4}\ + \u{b9}\u{c1}\u{c8}\u{d0}\u{d5}\u{dd}\u{e2}\u{107}\u{10f}\u{118}\u{11b}\u{120}\ + \u{123}\u{126}\u{12b}\u{12f}\u{135}\u{13e}\u{146}\u{149}\u{150}\u{156}\u{159}\ + \u{161}\u{168}"; diff --git a/rs/src/parse/types.rs b/rs/src/parse/types.rs index e55458b0..e75c89ab 100644 --- a/rs/src/parse/types.rs +++ b/rs/src/parse/types.rs @@ -7,7 +7,6 @@ use std::sync::Arc; use crate::input::proto::substrait; use crate::output::comment; use crate::output::diagnostic; -use crate::output::extension; use crate::output::type_system::data; use crate::output::type_system::data::class::ParameterInfo; use crate::output::type_system::meta; @@ -918,8 +917,7 @@ fn describe_type(y: &mut context::Context, data_type: &data::Type) { let variation = if let data::Variation::UserDefined(u) = data_type.variation() { let mut variation = format!("This is the {u} variation of this type"); if let Some(tv) = &u.definition { - if tv.function_behavior == extension::simple::type_variation::FunctionBehavior::Inherits - { + if tv.compatible { variation += ", which behaves the same as the base type w.r.t. overload resolution."; } else {