@@ -1368,18 +1368,28 @@ define method make-hash-literal
1368
1368
let start-delimiter = delimiter;
1369
1369
let end-delimiter
1370
1370
= as (<integer> , $hash-data-end-delimiters[delimiter-index]);
1371
- let i :: <integer> = data-start + 1 ;
1372
- let char :: <integer> = 0 ;
1373
- while (((char := contents[i]) ~== end-delimiter)
1374
- | (char == end-delimiter & contents[i - 1 ] == $escape-code))
1375
- if (char == $newline-code)
1376
- lexer.line := lexer.line + 1 ;
1377
- lexer.line-start := i;
1371
+ iterate loop (i = data-start + 1 , prev-char = 0 )
1372
+ if (i >= length)
1373
+ note(<unterminated-parser-expansion>,
1374
+ source-location:
1375
+ record-position-as-location
1376
+ (source-location.source-location-record,
1377
+ source-location.source-location-source-position),
1378
+ token-string: extract-string(source-location));
1379
+ else
1380
+ let char :: <integer> = contents[i];
1381
+ if (char == end-delimiter & (prev-char ~== $escape-code))
1382
+ data := extract-string(source-location, start: data-start + 1 , end: i);
1383
+ lexer.posn := i + 1 ;
1384
+ else
1385
+ if (char == $newline-code)
1386
+ lexer.line := lexer.line + 1 ;
1387
+ lexer.line-start := i;
1388
+ end ;
1389
+ loop(i + 1 , char);
1390
+ end ;
1378
1391
end ;
1379
- i := i + 1 ;
1380
- end ;
1381
- data := extract-string(source-location, start: data-start + 1 , end: i);
1382
- lexer.posn := i + 1 ;
1392
+ end iterate;
1383
1393
else
1384
1394
// Read until whitespace or EOF
1385
1395
let i :: <integer> = data-start;
0 commit comments