org.anarres.cpp
Class Source

java.lang.Object
  extended by org.anarres.cpp.Source
All Implemented Interfaces:
Iterable<Token>
Direct Known Subclasses:
LexerSource

public abstract class Source
extends Object
implements Iterable<Token>

An input to the Preprocessor. Inputs may come from Files, Strings or other sources. The preprocessor maintains a stack of Sources. Operations such as file inclusion or token pasting will push a new source onto the Preprocessor stack. Sources pop from the stack when they are exhausted; this may be transparent or explicit. BUG: Error messages are not handled properly.


Constructor Summary
Source()
           
 
Method Summary
protected  void error(ErrorMessage msg)
           
 Iterator<Token> iterator()
           
 Token skipline(boolean white)
          Skips tokens until the end of line.
abstract  Token token()
          Returns the next Token parsed from this input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Source

public Source()
Method Detail

token

public abstract Token token()
                     throws IOException,
                            LexerException
Returns the next Token parsed from this input stream.

Throws:
IOException
LexerException
See Also:
Token

iterator

public Iterator<Token> iterator()
Specified by:
iterator in interface Iterable<Token>

skipline

public Token skipline(boolean white)
               throws IOException,
                      LexerException
Skips tokens until the end of line.

Parameters:
white - true if only whitespace is permitted on the remainder of the line.
Returns:
the NL token.
Throws:
IOException
LexerException

error

protected void error(ErrorMessage msg)
              throws LexerException
Throws:
LexerException


Copyright © 2007 Shevek, Anarres. All Rights Reserved.