Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Remove unnecessary semicolons from the grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Mackie committed Jan 13, 2023
1 parent 1b3bb40 commit 8ef1dd9
Show file tree
Hide file tree
Showing 47 changed files with 8,135 additions and 5,333 deletions.
3 changes: 1 addition & 2 deletions rules/expressions/let.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = {
field("binder", $._pattern),
field("type_annotation", optional($.type_annotation)),
"=",
field("expression", $._expression),
";"
field("expression", $._expression)
),
};
25 changes: 10 additions & 15 deletions rules/module/declarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,34 @@ module.exports = {

_type_declaration: $ => choice($.type_declaration, $.type_declaration_empty),

// type Maybe(a) = Just(a) | Nothing;
// type Maybe(a) = Just(a) | Nothing
type_declaration: $ =>
seq(
"type",
field("name", $.type_declaration_name),
field("variables", optional($.type_declaration_variables)),
"=",
field("constructor", seq(optional("|"), $.type_declaration_constructor)),
field("constructor", repeat(seq("|", $.type_declaration_constructor))),
";"
field("constructor", repeat(seq("|", $.type_declaration_constructor)))
),

// type Unknown;
// type Unknown
type_declaration_empty: $ =>
seq(
"type",
field("name", $.type_declaration_name),
field("variables", optional($.type_declaration_variables)),
";"
field("variables", optional($.type_declaration_variables))
),

// type alias Double = Float;
// type alias Double = Float
type_alias_declaration: $ =>
seq(
"type",
"alias",
field("name", $.type_declaration_name),
field("variables", optional($.type_declaration_variables)),
"=",
field("aliased_type", $._type),
";"
field("aliased_type", $._type)
),

type_declaration_name: $ => $._proper_name,
Expand All @@ -62,25 +59,23 @@ module.exports = {
type_declaration_constructor_fields: $ =>
seq("(", field("field", commaSep1($._type)), ")"),

// five = 5;
// five = 5
value_declaration: $ =>
seq(
field("name", $.value_declaration_name),
field("type_annotation", optional($.type_annotation)),
"=",
field("expression", $._expression),
";"
field("expression", $._expression)
),

value_declaration_name: $ => $._name,

// foreign is_eq_impl = (Int, Int) -> Bool;
// foreign is_eq_impl = (Int, Int) -> Bool
foreign_value_declaration: $ =>
seq(
"foreign",
field("name", $.foreign_value_declaration_name),
field("type_annotation", $.type_annotation),
";"
field("type_annotation", $.type_annotation)
),

foreign_value_declaration_name: $ => $._name,
Expand Down
6 changes: 2 additions & 4 deletions rules/module/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module.exports = {
"module",
field("module_name", $.module_name),
"exports",
field("exports", $._exposing),
";"
field("exports", $._exposing)
),

module_name: $ => sep1($._proper_name, "."),
Expand All @@ -20,8 +19,7 @@ module.exports = {
field("package", optional($.module_import_package)),
field("module_name", $.module_name),
field("alias", optional(seq("as", $.module_import_alias))),
field("imports", optional($._exposing)),
";"
field("imports", optional($._exposing))
),

module_import_package: $ => seq("(", $._package_name, ")"),
Expand Down
32 changes: 0 additions & 32 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
"type": "SYMBOL",
"name": "_exposing"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -166,10 +162,6 @@
}
]
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -437,10 +429,6 @@
]
}
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -474,10 +462,6 @@
}
]
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -527,10 +511,6 @@
"type": "SYMBOL",
"name": "_type"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -721,10 +701,6 @@
"type": "SYMBOL",
"name": "_expression"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -754,10 +730,6 @@
"type": "SYMBOL",
"name": "type_annotation"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down Expand Up @@ -1899,10 +1871,6 @@
"type": "SYMBOL",
"name": "_expression"
}
},
{
"type": "STRING",
"value": ";"
}
]
},
Expand Down
Loading

0 comments on commit 8ef1dd9

Please sign in to comment.