/** * Returns the current line number within this Source. */ public int getLine() { Source parent = getParent(); if (parent == null) return 0; return parent.getLine(); }
/** * Returns the current line number within this Source. */ @Nonnegative public int getLine() { Source parent = getParent(); if (parent == null) return 0; return parent.getLine(); }
/** * Returns the current line number within this Source. */ public int getLine() { Source parent = getParent(); if (parent == null) return 0; return parent.getLine(); }
@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");
/** * 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; }
/** * 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; }