✨ sync tree-sitter grammar and AST
This commit is contained in:
@@ -98,9 +98,12 @@ module.exports = grammar({
|
||||
$.repeat_statement,
|
||||
$.case_statement,
|
||||
$.try_statement,
|
||||
$.label_statement,
|
||||
$.goto_statement,
|
||||
$.break_statement,
|
||||
$.continue_statement,
|
||||
$.return_statement,
|
||||
$.exit_statement,
|
||||
|
||||
$.block_statement,
|
||||
$.uses_statement,
|
||||
@@ -194,7 +197,7 @@ module.exports = grammar({
|
||||
reference_modifier: (_) => choice(kw("weakref"), kw("autoref")),
|
||||
|
||||
member_variable: ($) =>
|
||||
choice($.static_member_variable, $.field_member_variable),
|
||||
choice($.const_member_variable, $.static_member_variable, $.field_member_variable),
|
||||
|
||||
static_member_variable: ($) =>
|
||||
seq(
|
||||
@@ -204,6 +207,16 @@ module.exports = grammar({
|
||||
optional(seq("=", field("value", $.expression))),
|
||||
),
|
||||
|
||||
const_member_variable: ($) =>
|
||||
seq(
|
||||
optional(kw("static")),
|
||||
kw("const"),
|
||||
field("name", $.identifier),
|
||||
optional($._type_clause),
|
||||
"=",
|
||||
field("value", $.expression),
|
||||
),
|
||||
|
||||
field_member_variable: ($) =>
|
||||
seq(
|
||||
$._identifier_list,
|
||||
@@ -547,8 +560,10 @@ module.exports = grammar({
|
||||
seq(
|
||||
kw("try"),
|
||||
field("try_body", optional($.block_body)),
|
||||
kw("except"),
|
||||
field("except_body", optional($.block_body)),
|
||||
choice(
|
||||
seq(kw("except"), field("except_body", optional($.block_body))),
|
||||
seq(kw("finally"), field("finally_body", optional($.block_body))),
|
||||
),
|
||||
kw("end"),
|
||||
),
|
||||
|
||||
@@ -565,8 +580,19 @@ module.exports = grammar({
|
||||
|
||||
continue_statement: (_) => seq(kw("continue"), kSemicolon),
|
||||
|
||||
label_statement: ($) =>
|
||||
seq(kw("label"), sep1(field("name", $.identifier), ","), kSemicolon),
|
||||
|
||||
goto_statement: ($) =>
|
||||
seq(kw("goto"), field("label", $.identifier), kSemicolon),
|
||||
|
||||
return_statement: ($) =>
|
||||
seq(kw("return"), field("value", optional($.expression)), kSemicolon),
|
||||
choice(
|
||||
seq(kw("return"), field("value", optional($.expression)), kSemicolon),
|
||||
seq(kw("debugreturn"), field("value", $.expression), kSemicolon),
|
||||
),
|
||||
|
||||
exit_statement: (_) => seq(kw("exit"), kSemicolon),
|
||||
|
||||
var_declaration: ($) =>
|
||||
seq(
|
||||
@@ -917,6 +943,7 @@ module.exports = grammar({
|
||||
kw("like"),
|
||||
kw("in"),
|
||||
kw("is"),
|
||||
kw("sqlin"),
|
||||
),
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user