Skip to content

Commit

Permalink
fix: characters set for infix op
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsidorenco committed Jun 21, 2024
1 parent 828a961 commit 996ea99
Show file tree
Hide file tree
Showing 5 changed files with 446,915 additions and 401,810 deletions.
43 changes: 19 additions & 24 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ module.exports = grammar({

inline: ($) => [
$._module_elem,
$._infix_or_prefix_op,
$._base_call,
$._expression_or_range,
$._object_expression_inner,
Expand Down Expand Up @@ -451,6 +450,24 @@ module.exports = grammar({
// (static-typars : (member-sig) expr)
),

literal_expression: ($) =>
prec(
PREC.PAREN_EXPR,
choice(
seq("<@", $._expression, "@>"),
seq("<@@", $._expression, "@@>"),
),
),

long_identifier_or_op: ($) =>
prec.right(
choice(
$.long_identifier,
seq($.long_identifier, ".", $._identifier_or_op),
$._identifier_or_op,
),
),

tuple_expression: ($) =>
prec.right(PREC.TUPLE_EXPR, seq($._expression, ",", $._expression)),

Expand Down Expand Up @@ -510,15 +527,6 @@ module.exports = grammar({
prec.right(PREC.PREFIX_EXPR, $._expression),
),

literal_expression: ($) =>
prec(
PREC.PAREN_EXPR,
choice(
seq("<@", $._expression, "@>"),
seq("<@@", $._expression, "@@>"),
),
),

typecast_expression: ($) =>
prec.right(
PREC.SPECIAL_INFIX,
Expand Down Expand Up @@ -1613,15 +1621,6 @@ module.exports = grammar({
),

// Identifiers:
long_identifier_or_op: ($) =>
prec.right(
choice(
$.long_identifier,
seq($.long_identifier, ".", $._identifier_or_op),
$._identifier_or_op,
),
),

long_identifier: ($) =>
prec.right(seq($.identifier, repeat(seq(".", $.identifier)))),

Expand Down Expand Up @@ -1666,7 +1665,7 @@ module.exports = grammar({
PREC.INFIX_OP,
choice(
$._infix_or_prefix_op,
/[-+<>|&^*/'%@][!%&*+-./<=>@^|~?]*/,
/[-+<>|&^*/'%@][!%&*+./<=>@^|~?-]*/,
"||",
"=",
"!=",
Expand All @@ -1675,10 +1674,6 @@ module.exports = grammar({
"$",
"or",
"?",
"<@",
"<@@",
"@>",
"@@>",
"?",
"?<-",
),
Expand Down
173 changes: 78 additions & 95 deletions src/grammar.json

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

4 changes: 2 additions & 2 deletions src/node-types.json

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

Loading

0 comments on commit 996ea99

Please sign in to comment.