重构语法树/符号表
This commit is contained in:
@@ -99,8 +99,9 @@ module.exports = grammar({
|
||||
$.try_statement,
|
||||
|
||||
$.anonymous_function_statement,
|
||||
$.function_declaration_statement,
|
||||
// $.function_declaration_statement,
|
||||
$.function_definition_statement,
|
||||
$.function_definition_statement_with_overload,
|
||||
$.class_definition_statement,
|
||||
$.external_method_statement,
|
||||
|
||||
@@ -1113,14 +1114,14 @@ module.exports = grammar({
|
||||
anonymous_function_statement: ($) =>
|
||||
seq($.anonymous_function_expression, optional(kSemicolon)),
|
||||
|
||||
function_declaration_statement: ($) =>
|
||||
seq(
|
||||
kw("function"),
|
||||
field("name", $.identifier),
|
||||
$._parameter_signature,
|
||||
optional(field("return_type", $._type_clause)),
|
||||
kSemicolon,
|
||||
),
|
||||
// function_declaration_statement: ($) =>
|
||||
// seq(
|
||||
// kw("function"),
|
||||
// field("name", $.identifier),
|
||||
// $._parameter_signature,
|
||||
// optional(field("return_type", $._type_clause)),
|
||||
// kSemicolon,
|
||||
// ),
|
||||
|
||||
function_definition_statement: ($) =>
|
||||
seq(
|
||||
@@ -1133,6 +1134,19 @@ module.exports = grammar({
|
||||
optional(kSemicolon),
|
||||
),
|
||||
|
||||
function_definition_statement_with_overload: ($) =>
|
||||
seq(
|
||||
kw("function"),
|
||||
field("name", $.identifier),
|
||||
$._parameter_signature,
|
||||
field("return_type", optional($._type_clause)),
|
||||
kSemicolon,
|
||||
kw("overload"),
|
||||
kSemicolon,
|
||||
field("body", $.block_statement),
|
||||
optional(kSemicolon),
|
||||
),
|
||||
|
||||
_parameter_signature: ($) =>
|
||||
seq("(", optional(field("parameters", $.parameter_list)), ")"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user