Package manifold.api.type
Interface IPreprocessor
-
public interface IPreprocessorA preprocessor gets a crack at modifying the Java source code before the Java parser sees it. All preprocessing happens directly as part of the Java compiler, as such it is fast and much less involved than conventional build script oriented systems.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classIPreprocessor.OrderUsed to specify the preferred order a preprocessor runs wrt others
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IPreprocessor.OrdergetPreferredOrder()CharSequenceprocess(URI uri, CharSequence source)Preprocess source code which is then handed off to the Java parser.
-
-
-
Method Detail
-
getPreferredOrder
IPreprocessor.Order getPreferredOrder()
- Returns:
- The preferred order for this preprocessor. If two or more processors have the same preference, there is no
guarantee which precedes the other. However preprocessors are guaranteed to be grouped in order:
First -> None -> Last
-
process
CharSequence process(URI uri, CharSequence source)
Preprocess source code which is then handed off to the Java parser. Things to consider when implementing this method:- As a general rule a preprocessor should maintain line number ordering of the original file, otherwise tooling such as debuggers will not align with the original source.
- This method is performance sensitive, all source code is processed here.
- If source is unchanged, return the same
sourceparameter.- A preprocessor that must tokenize the source can use the Java scanner like this:
Scanner scanner = ScannerFactory.instance(JavacPlugin.instance().getContext()).newScanner(input, true);- Parameters:
uri-source- The Java source corresponding with a source file about to be compiled.- Returns:
- The processed source code.
-
-