@@ -390,12 +390,11 @@ module.exports = grammar({
390
390
end_block_data_statement : $ => {
391
391
const structType = whiteSpacedKeyword ( 'block' , 'data' , false )
392
392
return prec . right ( seq (
393
- alias ( choice (
394
- seq (
395
- caseInsensitive ( 'end' , false ) ,
396
- optional ( structType ) ) ,
397
- caseInsensitive ( 'end' + structType , false ) ) ,
398
- 'end' + structType ) ,
393
+ choice (
394
+ seq (
395
+ alias ( caseInsensitive ( 'end' , false ) , 'end' ) ,
396
+ optional ( alias ( structType , 'blockdata' ) ) ) ,
397
+ alias ( caseInsensitive ( 'end' + structType , false ) , 'endblockdata' ) ) ,
399
398
optional ( $ . _name ) ,
400
399
$ . _end_of_statement ) )
401
400
} ,
@@ -2259,11 +2258,18 @@ function caseInsensitive (keyword, aliasAsWord = true) {
2259
2258
}
2260
2259
2261
2260
function whiteSpacedKeyword ( prefix , suffix , aliasAsWord = true ) {
2262
- let result = choice (
2263
- seq ( caseInsensitive ( prefix , false ) , caseInsensitive ( suffix , false ) ) ,
2264
- caseInsensitive ( prefix + suffix , false ) )
2265
- if ( aliasAsWord ) result = alias ( result , prefix + suffix )
2266
- return result
2261
+ let prefix_bit = caseInsensitive ( prefix , false )
2262
+ let suffix_bit = caseInsensitive ( suffix , false )
2263
+ let both_bits = caseInsensitive ( prefix + suffix , false )
2264
+ if ( aliasAsWord ) {
2265
+ prefix_bit = alias ( prefix_bit , prefix )
2266
+ suffix_bit = alias ( suffix_bit , suffix )
2267
+ both_bits = alias ( both_bits , prefix + suffix )
2268
+ }
2269
+ return choice (
2270
+ seq ( prefix_bit , suffix_bit ) ,
2271
+ both_bits
2272
+ )
2267
2273
}
2268
2274
2269
2275
function commaSep ( rule ) {
@@ -2281,12 +2287,11 @@ function sep1 (rule, separator) {
2281
2287
// This can be merged with whiteSpacedKeyword, keeping for now.
2282
2288
function blockStructureEnding ( $ , structType ) {
2283
2289
const obj = prec . right ( seq (
2284
- alias ( choice (
2290
+ choice (
2285
2291
seq (
2286
- caseInsensitive ( 'end' , false ) ,
2287
- optional ( caseInsensitive ( structType , false ) ) ) ,
2288
- caseInsensitive ( 'end' + structType , false ) ) ,
2289
- 'end' + structType ) ,
2292
+ alias ( caseInsensitive ( 'end' , false ) , 'end' ) ,
2293
+ optional ( alias ( caseInsensitive ( structType , false ) , structType ) ) ) ,
2294
+ alias ( caseInsensitive ( 'end' + structType , false ) , 'end' + structType ) ) ,
2290
2295
optional ( $ . _name ) ,
2291
2296
$ . _end_of_statement
2292
2297
) )
0 commit comments