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); }