internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err) { if (ctxt.isEof()) { return Scanners.setErrorExpecting(out err, expected_name, ctxt); } ctxt.next(); 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) { if (!open.parse(ctxt, ref result, ref err)) { return false; } for (int level = 1; level > 0; ) { int at = ctxt.getAt(); if (close.parse(ctxt, ref result, ref err)) { if (at == ctxt.getAt()) { throw new IllegalParserStateException("closing comment scanner not consuming input."); } level--; continue; } if (at != ctxt.getAt()) { return false; } if (open.parse(ctxt, ref result, ref err)) { if (at == ctxt.getAt()) throw new IllegalParserStateException("opening comment scanner not consuming input."); level++; continue; } if (at != ctxt.getAt()) { return false; } if (commented.parse(ctxt, ref result, ref err)) { if (at == ctxt.getAt()) throw new IllegalParserStateException("commented scanner not consuming input."); continue; } return false; } return true; }
private static bool setErrorExpecting(out AbstractParsecError err, string msg, ParseContext ctxt) { err = ParserChores.raiseExpecting(msg, ctxt); return false; }
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); }