File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { assertGreater } from "@std/assert/greater" ;
2
2
import { MemoizationCacheResult , memoize } from "@std/cache/memoize" ;
3
3
import { ArrayResult , ArrayResultError } from "../array_result.ts" ;
4
+ import { assert } from "@std/assert/assert" ;
5
+ import { assertNotEquals } from "@std/assert/not-equals" ;
4
6
5
7
type ParserResult < T > = ArrayResult < Readonly < { value : T ; length : number } > > ;
6
8
type InnerParser < T > = ( input : number ) => ParserResult < T > ;
@@ -226,13 +228,13 @@ function generateError(
226
228
length = 0 ;
227
229
} else {
228
230
const sourceString = currentSource . slice ( position ) ;
229
- const [ token ] = sourceString . match ( / \S * / ) ! ;
231
+ const [ token ] = sourceString . match ( / ^ \S * / ) ! ;
230
232
if ( token === "" ) {
231
233
if ( / ^ \r ? \n / . test ( sourceString ) ) {
232
234
source = "newline" ;
233
235
length = 0 ;
234
236
} else {
235
- const [ token ] = sourceString . match ( / \s + ?(? = \r ? \n | $ ) / ) ! ;
237
+ const [ token ] = sourceString . match ( / ^ \s + ?(? = \S | \r ? \n | $ ) / ) ! ;
236
238
source = "space" ;
237
239
length = token . length ;
238
240
}
You can’t perform that action at this time.
0 commit comments