internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err) { int at = ctxt.getAt(); string src = ctxt.getSource(); int mlen = pp.Match(src, at, src.Length); if (mlen < 0) { return Scanners.setErrorExpecting(out err, expected_name, ctxt); } ctxt.next(mlen); return true; }
internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err) { int at = ctxt.getAt(); string src = ctxt.getSource(); int mlen = pp.Match(src, at, src.Length); if (mlen < 0) { return(Scanners.setErrorExpecting(out err, expected_name, ctxt)); } ctxt.next(mlen); return(true); }
internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err) { int from = ctxt.getAt(); if (!outer_scanner.parse(ctxt, ref result, ref err)) { return(false); } ScannerState inner_ctxt = new ScannerState(ctxt.getSource(), from, module, ctxt.getPositionMap(), ctxt.getAt() - from); return(ParserChores.cont(ctxt, inner_ctxt, nested, ref result, ref err)); }
internal override bool apply(ParseContext ctxt, ref Tok result, ref AbstractParsecError err) { int original_step = ctxt.getStep(); int original_at = ctxt.getAt(); S tmp = default(S); if (!scanner.parse(ctxt, ref tmp, ref err)) { return(false); } int cur = ctxt.getAt(); int len = cur - original_at; object tok = tn(ctxt.getSource(), original_at, len); //The java version uses null to indicate a failure. It doesn't not seem to be used though. So we keep it simple. result = new Tok(original_at, len, tok); ctxt.setStep(original_step + 1); return(true); }
internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err) { int from = ctxt.getAt(); if (!outer_scanner.parse(ctxt, ref result, ref err)) return false; ScannerState inner_ctxt = new ScannerState(ctxt.getSource(), from, module, ctxt.getPositionMap(), ctxt.getAt() - from); return ParserChores.cont(ctxt, inner_ctxt, nested, ref result, ref err); }