/** * Returns the next preprocessor token. * * @see Token * @throws LexerException if a preprocessing error occurs. * @throws InternalException if an unexpected error condition arises. */ public Token token() throws IOException, LexerException { Token tok = _token(); if (getFeature(Feature.DEBUG)) System.err.println("pp: Returning " + tok); return tok; }
/** * Returns the next preprocessor token. * * @see Token * @throws LexerException if a preprocessing error occurs. * @throws InternalException if an unexpected error condition arises. */ public Token token() throws IOException, LexerException { Token tok = _token(); if (getFeature(Feature.DEBUG)) System.err.println("pp: Returning " + tok); return tok; }
/** * Returns the next preprocessor token. * * @see Token * @return The next fully preprocessed token. * @throws IOException if an I/O error occurs. * @throws LexerException if a preprocessing error occurs. * @throws InternalException if an unexpected error condition arises. */ @Nonnull public Token token() throws IOException, LexerException { Token tok = _token(); if (getFeature(Feature.DEBUG)) LOG.debug("pp: Returning " + tok); return tok; }
@Override /* pp */ void init(Preprocessor pp) { super.init(pp); this.digraphs = pp.getFeature(Feature.DIGRAPHS); this.reader.init(pp, this); }
@Override /* pp */ void init(Preprocessor pp) { super.init(pp); this.digraphs = pp.getFeature(Feature.DIGRAPHS); this.reader.init(pp, this); }
@Override /* pp */ void init(Preprocessor pp) { super.init(pp); this.digraphs = pp.getFeature(Feature.DIGRAPHS); this.reader.init(pp, this); }
protected void pragma(@Nonnull Token name, @Nonnull List<Token> value) throws IOException, LexerException { if (getFeature(Feature.PRAGMA_ONCE)) { if ("once".equals(name.getText())) { pragma_once(name); return; } } warning(name, "Unknown #" + "pragma: " + name.getText()); }
/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. * * @param file The VirtualFile to attempt to include. * @return true if the file was successfully included, false otherwise. * @throws IOException if an I/O error occurs. */ protected boolean include(@Nonnull VirtualFile file) throws IOException { // System.out.println("Try to include " + ((File)file).getAbsolutePath()); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) LOG.debug("pp: including " + file); includes.add(file); push_source(file.getSource(), true); return true; }
/* pp */ void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
/* pp */ void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. */ protected boolean include(VirtualFile file) throws IOException, LexerException { // System.out.println("Try to include " + file); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) System.err.println("pp: including " + file); push_source(file.getSource(), true); return true; }
/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. */ protected boolean include(VirtualFile file) throws IOException, LexerException { // System.out.println("Try to include " + file); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) System.err.println("pp: including " + file); push_source(file.getSource(), true); return true; }
case CCOMMENT: case CPPCOMMENT: if (!cpp.getFeature(Feature.KEEPCOMMENTS)) { token = " "; break;
case CCOMMENT: case CPPCOMMENT: if (!cpp.getFeature(Feature.KEEPCOMMENTS)) { token = " "; break;
case CCOMMENT: case CPPCOMMENT: if (!cpp.getFeature(Feature.KEEPCOMMENTS)) { token = " "; break;
/* pp */ void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
Token tok = source_token; source_token = null; if (getFeature(Feature.DEBUG)) LOG.debug("Returning unget token " + tok); return tok; if (s == null) { Token t = next_source(); if (t.getType() == P_LINE && !getFeature(Feature.LINEMARKERS)) continue; return t; continue; if (getFeature(Feature.DEBUG)) LOG.debug("Returning fresh token " + tok); return tok;
if (getFeature(Feature.LINEMARKERS) && s.isNumbered() && t != null) {
/** * 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; }