@@ -67,7 +67,7 @@ export class Parser {
6767 }
6868 async parse ( source : string ) : Promise < Dictionary > {
6969 const heads = [ ...source . matchAll ( HEADS ) ] . map ( ( match ) => match . index ) ;
70- const regionIndices = [ ...new Array ( this . #workers. length ) . keys ( ) ]
70+ const regionPositions = [ ...new Array ( this . #workers. length ) . keys ( ) ]
7171 . map ( ( index ) => {
7272 const start = index * source . length / this . #workers. length ;
7373 for ( const head of heads ) {
@@ -77,10 +77,10 @@ export class Parser {
7777 }
7878 return source . length ;
7979 } ) ;
80- const jobs = regionIndices . map ( ( index , i ) => ( {
81- index : index ,
80+ const jobs = regionPositions . map ( ( position , i ) => ( {
81+ position ,
8282 job : this . #workers[ i ] . parse (
83- source . slice ( index , regionIndices [ i + 1 ] ?? source . length ) ,
83+ source . slice ( position , regionPositions [ i + 1 ] ?? source . length ) ,
8484 ) ,
8585 } ) ) ;
8686 const dictionary : Dictionary = new Map ( ) ;
@@ -99,7 +99,7 @@ export class Parser {
9999 errors . push (
100100 new PositionedError ( resultError . message , {
101101 position : {
102- position : job . index + resultError . position . position ,
102+ position : job . position + resultError . position . position ,
103103 length : resultError . position . length ,
104104 } ,
105105 cause : resultError ,
0 commit comments