public interface Preprocessor
A Preprocessor is used to preprocess source files. A single Preprocessor object can be used to preprocess multiple files.
A Preprocessor does have some state: it keeps track of all the files it has
preprocessed. This includes files that were preprocessed because they were
(recursively) included by #include directives. It maintains an
ordered list in which each of these files occurs exactly once. This
essentially assigned a unique integer ID (numbered from 0) to all the files
that the preprocessor has encountered.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FileThe path containing the ABC header files.static final StringThe name of the CIVL-C header file, which is included automatically at the beginning of any CIVL-C input file.static final File[]Default value for system include path list.static final File[]Default value for user include path list. -
Method Summary
Modifier and TypeMethodDescriptionpreprocess(File[] systemIncludePaths, File[] userIncludePaths, Map<String, String> predefinedMacros, File[] sourceFiles) Given preprocessor source files, this returns a Token Source that emits the tokens resulting from preprocessing the file.preprocessLibrary(Map<String, String> predefinedMacros, String libraryFileName)
-
Field Details
-
ABC_INCLUDE_PATH
The path containing the ABC header files. This is internal to the project. The path is interpreted relative to the directories in the class path. The directory "/include" is in the class path. Therefore "abc" will be found in "/include/headers". -
civlcHeaderName
The name of the CIVL-C header file, which is included automatically at the beginning of any CIVL-C input file.- See Also:
-
defaultSystemIncludes
Default value for system include path list. -
defaultUserIncludes
Default value for user include path list. Currently, it consists of one directory, namely, the working directory.
-
-
Method Details
-
preprocess
CivlcTokenSource preprocess(File[] systemIncludePaths, File[] userIncludePaths, Map<String, String> predefinedMacros, File[] sourceFiles) throws PreprocessorExceptionGiven preprocessor source files, this returns a Token Source that emits the tokens resulting from preprocessing the file.- Parameters:
systemIncludePaths- the system include paths to search for included system headersuserIncludePaths- the user include paths to search for included user headerspredefinedMacros- the predefined macros, such as those specified in command linesourceFiles- the file sequence to be preprocessed as a single translation unit- Returns:
- the token source which is the output of the preprocessor, i.e., the result of tokenizing the files, applying the preprocessing directives, etc.
- Throws:
PreprocessorException- if an I/O error occurs
-
preprocessLibrary
CivlcTokenSource preprocessLibrary(Map<String, String> predefinedMacros, String libraryFileName) throws PreprocessorException- Throws:
PreprocessorException
-
getFileIndexer
FileIndexer getFileIndexer()
-