support functions in let
This commit is contained in:
parent
356b6600f2
commit
6e1878db5d
5 changed files with 592 additions and 557 deletions
|
|
@ -38,7 +38,7 @@ module.exports = grammar({
|
||||||
|
|
||||||
param_block : $ => seq(
|
param_block : $ => seq(
|
||||||
'(',
|
'(',
|
||||||
field('param', repeat($.identifier)),
|
field('param', repeat1($.identifier)),
|
||||||
':',
|
':',
|
||||||
field('type', $.expr),
|
field('type', $.expr),
|
||||||
')'
|
')'
|
||||||
|
|
@ -71,6 +71,7 @@ module.exports = grammar({
|
||||||
binding : $ => seq(
|
binding : $ => seq(
|
||||||
'(',
|
'(',
|
||||||
$.identifier,
|
$.identifier,
|
||||||
|
repeat($.param_block),
|
||||||
':=',
|
':=',
|
||||||
$.expr,
|
$.expr,
|
||||||
')',
|
')',
|
||||||
|
|
|
||||||
9
src/grammar.json
generated
9
src/grammar.json
generated
|
|
@ -92,7 +92,7 @@
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
"name": "param",
|
"name": "param",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "REPEAT",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
|
|
@ -254,6 +254,13 @@
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "identifier"
|
"name": "identifier"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "param_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": ":="
|
"value": ":="
|
||||||
|
|
|
||||||
6
src/node-types.json
generated
6
src/node-types.json
generated
|
|
@ -91,6 +91,10 @@
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "param_block",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +219,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"param": {
|
"param": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": false,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
|
|
|
||||||
1116
src/parser.c
generated
1116
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,7 @@ Let
|
||||||
|
|
||||||
foo := let (x := a)
|
foo := let (x := a)
|
||||||
(y := x)
|
(y := x)
|
||||||
|
(f (x : A) := x)
|
||||||
in
|
in
|
||||||
x
|
x
|
||||||
end;
|
end;
|
||||||
|
|
@ -30,6 +31,20 @@ foo := let (x := a)
|
||||||
(app
|
(app
|
||||||
(term
|
(term
|
||||||
(identifier))))))
|
(identifier))))))
|
||||||
|
(binding
|
||||||
|
(identifier)
|
||||||
|
(param_block
|
||||||
|
(identifier)
|
||||||
|
(expr
|
||||||
|
(app_term
|
||||||
|
(app
|
||||||
|
(term
|
||||||
|
(identifier))))))
|
||||||
|
(expr
|
||||||
|
(app_term
|
||||||
|
(app
|
||||||
|
(term
|
||||||
|
(identifier))))))
|
||||||
(expr
|
(expr
|
||||||
(app_term
|
(app_term
|
||||||
(app
|
(app
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue