internal void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
/* LineNumberReader */ /* * // We can't do this, since we would lose the LexerException * private class Itr implements Iterator { * private Token next = null; * private void advance() { * try { * if (next != null) * next = token(); * } * catch (IOException e) { * throw new UnsupportedOperationException( * "Failed to advance token iterator: " + * e.getMessage() * ); * } * } * public boolean hasNext() { * return next.getType() != EOF; * } * public Token next() { * advance(); * Token t = next; * next = null; * return t; * } * public void remove() { * throw new UnsupportedOperationException( * "Cannot remove tokens from a Source." * ); * } * } */ public Source() { this.parent = null; this.autopop = false; this.listener = null; this.active = true; this.werror = false; }
/** * Sets the PreprocessorListener which handles events for * this Preprocessor. * * The listener is notified of warnings, errors and source * changes, amongst other things. */ public void setListener(PreprocessorListener listener) { this.listener = listener; Source s = source; while (s != null) { // s.setListener(listener); s.init(this); s = s.getParent(); } }
public Preprocessor() { this.inputs = new List<Source>(); this.macros = new Dictionary<String,Macro>(); macros.Add(__LINE__.getName(), __LINE__); macros.Add(__FILE__.getName(), __FILE__); macros.Add(__COUNTER__.getName(), __COUNTER__); this.states = new Stack<State>(); states.Push(new State()); this.source = null; this.counter = 0; this.quoteincludepath = new List<String>(); this.sysincludepath = new List<String>(); this.frameworkspath = new List<String>(); this.features = Feature.NONE; this.warnings = Warning.NONE; this.filesystem = new JavaFileSystem(); this.listener = null; }
/** * Sets the listener for this Source. * * Normally this is set by the Preprocessor when a Source is * used, but if you are using a Source as a standalone object, * you may wish to call this. */ public void setListener(PreprocessorListener pl) { this.listener = pl; }