private void error(int kind, String arg) { StringBuilder out = new StringBuilder(); String origin = this.input.origin; int errPos = input.positionOfMark(); // note use of source adjusted position int ln = input.getLnNum(errPos); int col = input.getColPos(errPos); String msg = (ContextStatics.useVerboseErrors ? "[Compiler] Error #" + kind + ": " : "") + ctx.errorString(kind); if (debug) { msg = "[Scanner] " + msg; } int nextLoc = Context.replaceStringArg(out, msg, 0, arg); if (nextLoc != -1) // append msg remainder after replacement point, if any out.append(msg.substring(nextLoc, msg.length())); ctx.localizedError(origin, ln, col, out.toString(), input.getLineText(errPos), kind); skiperror(kind); }
private void error(String msg) { ctx.internalError(msg); error(kError_Lexical_General, msg); }
public Scanner(Context cx, String in, String origin, boolean save_comments) { init(cx, save_comments); this.input = new InputBuffer(in, origin); cx.input = this.input; // FIXME: how nicely external state altering. }
/** * This contructor is used by Flex direct AST generation. It allows Flex to pass in a specialized * InputBuffer. */ public Scanner(Context cx, InputBuffer input) { init(cx, true); this.input = input; cx.input = input; // so now we get to look around to find out who does this... }
public Scanner( Context cx, InputStream in, String encoding, String origin, boolean save_comments) { init(cx, save_comments); this.input = new InputBuffer(in, encoding, origin); cx.input = this.input; }