more tests; add function expressions

This commit is contained in:
mhoffm
2021-06-11 23:32:22 +02:00
parent 08ce0c6653
commit 2226687dd7
8 changed files with 2413 additions and 1683 deletions

View File

@@ -58,7 +58,7 @@ module.exports = grammar({
$.literal_value,
$.collection_value,
$.variable_expr,
// $.function_call,
$.function_call,
$.for_expr,
seq($.expr_term, $.index),
seq($.expr_term, $.get_attr),
@@ -154,6 +154,14 @@ module.exports = grammar({
variable_expr: $ => $.identifier,
function_call: $ => seq($.identifier, '(', optional($.function_arguments), ')'),
function_arguments: $ => seq(
$.expression,
repeat(seq(',', $.expression)),
optional(choice(',', '...'))
),
// http://stackoverflow.com/questions/13014947/regex-to-match-a-c-style-multiline-comment/36328890#36328890
comment: $ => token(choice(
seq('#', /.*/),