/** * Returns the human-readable name of the current Source. */ @CheckForNull public String getName() { Source parent = getParent(); if (parent != null) return parent.getName(); return null; }
/** * Returns the human-readable name of the current Source. */ /* pp */ String getName() { Source parent = getParent(); if (parent != null) return parent.getName(); return null; }
/** * Returns the human-readable name of the current Source. */ /* pp */ String getName() { Source parent = getParent(); if (parent != null) return parent.getName(); return null; }
/** * Handles an error. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ public void handleError(Source source, int line, int column, String msg) throws LexerException { errors++; print(source.getName() + ":" + line + ":" + column + ": error: " + msg); }
/** * Handles a warning. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ public void handleWarning(Source source, int line, int column, String msg) throws LexerException { warnings++; print(source.getName() + ":" + line + ":" + column + ": warning: " + msg); }
/** * Handles a warning. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ public void handleWarning(Source source, int line, int column, String msg) throws LexerException { warnings++; print(source.getName() + ":" + line + ":" + column + ": warning: " + msg); }
/** * Handles a warning. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ @Override public void handleWarning(Source source, int line, int column, String msg) throws LexerException { warnings++; print(source.getName() + ":" + line + ":" + column + ": warning: " + msg); }
/** * Handles an error. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ public void handleError(Source source, int line, int column, String msg) throws LexerException { errors++; print(source.getName() + ":" + line + ":" + column + ": error: " + msg); }
/** * Handles an error. * * The behaviour of this method is defined by the * implementation. It may simply record the error message, or * it may throw an exception. */ @Override public void handleError(Source source, int line, int column, String msg) throws LexerException { errors++; print(source.getName() + ":" + line + ":" + column + ": error: " + msg); }
@Nonnull private Token next_source() { if (inputs.isEmpty()) return new Token(EOF); Source s = inputs.remove(0); push_source(s, true); return line_token(s.getLine(), s.getName(), " 1"); }
return line_token(t.getLine(), t.getName(), " 2");
String name = getSource().getName(); if (name == null) name = "<no file>";
return line_token(1, source.getName(), " 1"); return tok; } finally {
/** * Returns an NL or an EOF token. * * The metadata on the token will be correct, which is better * than generating a new one. * * This method can, as of recent patches, return a P_LINE token. */ private Token source_skipline(boolean white) throws IOException, LexerException { // (new Exception("skipping line")).printStackTrace(System.out); Source s = getSource(); Token tok = s.skipline(white); /* XXX Refactor with source_token() */ if (tok.getType() == EOF && s.isAutopop()) { // System.out.println("Autopop " + s); pop_source(); Source t = getSource(); if (getFeature(Feature.LINEMARKERS) && s.isNumbered() && t != null) { /* We actually want 'did the nested source * contain a newline token', which isNumbered() * approximates. This is not perfect, but works. */ return line_token(t.getLine() + 1, t.getName(), " 2"); } } return tok; }
} else if (m == __FILE__) { StringBuilder buf = new StringBuilder("\""); String name = getSource().getName(); if (name == null) name = "<no file>";
/** * Returns an NL or an EOF token. * * The metadata on the token will be correct, which is better * than generating a new one. * * This method can, as of recent patches, return a P_LINE token. */ private Token source_skipline(boolean white) throws IOException, LexerException { // (new Exception("skipping line")).printStackTrace(System.out); Source s = getSource(); Token tok = s.skipline(white); /* XXX Refactor with source_token() */ if (tok.getType() == EOF && s.isAutopop()) { // System.out.println("Autopop " + s); pop_source(); Source t = getSource(); if (getFeature(Feature.LINEMARKERS) && s.isNumbered() && t != null) { /* We actually want 'did the nested source * contain a newline token', which isNumbered() * approximates. This is not perfect, but works. */ return line_token(t.getLine() + 1, t.getName(), " 2"); } } return tok; }
return line_token(1, source.getName(), " 1"); return tok;
return line_token(1, source.getName(), " 1"); return tok;