Skip to content

Commit

Permalink
feat: object exprresion with generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
Nsidorenco committed Sep 8, 2024
1 parent 9ad957f commit 862fbd8
Show file tree
Hide file tree
Showing 8 changed files with 883,641 additions and 847,384 deletions.
9 changes: 3 additions & 6 deletions fsharp/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ module.exports = grammar({
$.infix_expression,
$.index_expression,
$.mutate_expression,
$.object_instantiation_expression,
$.list_expression,
$.array_expression,
$.ce_expression,
Expand Down Expand Up @@ -535,8 +534,8 @@ module.exports = grammar({
prec(
PREC.NEW_OBJ + 1,
seq(
$.object_instantiation_expression,
optional($._expression),
"new",
$._expression,
optional(seq("as", $.identifier)),
$._object_expression_inner,
),
Expand All @@ -560,6 +559,7 @@ module.exports = grammar({
"assert",
"upcast",
"downcast",
"new",
$.prefix_op,
),
prec.right(PREC.PREFIX_EXPR, $._expression),
Expand Down Expand Up @@ -653,9 +653,6 @@ module.exports = grammar({
seq("function", scoped($.rules, $._indent, $._dedent)),
),

object_instantiation_expression: ($) =>
prec(PREC.NEW_OBJ, seq("new", $._type)),

mutate_expression: ($) =>
prec.right(
PREC.LARROW,
Expand Down
41 changes: 8 additions & 33 deletions fsharp/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1525,10 +1525,6 @@
"type": "SYMBOL",
"name": "mutate_expression"
},
{
"type": "SYMBOL",
"name": "object_instantiation_expression"
},
{
"type": "SYMBOL",
"name": "list_expression"
Expand Down Expand Up @@ -1855,20 +1851,12 @@
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "object_instantiation_expression"
"type": "STRING",
"value": "new"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_expression"
},
{
"type": "BLANK"
}
]
"type": "SYMBOL",
"name": "_expression"
},
{
"type": "CHOICE",
Expand Down Expand Up @@ -1970,6 +1958,10 @@
"type": "STRING",
"value": "downcast"
},
{
"type": "STRING",
"value": "new"
},
{
"type": "SYMBOL",
"name": "prefix_op"
Expand Down Expand Up @@ -2450,23 +2442,6 @@
]
}
},
"object_instantiation_expression": {
"type": "PREC",
"value": 24,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "new"
},
{
"type": "SYMBOL",
"name": "_type"
}
]
}
},
"mutate_expression": {
"type": "PREC_RIGHT",
"value": 16,
Expand Down
19 changes: 0 additions & 19 deletions fsharp/src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
"type": "null",
"named": false
},
{
"type": "object_instantiation_expression",
"named": true
},
{
"type": "paren_expression",
"named": true
Expand Down Expand Up @@ -2523,21 +2519,6 @@
]
}
},
{
"type": "object_instantiation_expression",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "_type",
"named": true
}
]
}
},
{
"type": "optional_pattern",
"named": true,
Expand Down
Loading

0 comments on commit 862fbd8

Please sign in to comment.