Skip to content

Commit

Permalink
Support short lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Lycs-D committed Mar 23, 2024
1 parent b21db15 commit f5458e2
Show file tree
Hide file tree
Showing 5 changed files with 203,603 additions and 194,370 deletions.
20 changes: 18 additions & 2 deletions tree_sitter_v/grammar.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const PREC = {
or: 1,
resolve: 1,
composite_literal: -1,
strictly_expression_list: -3,
strictly_expression_list: -2,
};

const multiplicative_operators = ["*", "/", "%", "<<", ">>", ">>>", "&", "&^"];
Expand Down Expand Up @@ -578,7 +578,14 @@ module.exports = grammar({
prec.dynamic(2, seq(token.immediate("["), comma_sep1($.plain_type), "]")),

argument_list: ($) =>
seq("(", repeat(seq($.argument, optional(list_separator))), ")"),
seq(
"(",
choice(
repeat(seq($.argument, optional(list_separator))),
seq("|", comma_sep($.identifier), "|", $._expression_without_blocks),
),
")",
),

argument: ($) =>
choice(
Expand Down Expand Up @@ -1505,14 +1512,23 @@ module.exports = grammar({
},
});

/**
* @param {RuleOrLiteral} rule
*/
function comp_time(rule) {
return seq("$", rule);
}

/**
* @param {RuleOrLiteral} rules
*/
function comma_sep1(rules) {
return seq(rules, repeat(seq(",", rules)));
}

/**
* @param {RuleOrLiteral} rule
*/
function comma_sep(rule) {
return optional(comma_sep1(rule));
}
107 changes: 81 additions & 26 deletions tree_sitter_v/src/grammar.json

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

112 changes: 112 additions & 0 deletions tree_sitter_v/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 f5458e2

Please sign in to comment.