Skip to content

Commit

Permalink
make statement public node
Browse files Browse the repository at this point in the history
  • Loading branch information
JoranHonig committed Jun 12, 2024
1 parent 1c94fe3 commit 167ed4b
Show file tree
Hide file tree
Showing 10 changed files with 23,544 additions and 23,528 deletions.
16 changes: 8 additions & 8 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ module.exports = grammar({
any_source_type: $ => '*',

// -- [ Statements ] --
_statement: $ => choice(
statement: $ => choice(
$.block_statement,
$.expression_statement,
$.variable_declaration_statement,
Expand Down Expand Up @@ -497,7 +497,7 @@ module.exports = grammar({
block_statement: $ => seq(
optional($.unchecked),
'{',
repeat($._statement),
repeat($.statement),
"}"
),
variable_declaration_statement: $ => prec(1,seq(
Expand Down Expand Up @@ -533,12 +533,12 @@ module.exports = grammar({
'if', '(',
field("condition", $.expression),
')',
field("body", $._statement),
field("body", $.statement),
field("else",
optional(
seq(
'else',
field("body", $._statement)
field("body", $.statement)
))
),
)),
Expand All @@ -548,14 +548,14 @@ module.exports = grammar({
field("initial", choice($.variable_declaration_statement, $.expression_statement, $._semicolon)),
field("condition", choice($.expression_statement, $._semicolon)),
field("update", optional($.expression)),
')', field("body", $._statement),
')', field("body", $.statement),
),

while_statement: $ => seq(
'while', '(',field("condition", $.expression), ')', field("body", $._statement),
'while', '(',field("condition", $.expression), ')', field("body", $.statement),
),
do_while_statement: $ => seq(
'do', field("body", $._statement), 'while', '(', field("condition", $.expression), ')', $._semicolon,
'do', field("body", $.statement), 'while', '(', field("condition", $.expression), ')', $._semicolon,
),
continue_statement: $ => seq('continue', $._semicolon),
break_statement: $ => seq('break', $._semicolon),
Expand Down Expand Up @@ -722,7 +722,7 @@ module.exports = grammar({

function_body: $ => seq(
"{",
repeat($._statement),
repeat($.statement),
"}",
),

Expand Down
16 changes: 8 additions & 8 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 167ed4b

Please sign in to comment.