Skip to content

Commit

Permalink
qualifiers: Make qualifiers simple repeats
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Sep 16, 2024
1 parent 0e3e3bc commit 905ffe2
Show file tree
Hide file tree
Showing 4 changed files with 4,040 additions and 3,196 deletions.
6 changes: 4 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ module.exports = grammar({
import_path: $ => seq(field("bit", $.identifier), optional(seq(".", field("rest", $.import_path)))),
import_relative_dot: _ => ".",

qualifier: _ => choice("extern", "pure"),
qualifier_list: $ => choice($.qualifier, seq($.qualifier, $.qualifier_list)),
qualifier: _ => choice("static", "pure"),
qualifier_list: $ => repeat1($.qualifier),

function_declaration: $ =>
prec(
Expand All @@ -83,6 +83,7 @@ module.exports = grammar({
proto: $ =>
prec.right(
seq(
field("qualifiers", optional($.qualifier_list)),
"proto",
field("name", choice($.identifier, $.overloadable_operator)),
optional(seq("(", optional(field("params", $.param_list)), ")")),
Expand Down Expand Up @@ -139,6 +140,7 @@ module.exports = grammar({

var_decl: $ =>
seq(
field("qualifiers", optional($.qualifier_list)),
"let",
field("name", $.identifier),
optional(seq(":", field("type", $.type))),
Expand Down
59 changes: 38 additions & 21 deletions src/grammar.json

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

32 changes: 24 additions & 8 deletions src/node-types.json

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

Loading

0 comments on commit 905ffe2

Please sign in to comment.