module /** */ import { ParjsCombinator , Parjser , ParjsProjection } from "../parjser" ; import { ParjserBase } from "../parser" ; import { defineCombinator } from "./combinator" ; import { ParsingState } from "../state" ; import { ImplicitParjser } from "../scalar-converter" ; param selector export function thenPick < A , B > ( selector ) { return defineCombinator ( source => { return new class ThenPick extends ParjserBase { expecting = source . expecting ; type = "then-pick" ; _apply ( ps ) { source . apply ( ps ) ; if ( ! ps . isOk ) { return ; } let firstVal = ps . value ; let nextParser = selector ( ps . value , ps . userState ) as ParjserBase ; nextParser . apply ( ps ) ; if ( ps . isOk ) { return ; } if ( ps . isSoft ) { ps . kind = "Hard" ; } } } ( ) ; } ) ; }