{ "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json", "name": "lscript", "word": "identifier", "rules": { "source_file": { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "module_item" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "module_item" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, "module_item": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "use_declaration" }, { "type": "SYMBOL", "name": "pub_declaration" }, { "type": "SYMBOL", "name": "expression" } ] }, "use_declaration": { "type": "SEQ", "members": [ { "type": "STRING", "value": "use" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "module_path" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "as" }, { "type": "FIELD", "name": "alias", "content": { "type": "SYMBOL", "name": "identifier" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "module_path" }, { "type": "STRING", "value": "." }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "import_member" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "import_member" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] } ] } ] }, "import_member": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "as" }, { "type": "FIELD", "name": "alias", "content": { "type": "SYMBOL", "name": "identifier" } } ] }, { "type": "BLANK" } ] } ] }, "module_path": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "." }, { "type": "STRING", "value": ".." } ] }, { "type": "SYMBOL", "name": "type_name" } ] } ] }, "pub_declaration": { "type": "SEQ", "members": [ { "type": "STRING", "value": "pub" }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "identifier" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "declaration" }, { "type": "SYMBOL", "name": "value_expression" } ] }, "value_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "function_literal" }, { "type": "SYMBOL", "name": "return_expression" }, { "type": "SYMBOL", "name": "break_expression" }, { "type": "SYMBOL", "name": "continue_expression" }, { "type": "SYMBOL", "name": "pipeline_expression" }, { "type": "SYMBOL", "name": "_ordinary_expression" } ] }, "declaration": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": "::" }, { "type": "FIELD", "name": "value", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_definition" }, { "type": "PREC", "value": 1, "content": { "type": "SYMBOL", "name": "value_expression" } } ] } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": ":=" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "value_expression" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type_expression" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "value_expression" } } ] }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "=" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "value_expression" } } ] }, { "type": "BLANK" } ] } ] } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "tuple_pattern" }, { "type": "SYMBOL", "name": "product_pattern" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "::" }, { "type": "STRING", "value": ":=" } ] }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "value_expression" } } ] } ] }, "type_definition": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "distinct" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "type_expression" } ] }, "type_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "function_type" }, { "type": "SYMBOL", "name": "_result_type" } ] }, "function_type": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "input", "content": { "type": "SYMBOL", "name": "_result_type" } }, { "type": "FIELD", "name": "effect", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "->" }, { "type": "STRING", "value": "=>" } ] } }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "type_expression" } } ] } }, "_result_type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "result_type" }, { "type": "SYMBOL", "name": "optional_type" }, { "type": "SYMBOL", "name": "_container_type" } ] }, "result_type": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "_container_type" } }, { "type": "STRING", "value": "!" }, { "type": "FIELD", "name": "error", "content": { "type": "SYMBOL", "name": "_container_type" } } ] }, "optional_type": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "_container_type" } }, { "type": "REPEAT1", "content": { "type": "STRING", "value": "?" } } ] }, "_container_type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "array_type" }, { "type": "SYMBOL", "name": "map_type" }, { "type": "SYMBOL", "name": "_primary_type" } ] }, "array_type": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "STRING", "value": "]" }, { "type": "FIELD", "name": "element", "content": { "type": "SYMBOL", "name": "_container_type" } } ] } }, "map_type": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "key", "content": { "type": "SYMBOL", "name": "type_expression" } }, { "type": "STRING", "value": "]" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "_container_type" } } ] } }, "_primary_type": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "primitive_type" }, { "type": "SYMBOL", "name": "type_name" }, { "type": "SYMBOL", "name": "unit_type" }, { "type": "SYMBOL", "name": "tuple_type" }, { "type": "SYMBOL", "name": "product_type" }, { "type": "SYMBOL", "name": "sum_type" }, { "type": "SYMBOL", "name": "bits_type" }, { "type": "SYMBOL", "name": "type_application" }, { "type": "SYMBOL", "name": "grouped_type" } ] }, "grouped_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "type_expression" } }, { "type": "STRING", "value": "}" } ] }, "unit_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "STRING", "value": ")" } ] }, "tuple_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "SYMBOL", "name": "type_expression" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "type_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "type_expression" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "STRING", "value": ")" } ] }, "type_application": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "constructor", "content": { "type": "SYMBOL", "name": "type_name" } }, { "type": "STRING", "value": "<" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "type_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "type_expression" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": ">" } ] }, "product_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "&" }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "product_field" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "product_field" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "product_field": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type_expression" } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": ":" }, { "type": "STRING", "value": "=" } ] }, { "type": "CHOICE", "members": [ { "type": "FIELD", "name": "default", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "BLANK" } ] } ] }, "sum_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "integer_type" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "sum_variant" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "sum_variant" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "sum_variant": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "name", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "CHOICE", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "payload", "content": { "type": "SYMBOL", "name": "type_expression" } } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "::" }, { "type": "FIELD", "name": "discriminant", "content": { "type": "SYMBOL", "name": "signed_integer_literal" } } ] } ] }, { "type": "BLANK" } ] } ] }, "bits_type": { "type": "SEQ", "members": [ { "type": "STRING", "value": "bits" }, { "type": "STRING", "value": "|" }, { "type": "SYMBOL", "name": "unsigned_integer_type" }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "bits_member" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "bits_member" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "bits_member": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "::" }, { "type": "SYMBOL", "name": "integer_literal" } ] }, "primitive_type": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "f32" }, { "type": "STRING", "value": "f64" }, { "type": "STRING", "value": "bit" }, { "type": "STRING", "value": "chr" }, { "type": "STRING", "value": "str" }, { "type": "STRING", "value": "nvr" }, { "type": "STRING", "value": "i8" }, { "type": "STRING", "value": "i16" }, { "type": "STRING", "value": "i32" }, { "type": "STRING", "value": "i64" }, { "type": "STRING", "value": "u8" }, { "type": "STRING", "value": "u16" }, { "type": "STRING", "value": "u32" }, { "type": "STRING", "value": "u64" } ] }, "integer_type": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "i8" }, { "type": "STRING", "value": "i16" }, { "type": "STRING", "value": "i32" }, { "type": "STRING", "value": "i64" }, { "type": "STRING", "value": "u8" }, { "type": "STRING", "value": "u16" }, { "type": "STRING", "value": "u32" }, { "type": "STRING", "value": "u64" } ] }, "unsigned_integer_type": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "u8" }, { "type": "STRING", "value": "u16" }, { "type": "STRING", "value": "u32" }, { "type": "STRING", "value": "u64" } ] }, "function_literal": { "type": "CHOICE", "members": [ { "type": "PREC", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "@" }, { "type": "FIELD", "name": "parameter", "content": { "type": "SYMBOL", "name": "typed_parameter" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "effect", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "->" }, { "type": "STRING", "value": "=>" } ] } }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "type_expression" } } ] }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "block" } } ] } }, { "type": "PREC", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "@" }, { "type": "FIELD", "name": "parameter", "content": { "type": "SYMBOL", "name": "typed_tuple_pattern" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "effect", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "->" }, { "type": "STRING", "value": "=>" } ] } }, { "type": "FIELD", "name": "result", "content": { "type": "SYMBOL", "name": "type_expression" } } ] }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "block" } } ] } }, { "type": "PREC", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "@" }, { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "block" } } ] } } ] }, "typed_tuple_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "SYMBOL", "name": "typed_tuple_component" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "typed_tuple_component" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "typed_tuple_component" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": ")" } ] }, "typed_parameter": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "binding_pattern" } }, { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "_result_type" } } ] }, "typed_tuple_component": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "binding_pattern" } }, { "type": "STRING", "value": ":" }, { "type": "FIELD", "name": "type", "content": { "type": "SYMBOL", "name": "type_expression" } } ] }, "return_expression": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "return" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "BLANK" } ] } ] } }, "break_expression": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "break" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "label" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "BLANK" } ] } ] } }, "continue_expression": { "type": "SEQ", "members": [ { "type": "STRING", "value": "continue" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "label" }, { "type": "BLANK" } ] } ] }, "label": { "type": "SEQ", "members": [ { "type": "STRING", "value": "`" }, { "type": "SYMBOL", "name": "identifier" } ] }, "if_expression": { "type": "PREC_RIGHT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "if" }, { "type": "FIELD", "name": "condition", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "FIELD", "name": "consequence", "content": { "type": "SYMBOL", "name": "block" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "else" }, { "type": "FIELD", "name": "alternative", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "block" }, { "type": "SYMBOL", "name": "if_expression" } ] } } ] }, { "type": "BLANK" } ] } ] } }, "match_expression": { "type": "SEQ", "members": [ { "type": "STRING", "value": "match" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "match_arm" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "match_arm" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "match_arm": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "pattern" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "if" }, { "type": "FIELD", "name": "guard", "content": { "type": "SYMBOL", "name": "expression" } } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "=>" }, { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "expression" } } ] }, "loop_expression": { "type": "SEQ", "members": [ { "type": "STRING", "value": "loop" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "label" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "block" } ] }, "for_expression": { "type": "SEQ", "members": [ { "type": "STRING", "value": "for" }, { "type": "FIELD", "name": "pattern", "content": { "type": "SYMBOL", "name": "binding_pattern" } }, { "type": "STRING", "value": "in" }, { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "label" }, { "type": "BLANK" } ] }, { "type": "FIELD", "name": "body", "content": { "type": "SYMBOL", "name": "block" } } ] }, "block": { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "expression" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "pattern": { "type": "PREC_LEFT", "value": 0, "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "pattern_atom" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "or" }, { "type": "SYMBOL", "name": "pattern_atom" } ] } } ] } }, "binding_pattern": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "_" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "unit_pattern" }, { "type": "SYMBOL", "name": "tuple_pattern" }, { "type": "SYMBOL", "name": "product_pattern" } ] }, "pattern_atom": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "_" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "signed_numeric_literal" }, { "type": "SYMBOL", "name": "string_literal" }, { "type": "SYMBOL", "name": "character_literal" }, { "type": "SYMBOL", "name": "boolean_literal" }, { "type": "SYMBOL", "name": "nil_literal" }, { "type": "SYMBOL", "name": "sum_pattern" }, { "type": "SYMBOL", "name": "bits_pattern" }, { "type": "SYMBOL", "name": "unit_pattern" }, { "type": "SYMBOL", "name": "tuple_pattern" }, { "type": "SYMBOL", "name": "product_pattern" }, { "type": "SYMBOL", "name": "array_pattern" } ] }, "unit_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "STRING", "value": ")" } ] }, "tuple_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "SYMBOL", "name": "pattern" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "pattern" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "pattern" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "STRING", "value": ")" } ] }, "product_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "product_pattern_field" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "product_pattern_field" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "product_pattern_field": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "as" }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "BLANK" } ] } ] }, "sum_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "." }, { "type": "FIELD", "name": "variant", "content": { "type": "SYMBOL", "name": "identifier" } }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "pattern_atom" }, { "type": "BLANK" } ] } ] }, "bits_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "." }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "identifier" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "array_pattern": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "array_pattern_entry" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "array_pattern_entry" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "]" } ] }, "array_pattern_entry": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "pattern" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "..." }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "STRING", "value": "_" } ] } ] } ] }, "pipeline_expression": { "type": "PREC_DYNAMIC", "value": 1, "content": { "type": "PREC_LEFT", "value": 0, "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "FIELD", "name": "input", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_prefix_expression" }, { "type": "SYMBOL", "name": "function_literal" } ] } }, { "type": "SYMBOL", "name": "inline_pipeline_stage" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "pipeline_stage" } } ] }, { "type": "SEQ", "members": [ { "type": "FIELD", "name": "input", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_non_assignment_expression" }, { "type": "SYMBOL", "name": "function_literal" } ] } }, { "type": "SYMBOL", "name": "continuation_pipeline_stage" }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "pipeline_stage" } } ] } ] } } }, "pipeline_stage": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "inline_pipeline_stage" }, { "type": "SYMBOL", "name": "continuation_pipeline_stage" } ] }, "inline_pipeline_stage": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "direct_pipeline_stage" }, { "type": "SYMBOL", "name": "aggregate_pipeline_stage" } ] }, "continuation_pipeline_stage": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_direct_pipeline_continuation" }, { "type": "FIELD", "name": "callable", "content": { "type": "SYMBOL", "name": "pipeline_callable" } }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "?" }, { "type": "STRING", "value": "!" } ] } } ] }, { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_aggregate_pipeline_continuation" }, { "type": "FIELD", "name": "callable", "content": { "type": "SYMBOL", "name": "aggregate_pipeline_callable" } }, { "type": "FIELD", "name": "arguments", "content": { "type": "SYMBOL", "name": "aggregate_tail" } }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "?" }, { "type": "STRING", "value": "!" } ] } } ] } ] }, "direct_pipeline_stage": { "type": "SEQ", "members": [ { "type": "STRING", "value": "->" }, { "type": "FIELD", "name": "callable", "content": { "type": "SYMBOL", "name": "pipeline_callable" } }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "?" }, { "type": "STRING", "value": "!" } ] } } ] }, "aggregate_pipeline_stage": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|>" }, { "type": "FIELD", "name": "callable", "content": { "type": "SYMBOL", "name": "aggregate_pipeline_callable" } }, { "type": "FIELD", "name": "arguments", "content": { "type": "SYMBOL", "name": "aggregate_tail" } }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "?" }, { "type": "STRING", "value": "!" } ] } } ] }, "aggregate_tail": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "SYMBOL", "name": "expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "expression" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "STRING", "value": ")" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "array_tail_entry" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "array_tail_entry" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "]" } ] } ] }, "array_tail_entry": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "..." }, { "type": "SYMBOL", "name": "expression" } ] } ] }, "pipeline_callable": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "primary_expression" }, { "type": "REPEAT", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "." }, { "type": "SYMBOL", "name": "identifier" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "SYMBOL", "name": "expression" }, { "type": "STRING", "value": "]" } ] } ] } } ] }, "aggregate_pipeline_callable": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "primary_expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "." }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, "_ordinary_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "assignment_expression" }, { "type": "SYMBOL", "name": "_non_assignment_expression" } ] }, "_non_assignment_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "range_expression" }, { "type": "SYMBOL", "name": "_binary_expression" } ] }, "_binary_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "binary_expression" }, { "type": "SYMBOL", "name": "_prefix_expression" } ] }, "_prefix_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "unary_expression" }, { "type": "SYMBOL", "name": "postfix_expression" }, { "type": "SYMBOL", "name": "primary_expression" } ] }, "assignment_expression": { "type": "PREC_RIGHT", "value": 1, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_non_assignment_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "=" }, { "type": "STRING", "value": "+=" }, { "type": "STRING", "value": "-=" }, { "type": "STRING", "value": "*=" }, { "type": "STRING", "value": "/=" }, { "type": "STRING", "value": "%=" }, { "type": "STRING", "value": "&=" }, { "type": "STRING", "value": "^=" }, { "type": "STRING", "value": "|=" } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "function_literal" }, { "type": "SYMBOL", "name": "return_expression" }, { "type": "SYMBOL", "name": "break_expression" }, { "type": "SYMBOL", "name": "pipeline_expression" }, { "type": "SYMBOL", "name": "_non_assignment_expression" } ] } } ] } }, "range_expression": { "type": "PREC_LEFT", "value": 2, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "..<" }, { "type": "STRING", "value": "..=" } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, "binary_expression": { "type": "CHOICE", "members": [ { "type": "PREC_LEFT", "value": 3, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "or" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "_or_continuation" } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 4, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "and" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "_and_continuation" } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 6, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "<" }, { "type": "STRING", "value": "<=" }, { "type": "STRING", "value": ">" }, { "type": "STRING", "value": ">=" }, { "type": "STRING", "value": "==" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "SYMBOL", "name": "_comparison_continuation" } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 7, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 8, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "^" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "STRING", "value": "^" } ] } } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 9, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "&" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 10, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "+" }, { "type": "STRING", "value": "-" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "STRING", "value": "+" } ] } } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } }, { "type": "PREC_LEFT", "value": 11, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "left", "content": { "type": "SYMBOL", "name": "_binary_expression" } }, { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "*" }, { "type": "STRING", "value": "/" }, { "type": "STRING", "value": "%" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newline" }, { "type": "BLANK" } ] } ] }, { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "*" }, { "type": "STRING", "value": "/" }, { "type": "STRING", "value": "%" } ] } ] } } ] } }, { "type": "FIELD", "name": "right", "content": { "type": "SYMBOL", "name": "_binary_expression" } } ] } } ] }, "unary_expression": { "type": "PREC_RIGHT", "value": 12, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "not" }, { "type": "STRING", "value": "!" }, { "type": "STRING", "value": "-" }, { "type": "STRING", "value": "~" } ] } }, { "type": "FIELD", "name": "operand", "content": { "type": "SYMBOL", "name": "_prefix_expression" } } ] } }, "postfix_expression": { "type": "PREC_LEFT", "value": 13, "content": { "type": "SEQ", "members": [ { "type": "FIELD", "name": "value", "content": { "type": "SYMBOL", "name": "primary_expression" } }, { "type": "REPEAT1", "content": { "type": "FIELD", "name": "operator", "content": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "." }, { "type": "FIELD", "name": "member", "content": { "type": "SYMBOL", "name": "identifier" } } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "FIELD", "name": "index", "content": { "type": "SYMBOL", "name": "expression" } }, { "type": "STRING", "value": "]" } ] }, { "type": "STRING", "value": "?" }, { "type": "STRING", "value": "!" } ] } } } ] } }, "primary_expression": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "literal" }, { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "block" }, { "type": "SYMBOL", "name": "if_expression" }, { "type": "SYMBOL", "name": "match_expression" }, { "type": "SYMBOL", "name": "loop_expression" }, { "type": "SYMBOL", "name": "for_expression" }, { "type": "SYMBOL", "name": "tuple_value" }, { "type": "SYMBOL", "name": "collection_literal" }, { "type": "SYMBOL", "name": "product_constructor" }, { "type": "SYMBOL", "name": "sum_constructor" }, { "type": "SYMBOL", "name": "bits_constructor" }, { "type": "SYMBOL", "name": "default_expression" } ] }, "tuple_value": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "SYMBOL", "name": "expression" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "expression" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "expression" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "STRING", "value": ")" } ] }, "collection_literal": { "type": "SEQ", "members": [ { "type": "STRING", "value": "[" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "collection_entry" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "collection_entry" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "]" } ] }, "collection_entry": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "expression" }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "=>" }, { "type": "SYMBOL", "name": "expression" } ] }, { "type": "BLANK" } ] } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "..." }, { "type": "SYMBOL", "name": "expression" } ] } ] }, "product_constructor": { "type": "SEQ", "members": [ { "type": "STRING", "value": "&" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "." }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "product_entry" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "_scope_separator" }, { "type": "SYMBOL", "name": "product_entry" } ] } }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "product_entry": { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": ":" }, { "type": "STRING", "value": "=" } ] }, { "type": "SYMBOL", "name": "expression" } ] }, { "type": "SEQ", "members": [ { "type": "STRING", "value": "..." }, { "type": "SYMBOL", "name": "expression" } ] } ] }, "sum_constructor": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "." }, { "type": "SYMBOL", "name": "identifier" } ] }, "bits_constructor": { "type": "SEQ", "members": [ { "type": "STRING", "value": "|" }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "type_name" }, { "type": "BLANK" } ] }, { "type": "STRING", "value": "." }, { "type": "STRING", "value": "{" }, { "type": "SEQ", "members": [ { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } }, { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT", "content": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "SEQ", "members": [ { "type": "STRING", "value": "," }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "SYMBOL", "name": "_newlines" } ] }, { "type": "SYMBOL", "name": "identifier" } ] } }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "," }, { "type": "BLANK" } ] }, { "type": "REPEAT", "content": { "type": "SYMBOL", "name": "_newline" } } ] }, { "type": "BLANK" } ] } ] }, { "type": "STRING", "value": "}" } ] }, "literal": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "signed_numeric_literal" }, { "type": "SYMBOL", "name": "string_literal" }, { "type": "SYMBOL", "name": "character_literal" }, { "type": "SYMBOL", "name": "boolean_literal" }, { "type": "SYMBOL", "name": "nil_literal" }, { "type": "SYMBOL", "name": "unit_literal" } ] }, "boolean_literal": { "type": "CHOICE", "members": [ { "type": "STRING", "value": "true" }, { "type": "STRING", "value": "false" } ] }, "nil_literal": { "type": "STRING", "value": "nil" }, "default_expression": { "type": "STRING", "value": "default" }, "unit_literal": { "type": "SEQ", "members": [ { "type": "STRING", "value": "(" }, { "type": "STRING", "value": ")" } ] }, "signed_numeric_literal": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "-" }, { "type": "BLANK" } ] }, { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "integer_literal" }, { "type": "SYMBOL", "name": "float_literal" }, { "type": "ALIAS", "content": { "type": "SYMBOL", "name": "_trailing_dot_float" }, "named": true, "value": "float_literal" } ] } ] }, "signed_integer_literal": { "type": "SEQ", "members": [ { "type": "CHOICE", "members": [ { "type": "STRING", "value": "-" }, { "type": "BLANK" } ] }, { "type": "SYMBOL", "name": "integer_literal" } ] }, "integer_literal": { "type": "TOKEN", "content": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "0[bB][01](?:_?[01])*" }, { "type": "PATTERN", "value": "0[oO][0-7](?:_?[0-7])*" }, { "type": "PATTERN", "value": "0[xX][0-9a-fA-F](?:_?[0-9a-fA-F])*" }, { "type": "PATTERN", "value": "[0-9](?:_?[0-9])*" } ] } }, "float_literal": { "type": "TOKEN", "content": { "type": "CHOICE", "members": [ { "type": "PATTERN", "value": "[0-9](?:_?[0-9])*\\.[0-9](?:_?[0-9])*(?:[eE][+-]?[0-9](?:_?[0-9])*)?" }, { "type": "PATTERN", "value": "\\.[0-9](?:_?[0-9])*(?:[eE][+-]?[0-9](?:_?[0-9])*)?" }, { "type": "PATTERN", "value": "[0-9](?:_?[0-9])*[eE][+-]?[0-9](?:_?[0-9])*" } ] } }, "string_literal": { "type": "TOKEN", "content": { "type": "PATTERN", "value": "'(?:[^'\\\\\\r\\n]|\\\\(?:[\\\\'nrt0]|u\\{[0-9a-fA-F]{1,6}\\}))*'" } }, "character_literal": { "type": "TOKEN", "content": { "type": "PATTERN", "value": "c'(?:[^'\\\\\\r\\n]|\\\\(?:[\\\\'nrt0]|u\\{[0-9a-fA-F]{1,6}\\}))'" } }, "type_name": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "SYMBOL", "name": "qualified_name" } ] }, "qualified_name": { "type": "SEQ", "members": [ { "type": "SYMBOL", "name": "identifier" }, { "type": "REPEAT1", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "." }, { "type": "SYMBOL", "name": "identifier" } ] } } ] }, "identifier": { "type": "PATTERN", "value": "[A-Za-z_][A-Za-z0-9_]*" }, "comment": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "STRING", "value": "#" }, { "type": "PATTERN", "value": "[^\\r\\n]*" } ] } }, "_direct_pipeline_continuation": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "STRING", "value": "->" } ] } }, "_aggregate_pipeline_continuation": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "STRING", "value": "|>" } ] } }, "_comparison_continuation": { "type": "TOKEN", "content": { "type": "SEQ", "members": [ { "type": "PATTERN", "value": "\\r?\\n[ \\t]*" }, { "type": "CHOICE", "members": [ { "type": "STRING", "value": "<=" }, { "type": "STRING", "value": ">=" }, { "type": "STRING", "value": "==" }, { "type": "STRING", "value": "<" }, { "type": "STRING", "value": ">" } ] } ] } }, "_newline": { "type": "PATTERN", "value": "\\r?\\n" }, "_newlines": { "type": "REPEAT1", "content": { "type": "SYMBOL", "name": "_newline" } }, "_scope_separator": { "type": "CHOICE", "members": [ { "type": "SYMBOL", "name": "_newlines" }, { "type": "STRING", "value": ";" } ] } }, "extras": [ { "type": "PATTERN", "value": "[ \\t]" }, { "type": "SYMBOL", "name": "comment" } ], "conflicts": [ [ "product_pattern_field", "primary_expression" ], [ "pattern_atom", "literal" ], [ "pattern_atom", "primary_expression" ], [ "signed_numeric_literal" ], [ "source_file", "_scope_separator" ], [ "qualified_name" ], [ "block", "_scope_separator" ], [ "match_expression", "_scope_separator" ], [ "product_constructor", "_scope_separator" ], [ "tuple_type" ], [ "type_application" ], [ "tuple_pattern" ], [ "product_pattern" ], [ "array_pattern" ], [ "tuple_value" ], [ "collection_literal" ], [ "block", "product_pattern" ], [ "array_pattern", "collection_literal" ], [ "typed_tuple_pattern" ], [ "unit_pattern", "unit_literal" ], [ "sum_pattern", "sum_constructor" ], [ "bits_pattern", "bits_constructor" ], [ "primary_expression", "qualified_name" ], [ "array_pattern_entry", "primary_expression" ], [ "continue_expression" ], [ "unit_type", "unit_literal" ], [ "unit_type", "unit_pattern", "unit_literal" ], [ "product_pattern_field", "primary_expression", "type_name" ], [ "pattern_atom", "primary_expression", "type_name" ], [ "type_name", "qualified_name" ], [ "primary_expression", "type_name" ], [ "type_expression", "function_type" ], [ "array_type", "collection_literal" ] ], "precedences": [], "externals": [ { "type": "SYMBOL", "name": "_and_continuation" }, { "type": "SYMBOL", "name": "_or_continuation" }, { "type": "SYMBOL", "name": "_trailing_dot_float" } ], "inline": [], "supertypes": [ "module_item", "expression", "value_expression", "type_expression", "primary_expression", "literal", "type_name", "binding_pattern", "pattern_atom", "pipeline_stage", "inline_pipeline_stage" ], "reserved": { "global": [ { "type": "STRING", "value": "and" }, { "type": "STRING", "value": "as" }, { "type": "STRING", "value": "bits" }, { "type": "STRING", "value": "break" }, { "type": "STRING", "value": "continue" }, { "type": "STRING", "value": "default" }, { "type": "STRING", "value": "distinct" }, { "type": "STRING", "value": "else" }, { "type": "STRING", "value": "false" }, { "type": "STRING", "value": "for" }, { "type": "STRING", "value": "if" }, { "type": "STRING", "value": "in" }, { "type": "STRING", "value": "loop" }, { "type": "STRING", "value": "match" }, { "type": "STRING", "value": "nil" }, { "type": "STRING", "value": "not" }, { "type": "STRING", "value": "or" }, { "type": "STRING", "value": "pub" }, { "type": "STRING", "value": "return" }, { "type": "STRING", "value": "true" }, { "type": "STRING", "value": "use" }, { "type": "STRING", "value": "bit" }, { "type": "STRING", "value": "chr" }, { "type": "STRING", "value": "f32" }, { "type": "STRING", "value": "f64" }, { "type": "STRING", "value": "i8" }, { "type": "STRING", "value": "i16" }, { "type": "STRING", "value": "i32" }, { "type": "STRING", "value": "i64" }, { "type": "STRING", "value": "nvr" }, { "type": "STRING", "value": "str" }, { "type": "STRING", "value": "u8" }, { "type": "STRING", "value": "u16" }, { "type": "STRING", "value": "u32" }, { "type": "STRING", "value": "u64" } ] } }