Skip to content

Commit

Permalink
Correct name from "type_constructor" to "data_constructor" (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
J3RN authored Feb 26, 2022
1 parent 5cb3870 commit cfcbca3
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 240 deletions.
14 changes: 7 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,16 @@ module.exports = grammar({
public_opaque_type_definition: ($) =>
seq("pub", "opaque", "type", $._custom_type_definition),
_custom_type_definition: ($) =>
seq($.type_name, "{", $.type_constructors, "}"),
type_constructors: ($) => repeat1($.type_constructor),
type_constructor: ($) =>
seq($.type_name, "{", $.data_constructors, "}"),
data_constructors: ($) => repeat1($.data_constructor),
data_constructor: ($) =>
seq(
field("name", $.type_identifier),
optional(field("arguments", $.type_constructor_arguments))
optional(field("arguments", $.data_constructor_arguments))
),
type_constructor_arguments: ($) =>
seq("(", optional(series_of($.type_constructor_argument, ",")), ")"),
type_constructor_argument: ($) =>
data_constructor_arguments: ($) =>
seq("(", optional(series_of($.data_constructor_argument, ",")), ")"),
data_constructor_argument: ($) =>
seq(optional(seq(field("label", $.label), ":")), field("value", $._type)),

/* Type aliases */
Expand Down
8 changes: 4 additions & 4 deletions queries/tags.scm
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
(type_name
name: (type_identifier) @name)) @definition.type
(public_type_definition
(type_constructors
(type_constructor
(data_constructors
(data_constructor
name: (type_identifier) @name))) @definition.type
(type_definition
(type_constructors
(type_constructor
(data_constructors
(data_constructor
name: (type_identifier) @name))) @definition.type
(external_type
(type_name
Expand Down
18 changes: 9 additions & 9 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4935,22 +4935,22 @@
},
{
"type": "SYMBOL",
"name": "type_constructors"
"name": "data_constructors"
},
{
"type": "STRING",
"value": "}"
}
]
},
"type_constructors": {
"data_constructors": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "type_constructor"
"name": "data_constructor"
}
},
"type_constructor": {
"data_constructor": {
"type": "SEQ",
"members": [
{
Expand All @@ -4969,7 +4969,7 @@
"name": "arguments",
"content": {
"type": "SYMBOL",
"name": "type_constructor_arguments"
"name": "data_constructor_arguments"
}
},
{
Expand All @@ -4979,7 +4979,7 @@
}
]
},
"type_constructor_arguments": {
"data_constructor_arguments": {
"type": "SEQ",
"members": [
{
Expand All @@ -4994,7 +4994,7 @@
"members": [
{
"type": "SYMBOL",
"name": "type_constructor_argument"
"name": "data_constructor_argument"
},
{
"type": "REPEAT",
Expand All @@ -5007,7 +5007,7 @@
},
{
"type": "SYMBOL",
"name": "type_constructor_argument"
"name": "data_constructor_argument"
}
]
}
Expand Down Expand Up @@ -5037,7 +5037,7 @@
}
]
},
"type_constructor_argument": {
"data_constructor_argument": {
"type": "SEQ",
"members": [
{
Expand Down
202 changes: 101 additions & 101 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,104 @@
}
}
},
{
"type": "data_constructor",
"named": true,
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
{
"type": "data_constructor_arguments",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
"type": "data_constructor_argument",
"named": true,
"fields": {
"label": {
"multiple": false,
"required": false,
"types": [
{
"type": "label",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "function_type",
"named": true
},
{
"type": "tuple_type",
"named": true
},
{
"type": "type",
"named": true
},
{
"type": "type_hole",
"named": true
},
{
"type": "type_var",
"named": true
}
]
}
}
},
{
"type": "data_constructor_arguments",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "data_constructor_argument",
"named": true
}
]
}
},
{
"type": "data_constructors",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "data_constructor",
"named": true
}
]
}
},
{
"type": "discard",
"named": true,
Expand Down Expand Up @@ -2730,7 +2828,7 @@
"required": true,
"types": [
{
"type": "type_constructors",
"type": "data_constructors",
"named": true
},
{
Expand Down Expand Up @@ -2784,7 +2882,7 @@
"required": true,
"types": [
{
"type": "type_constructors",
"type": "data_constructors",
"named": true
},
{
Expand Down Expand Up @@ -3912,104 +4010,6 @@
]
}
},
{
"type": "type_constructor",
"named": true,
"fields": {
"arguments": {
"multiple": false,
"required": false,
"types": [
{
"type": "type_constructor_arguments",
"named": true
}
]
},
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "type_identifier",
"named": true
}
]
}
}
},
{
"type": "type_constructor_argument",
"named": true,
"fields": {
"label": {
"multiple": false,
"required": false,
"types": [
{
"type": "label",
"named": true
}
]
},
"value": {
"multiple": false,
"required": true,
"types": [
{
"type": "function_type",
"named": true
},
{
"type": "tuple_type",
"named": true
},
{
"type": "type",
"named": true
},
{
"type": "type_hole",
"named": true
},
{
"type": "type_var",
"named": true
}
]
}
}
},
{
"type": "type_constructor_arguments",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "type_constructor_argument",
"named": true
}
]
}
},
{
"type": "type_constructors",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "type_constructor",
"named": true
}
]
}
},
{
"type": "type_definition",
"named": true,
Expand All @@ -4019,7 +4019,7 @@
"required": true,
"types": [
{
"type": "type_constructors",
"type": "data_constructors",
"named": true
},
{
Expand Down
Loading

0 comments on commit cfcbca3

Please sign in to comment.