1 4 package jfun.parsec; 5 6 final class EofParser extends Parser<Object > { 7 private final String msg; 8 9 EofParser(String n, String msg) { 10 super(n); 11 this.msg = msg; 12 } 13 14 boolean apply(final ParseContext ctxt) { 15 if (ctxt.isEof()) 16 return true; 17 else { 18 final AbstractParsecError expecting = ParserInternals.errExpecting(msg, ctxt); 19 final AbstractParsecError unexpected = ctxt.getSysUnexpected(); 20 ctxt.setError(AbstractParsecError.mergeError(expecting, unexpected)); 21 return false; 22 } 23 } 24 } | Popular Tags |