Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for v0.28.0 #55

Merged
merged 7 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ Contributing
3. Add parser feature tests to the relevant file(s) in `test/corpus/`, or make a new one.
4. Run `npm run test` and fix any failing tests.

Policies
--------

Per the conversation in [#55](https://github.com/gleam-lang/tree-sitter-gleam/pull/55), we have decided that from v0.28.0 forward, tree-sitter-gleam will maintain backwards compatibility with the previous two versions; meaning that each release will support three versions:
- Current
- Current - 1
- Current - 2

Style
-----

Expand Down
21 changes: 11 additions & 10 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = grammar({
name: "gleam",
externals: ($) => [$.quoted_content],
extras: ($) => [
";",
NEWLINE,
/\s/,
$.module_comment,
Expand All @@ -26,6 +25,7 @@ module.exports = grammar({
[$.case_subjects],
[$.source_file],
[$._constant_value, $._case_clause_guard_unit],
[$.integer],
],
rules: {
/* General rules */
Expand Down Expand Up @@ -251,7 +251,7 @@ module.exports = grammar({
seq(field("label", $.label), field("name", $.identifier)),
_name_param: ($) => field("name", $.identifier),
_statement_seq: ($) => repeat1($._statement),
_statement: ($) => choice($._expression, $.let, $.use),
_statement: ($) => choice($._expression, $.let, $.let_assert, $.use),
_expression: ($) => choice($._expression_unit, $.binary_expression),
binary_expression: ($) =>
choice(
Expand Down Expand Up @@ -302,11 +302,11 @@ module.exports = grammar({
$.list,
alias($._expression_bit_string, $.bit_string),
$.anonymous_function,
$.expression_group,
$.block,
$.case,
$.let_assert,
$.assert,
$.negation,
$.boolean_negation,
$.integer_negation,
$.record_update,
$.tuple_access,
$.field_access,
Expand Down Expand Up @@ -363,7 +363,7 @@ module.exports = grammar({
choice($._discard_param, $._name_param),
optional($._type_annotation)
),
expression_group: ($) => seq("{", $._statement_seq, "}"),
block: ($) => seq("{", $._statement_seq, "}"),
case: ($) =>
seq(
"case",
Expand Down Expand Up @@ -429,7 +429,8 @@ module.exports = grammar({
field("value", $._expression)
),
assert: ($) => seq("assert", $._assignment),
negation: ($) => seq("!", $._expression_unit),
boolean_negation: ($) => seq("!", $._expression_unit),
integer_negation: ($) => seq("-", $._expression_unit),
J3RN marked this conversation as resolved.
Show resolved Hide resolved
_assignment: ($) =>
seq(
field("pattern", $._pattern),
Expand Down Expand Up @@ -466,7 +467,7 @@ module.exports = grammar({
$.identifier,
$.function_call,
$.tuple,
$.expression_group,
$.block,
$.case,
$.field_access,
$.tuple_access
Expand All @@ -484,7 +485,7 @@ module.exports = grammar({
$.record,
$.identifier,
$.function_call,
$.expression_group,
$.block,
$.case,
$.record_update,
$.field_access,
Expand All @@ -510,7 +511,7 @@ module.exports = grammar({
choice(
$.identifier,
$.anonymous_function,
$.expression_group,
$.block,
$.case,
$.tuple_access,
$.field_access,
Expand Down
3 changes: 2 additions & 1 deletion queries/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
; Operators
(binary_expression
operator: _ @operator)
"!" @operator
(boolean_negation "!" @operator)
(integer_negation "-" @operator)

; Keywords
[
Expand Down
42 changes: 29 additions & 13 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading