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 11import { assertGreater } from "@std/assert/greater" ;
22import { MemoizationCacheResult , memoize } from "@std/cache/memoize" ;
33import { ArrayResult , ArrayResultError } from "../array_result.ts" ;
4+ import { assert } from "@std/assert/assert" ;
5+ import { assertNotEquals } from "@std/assert/not-equals" ;
46
57type ParserResult < T > = ArrayResult < Readonly < { value : T ; length : number } > > ;
68type InnerParser < T > = ( input : number ) => ParserResult < T > ;
@@ -226,13 +228,13 @@ function generateError(
226228 length = 0 ;
227229 } else {
228230 const sourceString = currentSource . slice ( position ) ;
229- const [ token ] = sourceString . match ( / \S * / ) ! ;
231+ const [ token ] = sourceString . match ( / ^ \S * / ) ! ;
230232 if ( token === "" ) {
231233 if ( / ^ \r ? \n / . test ( sourceString ) ) {
232234 source = "newline" ;
233235 length = 0 ;
234236 } else {
235- const [ token ] = sourceString . match ( / \s + ?(? = \r ? \n | $ ) / ) ! ;
237+ const [ token ] = sourceString . match ( / ^ \s + ?(? = \S | \r ? \n | $ ) / ) ! ;
236238 source = "space" ;
237239 length = token . length ;
238240 }
You can’t perform that action at this time.
0 commit comments