@@ -55,7 +55,7 @@ RscGrammar preprocess(RscGrammar rsc) {
55
55
// Replace occurrences of singleton ranges with just the corresponding
56
56
// literal. This makes it easier to identify delimiters.
57
57
return visit (rsc ) {
58
- case s : \char -class ([range (char , char )]) => d
58
+ case \char -class ([range (char , char )]) => d
59
59
when d := \lit ("<stringChar (char )> " ), isDelimiter (d )
60
60
}
61
61
}
@@ -132,13 +132,14 @@ list[ConversionUnit] analyze(RscGrammar rsc) {
132
132
list [Production ] prodsKeywords = [prod (lex (KEYWORDS_PRODUCTION_NAME ), [\alt (keywords )], {\tag ("category" ("keyword.control" ))})];
133
133
134
134
// 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 )};
142
143
return sort ([*removeStrictPrefixes (units )]);
143
144
}
144
145
0 commit comments