|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.anarres.cpp.Preprocessor
public class Preprocessor
A C Preprocessor.
The Preprocessor outputs a token stream which does not need
re-lexing for C or C++. Alternatively, the output text may be
reconstructed by concatenating the text
values of the returned Tokens
. (See
CppReader
, which does this.)
Constructor Summary | |
---|---|
Preprocessor(File file)
Equivalent to 'new Preprocessor(new FileLexerSource(file))' |
|
Preprocessor(Source initial)
|
Method Summary | |
---|---|
void |
addMacro(Macro m)
|
protected void |
error(int level,
Token tok,
String msg)
Passes an error to the ErrorHandler. |
ErrorHandler |
getErrorHandler()
Returns the ErrorHandler used by this Preprocessor. |
protected Map<String,Macro> |
getMacros()
Returns the Map of Macros parsed during the run of this Preprocessor. |
protected Source |
getSource()
Returns the top Source on the input stack. |
protected void |
include(File parent,
int line,
String name,
boolean quoted)
Handles a include directive. |
protected void |
pop_source()
Pops a Source from the input stack. |
protected void |
push_source(Source source,
boolean autopop)
Pushes a Source onto the input stack. |
void |
setErrorHandler(ErrorHandler h)
Sets the ErrorHandler used by this Preprocessor. |
void |
setIncludePath(List<String> path)
Sets the include path used by this Preprocessor. |
Token |
token()
Returns the next preprocessor token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Preprocessor(Source initial)
public Preprocessor(File file) throws IOException
IOException
Method Detail |
---|
protected void error(int level, Token tok, String msg) throws LexerException
LexerException
public void setErrorHandler(ErrorHandler h)
public ErrorHandler getErrorHandler()
public void addMacro(Macro m) throws LexerException
LexerException
public void setIncludePath(List<String> path)
protected Map<String,Macro> getMacros()
protected Source getSource()
Source
,
push_source(Source,boolean)
,
pop_source()
protected void push_source(Source source, boolean autopop)
getSource()
,
pop_source()
protected void pop_source()
getSource()
,
push_source(Source,boolean)
protected void include(File parent, int line, String name, boolean quoted) throws IOException, LexerException
IOException
LexerException
public Token token() throws IOException, LexerException
LexerException
- if a preprocessing error occurs.
InternalException
- if an unexpected error condition arises.
IOException
Token
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |