A great big update

Highlights:
- Give "_upname" the visible name "type_identifier". Name stolen
shamelessly from tree-sitter-rust.
- Remove "record_name" in favor of "type_identifier".
- Remote "function_name" in favor of "identifier".
- Surface names for several nodes, mostly using "type_identifier".
- Remove "remote_" variants of several nodes. Essentially we needed to
give these nodes "names" anyhow, and having the name encapsulate the
local vs remote information proved wildly efficient.
pull/204/head
Jonathan Arnett 2022-01-02 03:27:22 +07:00
parent e5b283e41a
commit 35cd8b2dfd
11 changed files with 16438 additions and 16460 deletions

@ -29,17 +29,21 @@ const a: option.Option(String) = option.Some("Hello, World!")
value: (string))
(constant
name: (identifier)
type: (type)
type: (type
name: (type_identifier))
value: (integer))
(constant
name: (identifier)
type: (type)
type: (type
name: (type_identifier))
value: (float))
(constant
name: (identifier)
type: (tuple_type
(type)
(type))
(type
name: (type_identifier))
(type
name: (type_identifier)))
value: (tuple
(integer)
(string)))
@ -50,16 +54,19 @@ const a: option.Option(String) = option.Some("Hello, World!")
(constant
name: (identifier)
type: (type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))))
(type
name: (type_identifier)))))
value: (list
(integer)
(integer)))
(constant
name: (identifier)
type: (type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type_hole))))
value: (list))
@ -108,17 +115,17 @@ const a: option.Option(String) = option.Some("Hello, World!")
(constant
name: (identifier)
value: (record
(record_name)))
name: (type_identifier)))
(constant
name: (identifier)
value: (record
(record_name)
(arguments)))
name: (type_identifier)
arguments: (arguments)))
(constant
name: (identifier)
value: (record
(record_name)
(arguments
name: (type_identifier)
arguments: (arguments
(argument
value: (string))
(argument
@ -126,8 +133,8 @@ const a: option.Option(String) = option.Some("Hello, World!")
(constant
name: (identifier)
value: (record
(record_name)
(arguments
name: (type_identifier)
arguments: (arguments
(argument
label: (identifier)
value: (string))
@ -136,25 +143,29 @@ const a: option.Option(String) = option.Some("Hello, World!")
value: (integer)))))
(constant
name: (identifier)
value: (remote_record
value: (record
name: (remote_type_identifier
module: (identifier)
(record_name)
(arguments
name: (type_identifier))
arguments: (arguments
(argument
label: (identifier)
value: (string)))))
(constant
name: (identifier)
type: (remote_type
type: (type
name: (remote_type_identifier
module: (identifier)
(type
(type_arguments
name: (type_identifier))
arguments: (type_arguments
(type_argument
(type)))))
value: (remote_record
(type
name: (type_identifier)))))
value: (record
name: (remote_type_identifier
module: (identifier)
(record_name)
(arguments
name: (type_identifier))
arguments: (arguments
(argument
value: (string))))))
@ -188,17 +199,21 @@ pub const a = uri.Uri(host: "github.com")
value: (string))
(public_constant
name: (identifier)
type: (type)
type: (type
name: (type_identifier))
value: (integer))
(public_constant
name: (identifier)
type: (type)
type: (type
name: (type_identifier))
value: (float))
(public_constant
name: (identifier)
type: (tuple_type
(type)
(type))
(type
name: (type_identifier))
(type
name: (type_identifier)))
value: (tuple
(integer)
(string)))
@ -209,16 +224,19 @@ pub const a = uri.Uri(host: "github.com")
(public_constant
name: (identifier)
type: (type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))))
(type
name: (type_identifier)))))
value: (list
(integer)
(integer)))
(public_constant
name: (identifier)
type: (type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type_hole))))
value: (list))
@ -267,17 +285,17 @@ pub const a = uri.Uri(host: "github.com")
(public_constant
name: (identifier)
value: (record
(record_name)))
name: (type_identifier)))
(public_constant
name: (identifier)
value: (record
(record_name)
(arguments)))
name: (type_identifier)
arguments: (arguments)))
(public_constant
name: (identifier)
value: (record
(record_name)
(arguments
name: (type_identifier)
arguments: (arguments
(argument
value: (string))
(argument
@ -285,8 +303,8 @@ pub const a = uri.Uri(host: "github.com")
(public_constant
name: (identifier)
value: (record
(record_name)
(arguments
name: (type_identifier)
arguments: (arguments
(argument
label: (identifier)
value: (string))
@ -295,10 +313,11 @@ pub const a = uri.Uri(host: "github.com")
value: (integer)))))
(public_constant
name: (identifier)
value: (remote_record
value: (record
name: (remote_type_identifier
module: (identifier)
(record_name)
(arguments
name: (type_identifier))
arguments: (arguments
(argument
label: (identifier)
value: (string))))))

@ -11,35 +11,45 @@ type NamedBox(inner_type) { Box(String, inner: inner_type) }
(source_file
(type_definition
(type_name)
(type_name
name: (type_identifier))
(type_constructors
(type_constructor)))
(type_constructor
name: (type_identifier))))
(type_definition
(type_name)
(type_name
name: (type_identifier))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
value: (type))))))
value: (type
name: (type_identifier)))))))
(type_definition
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type_var))))))
(type_definition
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type_var)))))))
@ -71,48 +81,65 @@ type Boring {
(source_file
(type_definition
(type_name)
(type_name
name: (type_identifier))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type))))))
value: (type
name: (type_identifier)))))))
(type_definition
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)
(type_parameter)))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type))))
value: (type
name: (type_identifier)))))
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type))))))
value: (type
name: (type_identifier)))))))
(type_definition
(type_name)
(type_name
name: (type_identifier))
(type_constructors
(type_constructor)
(type_constructor)
(type_constructor)))
(type_constructor
name: (type_identifier))
(type_constructor
name: (type_identifier))
(type_constructor
name: (type_identifier))))
(type_definition
(type_name)
(type_name
name: (type_identifier))
(type_constructors
(type_constructor))))
(type_constructor
name: (type_identifier)))))
==============================
Public custom type definitions
@ -128,26 +155,33 @@ pub type Animal(name, cuteness) {
(source_file
(public_type_definition
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)
(type_parameter)))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type))))
value: (type
name: (type_identifier)))))
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type)))))))
value: (type
name: (type_identifier))))))))
=====================================
Public opaque custom type definitions
@ -163,23 +197,30 @@ pub opaque type Animal(name, cuteness) {
(source_file
(public_opaque_type_definition
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)
(type_parameter)))
(type_constructors
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type))))
value: (type
name: (type_identifier)))))
(type_constructor
(type_constructor_arguments
name: (type_identifier)
arguments: (type_constructor_arguments
(type_constructor_argument
label: (identifier)
value: (type))
value: (type
name: (type_identifier)))
(type_constructor_argument
label: (identifier)
value: (type)))))))
value: (type
name: (type_identifier))))))))

@ -11,40 +11,50 @@ external fn a() -> #(List(Int), fn(Int) -> String) = "x" "y"
(source_file
(external_function
name: (function_name)
name: (identifier)
parameters: (function_parameters
(function_parameter
type: (type)))
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))
(type
name: (type_identifier)))
(type_argument
(type))))
(type
name: (type_identifier)))))
body: (external_function_body
(string)
(string)))
(external_function
name: (function_name)
name: (identifier)
parameters: (function_parameters
(function_parameter
name: (identifier)
type: (type)))
return_type: (type)
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier))
body: (external_function_body
(string)
(string)))
(external_function
name: (function_name)
name: (identifier)
return_type: (tuple_type
(type
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))))
(type
name: (type_identifier)))))
(function_type
parameter_types: (function_parameter_types
(type))
return_type: (type)))
(type
name: (type_identifier)))
return_type: (type
name: (type_identifier))))
body: (external_function_body
(string)
(string))))
@ -62,40 +72,50 @@ pub external fn a() -> #(List(Int), fn(Int) -> String) = "x" "y"
(source_file
(public_external_function
name: (function_name)
name: (identifier)
parameters: (function_parameters
(function_parameter
type: (type)))
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))
(type
name: (type_identifier)))
(type_argument
(type))))
(type
name: (type_identifier)))))
body: (external_function_body
(string)
(string)))
(public_external_function
name: (function_name)
name: (identifier)
parameters: (function_parameters
(function_parameter
name: (identifier)
type: (type)))
return_type: (type)
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier))
body: (external_function_body
(string)
(string)))
(public_external_function
name: (function_name)
name: (identifier)
return_type: (tuple_type
(type
name: (type_identifier)
arguments: (type_arguments
(type_argument
(type))))
(type
name: (type_identifier)))))
(function_type
parameter_types: (function_parameter_types
(type))
return_type: (type)))
(type
name: (type_identifier)))
return_type: (type
name: (type_identifier))))
body: (external_function_body
(string)
(string))))

@ -10,13 +10,16 @@ external type Map(key, value)
(source_file
(external_type
(type_name))
(type_name
name: (type_identifier)))
(external_type
(type_name
(type_parameters)))
name: (type_identifier)
parameters: (type_parameters)))
(external_type
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)
(type_parameter)))))
@ -32,12 +35,15 @@ pub external type Map(key, value)
(source_file
(public_external_type
(type_name))
(type_name
name: (type_identifier)))
(public_external_type
(type_name
(type_parameters)))
name: (type_identifier)
parameters: (type_parameters)))
(public_external_type
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)
(type_parameter)))))

@ -27,11 +27,14 @@ fn replace(
parameters: (function_parameters
(function_parameter
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
name: (identifier)
type: (type)))
return_type: (type)
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier))
(function_body
(binary_expression
(var)
@ -72,15 +75,18 @@ fn replace(
(function_parameter
label: (identifier)
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
label: (identifier)
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
label: (identifier)
name: (identifier)
type: (type)))
type: (type
name: (type_identifier))))
(function_body
(function_call
(field_access
@ -126,11 +132,14 @@ pub fn replace(
parameters: (function_parameters
(function_parameter
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
name: (identifier)
type: (type)))
return_type: (type)
type: (type
name: (type_identifier))))
return_type: (type
name: (type_identifier))
(function_body
(binary_expression
(var)
@ -171,15 +180,18 @@ pub fn replace(
(function_parameter
label: (identifier)
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
label: (identifier)
name: (identifier)
type: (type))
type: (type
name: (type_identifier)))
(function_parameter
label: (identifier)
name: (identifier)
type: (type)))
type: (type
name: (type_identifier))))
(function_body
(function_call
(field_access
@ -294,22 +306,22 @@ fn field_access(x) {
name: (identifier)
(function_body
(record
(record_name)
(arguments
name: (type_identifier)
arguments: (arguments
(argument
label: (identifier)
value: (string))))))
(function
name: (identifier)
(function_body
(remote_record
module: (identifier)
(record
(record_name)
(arguments
name: (remote_type_identifier
module: (identifier)
name: (type_identifier))
arguments: (arguments
(argument
label: (identifier)
value: (string)))))))
value: (string))))))
(function
name: (identifier)
parameters: (function_parameters
@ -374,7 +386,8 @@ fn field_access(x) {
(function_parameter
label: (identifier)
name: (identifier)
type: (type)))
type: (type
name: (type_identifier))))
(function_body
(binary_expression
(var)
@ -408,13 +421,13 @@ fn field_access(x) {
(integer)
(integer)))
(record
(record_name)))
name: (type_identifier)))
(case_clause
patterns: (case_clause_patterns
(case_clause_pattern
(discard_var)))
(record
(record_name))))))
name: (type_identifier))))))
(function
name: (identifier)
(function_body
@ -462,7 +475,7 @@ fn field_access(x) {
name: (identifier)))
(function_body
(record_update
constructor: (record_name)
constructor: (type_identifier)
spread: (var)
arguments: (record_update_arguments
(record_update_argument
@ -474,9 +487,9 @@ fn field_access(x) {
(integer)
(integer)))))
(record_update
constructor: (remote_record_name
constructor: (remote_type_identifier
module: (identifier)
(record_name))
name: (type_identifier))
spread: (function_call
(var)
(arguments))
@ -577,7 +590,7 @@ fn trial(x, y) {
index: (integer))
(integer)))
(record
(record_name)))
name: (type_identifier)))
(case_clause
patterns: (case_clause_patterns
(case_clause_pattern
@ -599,7 +612,7 @@ fn trial(x, y) {
index: (integer))
(integer))))
(record
(record_name))))
name: (type_identifier))))
(case
subjects: (case_subjects
(tuple
@ -649,7 +662,8 @@ fn try_try_again(x, y) -> Int {
name: (identifier))
(function_parameter
name: (identifier)))
return_type: (type)
return_type: (type
name: (type_identifier))
(function_body
(try
pattern: (var)
@ -658,11 +672,15 @@ fn try_try_again(x, y) -> Int {
pattern: (discard_var)
value: (todo))
(try
pattern: (remote_constructor_pattern
(pattern_constructor_args))
pattern: (constructor_pattern
name: (remote_type_identifier
module: (identifier)
name: (type_identifier))
arguments: (pattern_constructor_arguments))
value: (todo))
(try
pattern: (constructor_pattern)
pattern: (constructor_pattern
name: (type_identifier))
value: (todo))
(try
pattern: (string)

@ -53,8 +53,8 @@ import a/.{b, d}
(unqualified_import
name: (identifier))
(unqualified_import
name: (record_name)
alias: (record_name))))
name: (type_identifier)
alias: (type_identifier))))
(import
module: (module)
(ERROR)
@ -88,8 +88,8 @@ import animal.{Cat as kitty}
module: (module)
imports: (unqualified_imports
(unqualified_import
name: (record_name)
alias: (record_name)))
name: (type_identifier)
alias: (type_identifier)))
alias: (identifier))
(ERROR
(module))
@ -97,6 +97,6 @@ import animal.{Cat as kitty}
module: (module)
imports: (unqualified_imports
(unqualified_import
name: (record_name))
name: (type_identifier))
(ERROR
(UNEXPECTED 'k')))))

@ -11,25 +11,32 @@ type NamedBox(a) = #(String, a)
(source_file
(type_alias
(type_name)
(type_name
name: (type_identifier))
(type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(tuple_type
(type)
(type))))))
(type
name: (type_identifier))
(type
name: (type_identifier)))))))
(type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type_var)))
(type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type)
(type
name: (type_identifier))
(type_var))))
===================
@ -45,25 +52,32 @@ pub type NamedBox(a) = #(String, a)
(source_file
(public_type_alias
(type_name)
(type_name
name: (type_identifier))
(type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(tuple_type
(type)
(type))))))
(type
name: (type_identifier))
(type
name: (type_identifier)))))))
(public_type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type_var)))
(public_type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type)
(type
name: (type_identifier))
(type_var))))
==========================
@ -79,23 +93,30 @@ pub opaque type NamedBox(a) = #(String, a)
(source_file
(public_opaque_type_alias
(type_name)
(type_name
name: (type_identifier))
(type
(type_arguments
name: (type_identifier)
arguments: (type_arguments
(type_argument
(tuple_type
(type)
(type))))))
(type
name: (type_identifier))
(type
name: (type_identifier)))))))
(public_opaque_type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type_var)))
(public_opaque_type_alias
(type_name
(type_parameters
name: (type_identifier)
parameters: (type_parameters
(type_parameter)))
(tuple_type
(type)
(type
name: (type_identifier))
(type_var))))

@ -4,7 +4,6 @@ module.exports = grammar({
name: "gleam",
extras: ($) => [";", NEWLINE, /\s/],
conflicts: ($) => [
[$.record, $.record_name],
[$.var, $.identifier],
[$._maybe_record_expression, $._maybe_tuple_expression],
],
@ -65,8 +64,8 @@ module.exports = grammar({
optional(seq("as", field("alias", $.identifier)))
),
seq(
field("name", $.record_name),
optional(seq("as", field("alias", $.record_name)))
field("name", $.type_identifier),
optional(seq("as", field("alias", $.type_identifier)))
)
),
@ -86,41 +85,34 @@ module.exports = grammar({
$.string,
$.float,
$.integer,
alias($._constant_tuple, $.tuple),
alias($._constant_list, $.list),
alias($.constant_tuple, $.tuple),
alias($.constant_list, $.list),
alias($._constant_bit_string, $.bit_string),
alias($._constant_record, $.record),
alias($._constant_remote_record, $.remote_record)
alias($.constant_record, $.record)
),
_constant_tuple: ($) =>
constant_tuple: ($) =>
seq("#", "(", optional(series_of($._constant_value, ",")), ")"),
_constant_list: ($) =>
constant_list: ($) =>
seq("[", optional(series_of($._constant_value, ",")), "]"),
...bit_string_rules("constant", "_constant_value", "integer"),
_constant_record: ($) =>
constant_record: ($) =>
seq(
$.record_name,
optional(alias($._constant_record_arguments, $.arguments))
field("name", choice($.type_identifier, $.remote_type_identifier)),
optional(
field("arguments", alias($.constant_record_arguments, $.arguments))
)
),
_constant_record_arguments: ($) =>
constant_record_arguments: ($) =>
seq(
"(",
optional(
series_of(alias($._constant_record_argument, $.argument), ",")
),
optional(series_of(alias($.constant_record_argument, $.argument), ",")),
")"
),
_constant_record_argument: ($) =>
constant_record_argument: ($) =>
seq(
optional(seq(field("label", $.identifier), ":")),
field("value", $._constant_value)
),
_constant_remote_record: ($) =>
seq(
field("module", alias($._name, $.identifier)),
".",
$._constant_record
),
/* Special constant types */
// Versions of $._type, $._type_annotation, etc, that have constraints
@ -129,16 +121,17 @@ module.exports = grammar({
choice(
$.type_hole,
alias($.constant_tuple_type, $.tuple_type),
alias($.constant_type, $.type),
alias($.constant_remote_type, $.remote_type)
alias($.constant_type, $.type)
),
_constant_type_annotation: ($) => seq(":", field("type", $._constant_type)),
constant_tuple_type: ($) =>
seq("#", "(", optional(series_of($._constant_type, ",")), ")"),
constant_type: ($) =>
seq(
$._upname,
optional(alias($.constant_type_arguments, $.type_arguments))
field("name", choice($.type_identifier, $.remote_type_identifier)),
optional(
field("arguments", alias($.constant_type_arguments, $.type_arguments))
)
),
constant_type_arguments: ($) =>
seq(
@ -150,9 +143,6 @@ module.exports = grammar({
),
constant_type_argument: ($) => $._constant_type,
constant_remote_type: ($) =>
seq(field("module", $.identifier), ".", alias($.constant_type, $.type)),
/* External types */
public_external_type: ($) => seq("pub", $._external_type),
external_type: ($) => $._external_type,
@ -165,7 +155,7 @@ module.exports = grammar({
seq(
"external",
"fn",
field("name", alias($._name, $.function_name)),
field("name", $.identifier),
"(",
optional(
field(
@ -296,7 +286,6 @@ module.exports = grammar({
// If we decide that record constructors (value constructors) are
// actually functions, this will require a refactor.
$.record,
$.remote_record,
$.var,
$.todo,
$.tuple,
@ -312,8 +301,11 @@ module.exports = grammar({
$.field_access,
$.function_call
),
record: ($) => seq(alias($._upname, $.record_name), optional($.arguments)),
remote_record: ($) => seq(field("module", $.identifier), ".", $.record),
record: ($) =>
seq(
field("name", choice($.type_identifier, $.remote_type_identifier)),
field("arguments", optional($.arguments))
),
todo: ($) =>
seq("todo", optional(seq("(", field("message", $.string), ")"))),
tuple: ($) => seq("#", "(", optional(series_of($._expression, ",")), ")"),
@ -471,14 +463,8 @@ module.exports = grammar({
seq("{", $._case_clause_guard_expression, "}"),
$._constant_value
),
// Somehow writing alias($._name, $.var) vs just $.var solves a precedence
// issue with tree-sitter
_case_clause_tuple_access: ($) =>
seq(
field("tuple", alias($._name, $.var)),
".",
field("index", $.integer)
),
seq(field("tuple", $.var), ".", field("index", $.integer)),
let: ($) => seq("let", $._assignment),
assert: ($) => seq("assert", $._assignment),
_assignment: ($) =>
@ -490,7 +476,10 @@ module.exports = grammar({
),
record_update: ($) =>
seq(
field("constructor", choice($.record_name, $.remote_record_name)),
field(
"constructor",
choice($.type_identifier, $.remote_type_identifier)
),
"(",
"..",
field("spread", $._expression),
@ -530,7 +519,6 @@ module.exports = grammar({
_maybe_record_expression: ($) =>
choice(
$.record,
$.remote_record,
$.var,
$.function_call,
$.expression_group,
@ -577,7 +565,6 @@ module.exports = grammar({
choice(
$.var,
$.discard_var,
$.remote_constructor_pattern,
$.constructor_pattern,
$.string,
$.integer,
@ -586,28 +573,29 @@ module.exports = grammar({
alias($._pattern_bit_string, $.bit_string_pattern),
$.list_pattern
),
optional(field("assign", seq("as", alias($._name, $.pattern_assign))))
optional(field("assign", seq("as", $.pattern_assign)))
),
pattern_assign: ($) => $._name,
var: ($) => $._name,
discard_var: ($) => $._discard_name,
remote_constructor_pattern: ($) =>
seq($._name, ".", $._constructor_pattern),
constructor_pattern: ($) => $._constructor_pattern,
_constructor_pattern: ($) =>
seq($._upname, optional($.pattern_constructor_args)),
pattern_constructor_args: ($) =>
constructor_pattern: ($) =>
seq(
field("name", choice($.type_identifier, $.remote_type_identifier)),
optional(field("arguments", $.pattern_constructor_arguments))
),
pattern_constructor_arguments: ($) =>
seq(
"(",
optional(series_of($._pattern_constructor_arg, ",")),
optional(series_of($._pattern_constructor_argument, ",")),
optional($.pattern_spread),
")"
),
_pattern_constructor_arg: ($) =>
_pattern_constructor_argument: ($) =>
choice(
$.pattern_constructor_named_arg,
alias($.constructor_pattern, $.pattern_constructor_unnamed_arg)
$.pattern_constructor_named_argument,
alias($.constructor_pattern, $.pattern_constructor_unnamed_argument)
),
pattern_constructor_named_arg: ($) =>
pattern_constructor_named_argument: ($) =>
seq($._name, ":", $.constructor_pattern),
pattern_spread: ($) => seq("..", optional(",")),
tuple_pattern: ($) =>
@ -618,9 +606,9 @@ module.exports = grammar({
...bit_string_rules(
"pattern",
"_pattern",
"_pattern_bit_string_segment_arg"
"_pattern_bit_string_segment_argument"
),
_pattern_bit_string_segment_arg: ($) => choice($.var, $.integer),
_pattern_bit_string_segment_argument: ($) => choice($.var, $.integer),
list_pattern: ($) =>
seq(
"[",
@ -644,11 +632,11 @@ module.exports = grammar({
type_constructors: ($) => repeat1($.type_constructor),
type_constructor: ($) =>
seq(
$._upname,
optional(seq("(", optional($.type_constructor_arguments), ")"))
field("name", $.type_identifier),
optional(field("arguments", $.type_constructor_arguments))
),
type_constructor_arguments: ($) =>
series_of($.type_constructor_argument, ","),
seq("(", optional(series_of($.type_constructor_argument, ",")), ")"),
type_constructor_argument: ($) =>
seq(
optional(seq(field("label", $.identifier), ":")),
@ -696,14 +684,7 @@ module.exports = grammar({
/* Types */
_type: ($) =>
choice(
$.type_hole,
$.tuple_type,
$.function_type,
$.type,
$.remote_type,
$.type_var
),
choice($.type_hole, $.tuple_type, $.function_type, $.type, $.type_var),
_type_annotation: ($) => seq(":", field("type", $._type)),
type_hole: ($) => $._discard_name,
// If you're wondering why there isn't a `list_type` here, the answer is
@ -720,29 +701,34 @@ module.exports = grammar({
function_parameter_types: ($) =>
seq("(", optional(series_of($._type, ",")), ")"),
// "type" is a somewhat ambiguous name, but it refers to a concrete type
// such as `Bool` or `List(Int)` or even `List(#(Int, String))`.
type: ($) => seq($._upname, field("arguments", optional($.type_arguments))),
// such as `Bool` or `List(Int)` or even `result.Result(#(Int, Int), Nil)`.
type: ($) =>
seq(
field("name", choice($.type_identifier, $.remote_type_identifier)),
field("arguments", optional($.type_arguments))
),
type_arguments: ($) =>
seq("(", optional(series_of($.type_argument, ",")), ")"),
type_argument: ($) => $._type,
remote_type: ($) => seq(field("module", $.identifier), ".", $.type),
type_var: ($) => $._name,
// "type_name" referes essentially to the declaration of a type. The type
// "type_name" essentially refers to the declaration of a type. The type
// parameters are part of the "name." Bit odd, but 🤷
// e.g. MyType(a, b)
type_name: ($) => seq($._upname, optional($.type_parameters)),
type_name: ($) =>
seq(
field("name", choice($.type_identifier, $.remote_type_identifier)),
optional(field("parameters", $.type_parameters))
),
type_parameters: ($) =>
seq("(", optional(series_of($.type_parameter, ",")), ")"),
type_parameter: ($) => $._name,
remote_type_name: ($) =>
seq(field("module", $.identifier), ".", $.type_name),
/* Shared AST nodes */
identifier: ($) => $._name,
record_name: ($) => $._upname,
remote_record_name: ($) =>
seq(field("module", $.identifier), ".", $.record_name),
type_identifier: ($) => $._upname,
remote_type_identifier: ($) =>
seq(field("module", $.identifier), ".", field("name", $.type_identifier)),
/* Reused types from the Gleam lexer */
_discard_name: ($) => /_[_0-9a-z]*/,

@ -401,7 +401,7 @@
"name": "name",
"content": {
"type": "SYMBOL",
"name": "record_name"
"name": "type_identifier"
}
},
{
@ -419,7 +419,7 @@
"name": "alias",
"content": {
"type": "SYMBOL",
"name": "record_name"
"name": "type_identifier"
}
}
]
@ -510,7 +510,7 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_tuple"
"name": "constant_tuple"
},
"named": true,
"value": "tuple"
@ -519,7 +519,7 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_list"
"name": "constant_list"
},
"named": true,
"value": "list"
@ -537,23 +537,14 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_record"
"name": "constant_record"
},
"named": true,
"value": "record"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_remote_record"
},
"named": true,
"value": "remote_record"
}
]
},
"_constant_tuple": {
"constant_tuple": {
"type": "SEQ",
"members": [
{
@ -603,7 +594,7 @@
}
]
},
"_constant_list": {
"constant_list": {
"type": "SEQ",
"members": [
{
@ -829,24 +820,41 @@
}
]
},
"_constant_record": {
"constant_record": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "record_name"
"name": "remote_type_identifier"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_record_arguments"
"name": "constant_record_arguments"
},
"named": true,
"value": "arguments"
}
},
{
"type": "BLANK"
@ -855,7 +863,7 @@
}
]
},
"_constant_record_arguments": {
"constant_record_arguments": {
"type": "SEQ",
"members": [
{
@ -872,7 +880,7 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_record_argument"
"name": "constant_record_argument"
},
"named": true,
"value": "argument"
@ -890,7 +898,7 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_constant_record_argument"
"name": "constant_record_argument"
},
"named": true,
"value": "argument"
@ -911,7 +919,7 @@
}
]
},
"_constant_record_argument": {
"constant_record_argument": {
"type": "SEQ",
"members": [
{
@ -949,32 +957,6 @@
}
]
},
"_constant_remote_record": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "module",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_name"
},
"named": true,
"value": "identifier"
}
},
{
"type": "STRING",
"value": "."
},
{
"type": "SYMBOL",
"name": "_constant_record"
}
]
},
"_constant_type": {
"type": "CHOICE",
"members": [
@ -999,15 +981,6 @@
},
"named": true,
"value": "type"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "constant_remote_type"
},
"named": true,
"value": "remote_type"
}
]
},
@ -1080,15 +1053,31 @@
},
"constant_type": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_upname"
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "remote_type_identifier"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
@ -1096,6 +1085,7 @@
},
"named": true,
"value": "type_arguments"
}
},
{
"type": "BLANK"
@ -1164,32 +1154,6 @@
"type": "SYMBOL",
"name": "_constant_type"
},
"constant_remote_type": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "module",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": "."
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "constant_type"
},
"named": true,
"value": "type"
}
]
},
"public_external_type": {
"type": "SEQ",
"members": [
@ -1255,14 +1219,9 @@
{
"type": "FIELD",
"name": "name",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_name"
},
"named": true,
"value": "function_name"
"name": "identifier"
}
},
{
@ -2162,10 +2121,6 @@
"type": "SYMBOL",
"name": "record"
},
{
"type": "SYMBOL",
"name": "remote_record"
},
{
"type": "SYMBOL",
"name": "var"
@ -2233,46 +2188,37 @@
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "_upname"
},
"named": true,
"value": "record_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "arguments"
"name": "type_identifier"
},
{
"type": "BLANK"
"type": "SYMBOL",
"name": "remote_type_identifier"
}
]
}
]
},
"remote_record": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "module",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
"type": "SYMBOL",
"name": "arguments"
},
{
"type": "SYMBOL",
"name": "record"
"type": "BLANK"
}
]
}
}
]
},
@ -3207,14 +3153,9 @@
{
"type": "FIELD",
"name": "tuple",
"content": {
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_name"
},
"named": true,
"value": "var"
"name": "var"
}
},
{
@ -3305,11 +3246,11 @@
"members": [
{
"type": "SYMBOL",
"name": "record_name"
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "remote_record_name"
"name": "remote_type_identifier"
}
]
}
@ -3467,10 +3408,6 @@
"type": "SYMBOL",
"name": "record"
},
{
"type": "SYMBOL",
"name": "remote_record"
},
{
"type": "SYMBOL",
"name": "var"
@ -3688,10 +3625,6 @@
"type": "SYMBOL",
"name": "discard_var"
},
{
"type": "SYMBOL",
"name": "remote_constructor_pattern"
},
{
"type": "SYMBOL",
"name": "constructor_pattern"
@ -3741,13 +3674,8 @@
"value": "as"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_name"
},
"named": true,
"value": "pattern_assign"
"name": "pattern_assign"
}
]
}
@ -3759,6 +3687,10 @@
}
]
},
"pattern_assign": {
"type": "SYMBOL",
"name": "_name"
},
"var": {
"type": "SYMBOL",
"name": "_name"
@ -3767,40 +3699,36 @@
"type": "SYMBOL",
"name": "_discard_name"
},
"remote_constructor_pattern": {
"constructor_pattern": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_name"
},
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
"type": "SYMBOL",
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "_constructor_pattern"
"name": "remote_type_identifier"
}
]
},
"constructor_pattern": {
"type": "SYMBOL",
"name": "_constructor_pattern"
},
"_constructor_pattern": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_upname"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "pattern_constructor_args"
"name": "pattern_constructor_arguments"
}
},
{
"type": "BLANK"
@ -3809,7 +3737,7 @@
}
]
},
"pattern_constructor_args": {
"pattern_constructor_arguments": {
"type": "SEQ",
"members": [
{
@ -3824,7 +3752,7 @@
"members": [
{
"type": "SYMBOL",
"name": "_pattern_constructor_arg"
"name": "_pattern_constructor_argument"
},
{
"type": "REPEAT",
@ -3837,7 +3765,7 @@
},
{
"type": "SYMBOL",
"name": "_pattern_constructor_arg"
"name": "_pattern_constructor_argument"
}
]
}
@ -3867,12 +3795,12 @@
}
]
},
"_pattern_constructor_arg": {
"_pattern_constructor_argument": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "pattern_constructor_named_arg"
"name": "pattern_constructor_named_argument"
},
{
"type": "ALIAS",
@ -3881,11 +3809,11 @@
"name": "constructor_pattern"
},
"named": true,
"value": "pattern_constructor_unnamed_arg"
"value": "pattern_constructor_unnamed_argument"
}
]
},
"pattern_constructor_named_arg": {
"pattern_constructor_named_argument": {
"type": "SEQ",
"members": [
{
@ -4142,7 +4070,7 @@
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "_pattern_bit_string_segment_arg"
"name": "_pattern_bit_string_segment_argument"
},
"named": true,
"value": "bit_string_segment_option_size"
@ -4153,7 +4081,7 @@
}
]
},
"_pattern_bit_string_segment_arg": {
"_pattern_bit_string_segment_argument": {
"type": "CHOICE",
"members": [
{
@ -4342,36 +4270,23 @@
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "_upname"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
"name": "type_identifier"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "type_constructor_arguments"
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
{
"type": "BLANK"
@ -4381,6 +4296,16 @@
]
},
"type_constructor_arguments": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
@ -4405,6 +4330,17 @@
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"type_constructor_argument": {
"type": "SEQ",
"members": [
@ -4776,10 +4712,6 @@
"type": "SYMBOL",
"name": "type"
},
{
"type": "SYMBOL",
"name": "remote_type"
},
{
"type": "SYMBOL",
"name": "type_var"
@ -4942,10 +4874,23 @@
},
"type": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "name",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_upname"
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "remote_type_identifier"
}
]
}
},
{
"type": "FIELD",
@ -5015,44 +4960,40 @@
"type": "SYMBOL",
"name": "_type"
},
"remote_type": {
"type_var": {
"type": "SYMBOL",
"name": "_name"
},
"type_name": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "module",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "."
"type": "SYMBOL",
"name": "type_identifier"
},
{
"type": "SYMBOL",
"name": "type"
"name": "remote_type_identifier"
}
]
},
"type_var": {
"type": "SYMBOL",
"name": "_name"
},
"type_name": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_upname"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "FIELD",
"name": "parameters",
"content": {
"type": "SYMBOL",
"name": "type_parameters"
}
},
{
"type": "BLANK"
@ -5111,36 +5052,15 @@
"type": "SYMBOL",
"name": "_name"
},
"remote_type_name": {
"type": "SEQ",
"members": [
{
"type": "FIELD",
"name": "module",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": "."
},
{
"type": "SYMBOL",
"name": "type_name"
}
]
},
"identifier": {
"type": "SYMBOL",
"name": "_name"
},
"record_name": {
"type_identifier": {
"type": "SYMBOL",
"name": "_upname"
},
"remote_record_name": {
"remote_type_identifier": {
"type": "SEQ",
"members": [
{
@ -5156,8 +5076,12 @@
"value": "."
},
{
"type": "FIELD",
"name": "name",
"content": {
"type": "SYMBOL",
"name": "record_name"
"name": "type_identifier"
}
}
]
},
@ -5189,10 +5113,6 @@
}
],
"conflicts": [
[
"record",
"record_name"
],
[
"var",
"identifier"

@ -21,10 +21,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -133,10 +129,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -230,10 +222,6 @@
"type": "pattern_assign",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -256,10 +244,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -338,10 +322,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -430,10 +410,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -599,14 +575,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -699,10 +667,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -925,10 +889,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -984,10 +944,6 @@
"type": "record",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -1054,10 +1010,6 @@
"type": "list_pattern",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -1152,10 +1104,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -1197,10 +1145,6 @@
"multiple": false,
"required": false,
"types": [
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1239,10 +1183,6 @@
"type": "record",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -1258,16 +1198,31 @@
{
"type": "constructor_pattern",
"named": true,
"fields": {},
"children": {
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
{
"type": "pattern_constructor_args",
"type": "pattern_constructor_arguments",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "remote_type_identifier",
"named": true
},
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
@ -1339,10 +1294,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -1389,7 +1340,7 @@
"required": true,
"types": [
{
"type": "function_name",
"type": "identifier",
"named": true
}
]
@ -1412,10 +1363,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1508,10 +1455,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "tuple_access",
"named": true
@ -1556,10 +1499,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1654,10 +1593,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -1760,10 +1695,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1796,10 +1727,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1856,10 +1783,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -1985,10 +1908,6 @@
"type": "pattern_assign",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -2011,10 +1930,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2093,10 +2008,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -2185,10 +2096,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -2272,10 +2179,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -2350,10 +2253,6 @@
"type": "list_pattern_tail",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -2394,7 +2293,12 @@
"fields": {}
},
{
"type": "pattern_constructor_args",
"type": "pattern_assign",
"named": true,
"fields": {}
},
{
"type": "pattern_constructor_arguments",
"named": true,
"fields": {},
"children": {
@ -2402,11 +2306,11 @@
"required": false,
"types": [
{
"type": "pattern_constructor_named_arg",
"type": "pattern_constructor_named_argument",
"named": true
},
{
"type": "pattern_constructor_unnamed_arg",
"type": "pattern_constructor_unnamed_argument",
"named": true
},
{
@ -2417,7 +2321,7 @@
}
},
{
"type": "pattern_constructor_named_arg",
"type": "pattern_constructor_named_argument",
"named": true,
"fields": {},
"children": {
@ -2432,19 +2336,34 @@
}
},
{
"type": "pattern_constructor_unnamed_arg",
"type": "pattern_constructor_unnamed_argument",
"named": true,
"fields": {},
"children": {
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
{
"type": "pattern_constructor_args",
"type": "pattern_constructor_arguments",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "remote_type_identifier",
"named": true
},
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
"type": "pattern_spread",
@ -2469,10 +2388,6 @@
"multiple": false,
"required": false,
"types": [
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2511,10 +2426,6 @@
"type": "record",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -2546,7 +2457,7 @@
"required": true,
"types": [
{
"type": "function_name",
"type": "identifier",
"named": true
}
]
@ -2569,10 +2480,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2640,10 +2547,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2686,10 +2589,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2744,10 +2643,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -2793,26 +2688,32 @@
{
"type": "record",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
{
"type": "arguments",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "remote_type_identifier",
"named": true
},
{
"type": "record_name",
"type": "type_identifier",
"named": true
}
]
}
},
{
"type": "record_name",
"named": true,
"fields": {}
}
},
{
"type": "record_update",
@ -2833,11 +2734,11 @@
"required": true,
"types": [
{
"type": "record_name",
"type": "remote_type_identifier",
"named": true
},
{
"type": "remote_record_name",
"type": "type_identifier",
"named": true
}
]
@ -2902,10 +2803,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -3004,10 +2901,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -3048,56 +2941,7 @@
}
},
{
"type": "remote_constructor_pattern",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "pattern_constructor_args",
"named": true
}
]
}
},
{
"type": "remote_record",
"named": true,
"fields": {
"module": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "arguments",
"named": true
},
{
"type": "record",
"named": true
},
{
"type": "record_name",
"named": true
}
]
}
},
{
"type": "remote_record_name",
"type": "remote_type_identifier",
"named": true,
"fields": {
"module": {
@ -3109,43 +2953,17 @@
"named": true
}
]
}
},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "record_name",
"named": true
}
]
}
},
{
"type": "remote_type",
"named": true,
"fields": {
"module": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"type": "type_identifier",
"named": true
}
]
}
},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "type",
"named": true
}
]
}
},
{
@ -3380,10 +3198,6 @@
"type": "pattern_assign",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -3406,10 +3220,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -3488,10 +3298,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -3580,10 +3386,6 @@
"type": "record_update",
"named": true
},
{
"type": "remote_record",
"named": true
},
{
"type": "string",
"named": true
@ -3704,10 +3506,6 @@
"type": "list_pattern",
"named": true
},
{
"type": "remote_constructor_pattern",
"named": true
},
{
"type": "string",
"named": true
@ -3735,10 +3533,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -3771,18 +3565,22 @@
"named": true
}
]
}
},
"children": {
"name": {
"multiple": false,
"required": false,
"required": true,
"types": [
{
"type": "type_arguments",
"type": "remote_type_identifier",
"named": true
},
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
"type": "type_alias",
@ -3796,10 +3594,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -3835,10 +3629,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -3876,8 +3666,8 @@
{
"type": "type_constructor",
"named": true,
"fields": {},
"children": {
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
@ -3886,6 +3676,17 @@
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
@ -3910,10 +3711,6 @@
"type": "function_type",
"named": true
},
{
"type": "remote_type",
"named": true
},
{
"type": "tuple_type",
"named": true
@ -3940,7 +3737,7 @@
"fields": {},
"children": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "type_constructor_argument",
@ -3988,11 +3785,30 @@
"named": true,
"fields": {}
},
{
"type": "type_identifier",
"named": true,
"fields": {}
},
{
"type": "type_name",
"named": true,
"fields": {},
"children": {
"fields": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "remote_type_identifier",
"named": true
},
{
"type": "type_identifier",
"named": true
}
]
},
"parameters": {
"multiple": false,
"required": false,
"types": [
@ -4002,6 +3818,7 @@
}
]
}
}
},
{
"type": "type_parameter",
@ -4041,7 +3858,7 @@
"named": true
},
{
"type": "record_name",
"type": "type_identifier",
"named": true
}
]
@ -4055,7 +3872,7 @@
"named": true
},
{
"type": "record_name",
"type": "type_identifier",
"named": true
}
]
@ -4306,10 +4123,6 @@
"type": "fn",
"named": false
},
{
"type": "function_name",
"named": true
},
{
"type": "if",
"named": false
@ -4330,10 +4143,6 @@
"type": "opaque",
"named": false
},
{
"type": "pattern_assign",
"named": true
},
{
"type": "pub",
"named": false

File diff suppressed because it is too large Load Diff