UNPKG

@thi.ng/parse

Version:

Purely functional parser combinators & AST generation for generic inputs

14 lines (13 loc) 259 B
const skipWhile = (pred) => (ctx) => { const state = ctx.state.copy(); const reader = ctx.reader; while (!state.done) { if (!pred(reader.read(state))) break; reader.next(state); } ctx.state = state; return true; }; export { skipWhile };