|
|||||||||
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()
|
|
Preprocessor(File file)
Equivalent to 'new Preprocessor(new FileLexerSource (file))' |
|
Preprocessor(Source initial)
|
Method Summary | |
---|---|
void |
addFeature(Feature f)
|
void |
addFeatures(Collection<Feature> f)
|
void |
addInput(File file)
|
void |
addInput(Source source)
|
void |
addMacro(Macro m)
|
void |
addMacro(String name)
Defines the given name as a macro. |
void |
addMacro(String name,
String value)
Defines the given name as a macro. |
void |
addSource(Source source)
Pushes a source into the input stack. |
void |
addWarning(Warning w)
|
void |
addWarnings(Collection<Warning> w)
|
protected void |
error(int line,
int column,
String msg)
Handles an error. |
protected void |
error(Token tok,
String msg)
|
Set<Feature> |
getFeatures()
|
Macro |
getMacro(String name)
|
protected Map<String,Macro> |
getMacros()
Returns the Map of Macros parsed during the run of this Preprocessor. |
List<String> |
getQuoteIncludePath()
|
protected Source |
getSource()
Returns the top Source on the input stack. |
List<String> |
getSystemIncludePath()
|
Set<Warning> |
getWarnings()
|
protected boolean |
include(File file)
|
protected void |
include(File parent,
int line,
String name,
boolean quoted)
Handles a include directive. |
protected boolean |
include(Iterable<String> path,
String name)
|
protected void |
pop_source()
Pops a Source from the input stack. |
protected void |
pragma(Token name,
List<Token> value)
|
protected void |
push_source(Source source,
boolean autopop)
Pushes a Source onto the input stack. |
void |
setListener(PreprocessorListener listener)
|
void |
setQuoteIncludePath(List<String> path)
Sets the user include path used by this Preprocessor. |
void |
setSystemIncludePath(List<String> path)
Sets the system include path used by this Preprocessor. |
Token |
token()
Returns the next preprocessor token. |
String |
toString()
|
protected void |
warning(int line,
int column,
String msg)
Handles a warning. |
protected void |
warning(Token tok,
String msg)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Preprocessor()
public Preprocessor(Source initial)
public Preprocessor(File file) throws IOException
FileLexerSource
(file))'
IOException
Method Detail |
---|
public void setListener(PreprocessorListener listener)
public Set<Feature> getFeatures()
public void addFeature(Feature f)
public void addFeatures(Collection<Feature> f)
public Set<Warning> getWarnings()
public void addWarning(Warning w)
public void addWarnings(Collection<Warning> w)
public void addInput(Source source)
public void addInput(File file) throws IOException
IOException
protected void error(int line, int column, String msg) throws LexerException
LexerException
protected void error(Token tok, String msg) throws LexerException
LexerException
protected void warning(int line, int column, String msg) throws LexerException
LexerException
protected void warning(Token tok, String msg) throws LexerException
LexerException
public void addMacro(Macro m) throws LexerException
LexerException
public void addMacro(String name, String value) throws LexerException
LexerException
public void addMacro(String name) throws LexerException
LexerException
public void setQuoteIncludePath(List<String> path)
public List<String> getQuoteIncludePath()
public void setSystemIncludePath(List<String> path)
public List<String> getSystemIncludePath()
protected Map<String,Macro> getMacros()
public Macro getMacro(String name)
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)
public void addSource(Source source)
protected boolean include(File file) throws IOException, LexerException
IOException
LexerException
protected boolean include(Iterable<String> path, String name) throws IOException, LexerException
IOException
LexerException
protected void include(File parent, int line, String name, boolean quoted) throws IOException, LexerException
IOException
LexerException
protected void pragma(Token name, List<Token> value) 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
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |