module /** */ import { ParsingState } from "../state" ; import { ResultKind } from "../result" ; import { ParjserBase } from "../parser" ; import { Parjser } from "../parjser" ; param result export function eof < T > ( result ? ) { return new class Eof extends ParjserBase { type = "eof" ; expecting = "expecting end of input" ; _apply ( ps ) { if ( ps . position === ps . input . length ) { ps . kind = ResultKind . Ok ; ps . value = result ; } else { ps . kind = ResultKind . SoftFail ; } } } ( ) as any ; }