plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
96ec67f
— Peter John
2026-07-20T11:22:20+05:30
feat(tree-sitter-plum): allow positional variant-construction calls
tooling/tree-sitter-plum/grammar.js
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = grammar({
|
|
|
52
52
|
')',
|
|
53
53
|
'}',
|
|
54
54
|
],
|
|
55
|
-
conflicts: ($) => [],
|
|
55
|
+
conflicts: ($) => [[$.fn_argument_list, $.class_argument_list]],
|
|
56
56
|
inline: ($) => [$.generic_type, $.generic],
|
|
57
57
|
rules: {
|
|
58
58
|
source: ($) =>
|
|
@@ -386,7 +386,7 @@ module.exports = grammar({
|
|
|
386
386
|
// the parser could see the following `(`.
|
|
387
387
|
fn_call: ($) =>
|
|
388
388
|
prec(PREC.call, seq(
|
|
389
|
-
field("function", $.var_identifier),
|
|
389
|
+
field("function", choice($.var_identifier, $.type_identifier)),
|
|
390
390
|
field(
|
|
391
391
|
"arguments",
|
|
392
392
|
$.fn_argument_list,
|
tooling/tree-sitter-plum/src/grammar.json
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/src/node-types.json
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/src/parser.c
CHANGED
|
Binary file
|
tooling/tree-sitter-plum/test/corpus/function.txt
CHANGED
|
@@ -115,3 +115,30 @@ fullname<User>() -> String =
|
|
|
115
115
|
(type_identifier))
|
|
116
116
|
(body
|
|
117
117
|
(todo))))
|
|
118
|
+
|
|
119
|
+
================================================================================
|
|
120
|
+
function - variant construction call (positional args on a capitalized name)
|
|
121
|
+
================================================================================
|
|
122
|
+
|
|
123
|
+
makeSome(v: Int) -> Option =
|
|
124
|
+
Some(v)
|
|
125
|
+
|
|
126
|
+
--------------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
(source
|
|
129
|
+
(fn
|
|
130
|
+
(fn_identifier)
|
|
131
|
+
(param
|
|
132
|
+
(var_identifier)
|
|
133
|
+
(type
|
|
134
|
+
(type_identifier)))
|
|
135
|
+
(return_type
|
|
136
|
+
(type_identifier))
|
|
137
|
+
(body
|
|
138
|
+
(primary_expression
|
|
139
|
+
(fn_call
|
|
140
|
+
(type_identifier)
|
|
141
|
+
(fn_argument_list
|
|
142
|
+
(expression
|
|
143
|
+
(primary_expression
|
|
144
|
+
(var_identifier)))))))))
|