Open krizej opened 2 months ago
notice the missing semicolon:
void() func = { FunctionCall() };
parse result:
(source_file [0, 0] - [3, 2] (function_definition [0, 0] - [3, 2] result: (simple_type [0, 0] - [0, 4]) parameters: (parameter_list [0, 4] - [0, 6]) name: (identifier [0, 7] - [0, 11]) body: (array_literal [1, 0] - [3, 1] (funcall_expression [2, 4] - [2, 18] function: (identifier [2, 4] - [2, 16])))))
the fix is simple:
function_definition: $ => seq( ... choice( $.builtin_literal, field('body', $._statement) // replace _statement with compound_statement ), optional(';') ),
and then you even get an error about the missing semicolon
(source_file [0, 0] - [3, 2] (function_definition [0, 0] - [3, 2] result: (simple_type [0, 0] - [0, 4]) parameters: (parameter_list [0, 4] - [0, 6]) name: (identifier [0, 7] - [0, 11]) body: (compound_statement [1, 0] - [3, 1] (funcall_expression [2, 4] - [2, 18] function: (identifier [2, 4] - [2, 16]))))) test.txt 0.06 ms 579 bytes/ms (MISSING ";" [2, 18] - [2, 18])
however, when the name is too short (below 8 characters) the MISSING ";" error does not appear
MISSING ";"
void() func = { FunCall() };
(source_file [0, 0] - [3, 2] (function_definition [0, 0] - [3, 2] result: (simple_type [0, 0] - [0, 4]) parameters: (parameter_list [0, 4] - [0, 6]) name: (identifier [0, 7] - [0, 11]) body: (compound_statement [1, 0] - [3, 1] (ERROR [2, 4] - [2, 13] (funcall_expression [2, 4] - [2, 13] function: (identifier [2, 4] - [2, 11])))))) test.txt 0.07 ms 448 bytes/ms (ERROR [2, 4] - [2, 13])
i would make a PR for this as it's simple enough but i have no clue what to do about that second error :/
notice the missing semicolon:
parse result:
the fix is simple:
and then you even get an error about the missing semicolon
however, when the name is too short (below 8 characters) the
MISSING ";"
error does not appeari would make a PR for this as it's simple enough but i have no clue what to do about that second error :/