Skip to content

Commit

Permalink
Add support for recursive enums
Browse files Browse the repository at this point in the history
The keyword `indirect` is legal on an enum class declaration or on an
individual case, and tells the compiler to use the heap to avoid an
infinitely sized structure. Add the keyword directly into those places
where it is legal.
  • Loading branch information
alex-pinkus committed Nov 28, 2021
1 parent 0ce5a77 commit fa831a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ module.exports = grammar({
$.class_body
),
seq(
optional("indirect"),
"enum",
alias($.simple_identifier, $.type_identifier),
optional($.type_parameters),
Expand Down Expand Up @@ -1288,6 +1289,7 @@ module.exports = grammar({
prec.left(
seq(
optional($.modifiers),
optional("indirect"),
"case",
sep1(
seq(
Expand Down

0 comments on commit fa831a7

Please sign in to comment.