@@ -55,7 +55,7 @@ RscGrammar preprocess(RscGrammar rsc) {
5555 // Replace occurrences of singleton ranges with just the corresponding
5656 // literal. This makes it easier to identify delimiters.
5757 return visit (rsc ) {
58- case s : \char -class ([range (char , char )]) => d
58+ case \char -class ([range (char , char )]) => d
5959 when d := \lit ("<stringChar (char )> " ), isDelimiter (d )
6060 }
6161}
@@ -132,13 +132,14 @@ list[ConversionUnit] analyze(RscGrammar rsc) {
132132 list [Production ] prodsKeywords = [prod (lex (KEYWORDS_PRODUCTION_NAME ), [\alt (keywords )], {\tag ("category" ("keyword.control" ))})];
133133
134134 // Return
135- bool isEmptyProd (prod (_, [\alt (alternatives )], _)) = alternatives == {};
136- set [ConversionUnit ] units
137- = {unit (rsc , p , false , hasNewline (rsc , p ), getOuterDelimiterPair (rsc , p ), getInnerDelimiterPair (rsc , p , getOnlyFirst = true )) | p <- prodsNonRecursive }
138- + {unit (rsc , p , true , hasNewline (rsc , p ), getOuterDelimiterPair (rsc , p ), getInnerDelimiterPair (rsc , p , getOnlyFirst = true )) | p <- prodsRecursive }
139- + {unit (rsc , p , false , false , <nothing (), nothing ()> , <nothing (), nothing ()> ) | p <- prodsDelimiters , !isEmptyProd (p )}
140- + {unit (rsc , p , false , false , <nothing (), nothing ()> , <nothing (), nothing ()> ) | p <- prodsKeywords , !isEmptyProd (p )};
141-
135+ bool isRecursive (Production p )
136+ = p in prodsRecursive ;
137+ bool isEmptyProd (prod (_, [\alt (alternatives )], _))
138+ = alternatives == {};
139+
140+ set [ConversionUnit ] units = {};
141+ units += {unit (rsc , p , isRecursive (p ), hasNewline (rsc , p ), getOuterDelimiterPair (rsc , p ), getInnerDelimiterPair (rsc , p , getOnlyFirst = true )) | p <- prods };
142+ units += {unit (rsc , p , false , false , <nothing (), nothing ()> , <nothing (), nothing ()> ) | p <- prodsDelimiters + prodsKeywords , !isEmptyProd (p )};
142143 return sort ([*removeStrictPrefixes (units )]);
143144}
144145
0 commit comments