fix call expression

pull/625/head^2
Nikolaj Sidorenco 2024-03-31 22:06:41 +07:00
parent 7976f4404a
commit 434a7ec7f0
No known key found for this signature in database
8 changed files with 230596 additions and 230576 deletions

@ -1,3 +1,2 @@
do
(+) 1
2
A.Fun()

@ -1 +1,3 @@
type Test = Red = 1
type T =
{ A: int
B: int }

@ -432,10 +432,10 @@ module.exports = grammar({
),
call_expression: $ =>
prec.right(PREC.PAREN_APP + 100,
prec.left(PREC.PAREN_APP + 100,
seq(
$._expression,
imm("("),
imm(prec(10000, "(")),
optional($._expression),
")",
)
@ -1253,17 +1253,24 @@ module.exports = grammar({
seq(
$.type_name,
"=",
$._indent,
"{",
$._indent,
$.record_fields,
$._dedent,
"}",
optional($.type_extension_elements),
$._dedent
)),
record_fields: $ =>
seq(
$.record_field,
repeat($.record_field),
optional(";"),
repeat(
seq(
choice(";", $._newline),
$.record_field)
)
),
record_field: $ =>

60
src/grammar.json generated

@ -1457,7 +1457,7 @@
}
},
"call_expression": {
"type": "PREC_RIGHT",
"type": "PREC_LEFT",
"value": 121,
"content": {
"type": "SEQ",
@ -1469,8 +1469,12 @@
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "("
"type": "PREC",
"value": 10000,
"content": {
"type": "STRING",
"value": "("
}
}
},
{
@ -4405,14 +4409,26 @@
"type": "STRING",
"value": "="
},
{
"type": "SYMBOL",
"name": "_indent"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "_indent"
},
{
"type": "SYMBOL",
"name": "record_fields"
},
{
"type": "SYMBOL",
"name": "_dedent"
},
{
"type": "STRING",
"value": "}"
@ -4428,6 +4444,10 @@
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_dedent"
}
]
}
@ -4442,21 +4462,27 @@
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "record_field"
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ";"
},
{
"type": "SYMBOL",
"name": "_newline"
}
]
},
{
"type": "SYMBOL",
"name": "record_field"
}
]
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ";"
},
{
"type": "BLANK"
}
]
}
]
},

@ -3843,11 +3843,11 @@
},
{
"type": "unit",
"named": true
"named": false
},
{
"type": "unit",
"named": false
"named": true
},
{
"type": "unmanaged",

461076
src/parser.c generated

File diff suppressed because it is too large Load Diff

@ -160,6 +160,12 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer,
return true;
}
if (found_bracket_end && valid_symbols[DEDENT]) {
array_pop(&scanner->indents);
lexer->result_symbol = DEDENT;
return true;
}
if (found_end_of_line) {
if ((valid_symbols[DEDENT] || (!valid_symbols[NEWLINE])) &&
indent_length < current_indent_length) {

@ -1,6 +1,6 @@
================================================================================
function definition on same line should end scope
:skip
================================================================================
let f x = x + 1
@ -9,6 +9,7 @@ let f x = x + 1
================================================================================
function definition on new line should open scope
:skip
================================================================================
let f x =
@ -19,6 +20,7 @@ let f x =
================================================================================
function definition aligned to first line should scope correctly
:skip
================================================================================
let f x = x + 1