From fa831a7ecbac1fd6142cfce1c7b65f9f78828e92 Mon Sep 17 00:00:00 2001 From: Alex Pinkus Date: Sun, 28 Nov 2021 14:48:42 -0800 Subject: [PATCH] Add support for recursive enums 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. --- grammar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grammar.js b/grammar.js index b05d97c..b2ff3a2 100644 --- a/grammar.js +++ b/grammar.js @@ -1181,6 +1181,7 @@ module.exports = grammar({ $.class_body ), seq( + optional("indirect"), "enum", alias($.simple_identifier, $.type_identifier), optional($.type_parameters), @@ -1288,6 +1289,7 @@ module.exports = grammar({ prec.left( seq( optional($.modifiers), + optional("indirect"), "case", sep1( seq(