Class Preprocessor
java.lang.Object
io.github.protasm.jvmud.compiler.preproc.Preprocessor
Minimal LPC preprocessor for includes, macro definitions, conditional directives, comment
stripping, and line splicing with backslash-newline.
It expands macros outside of string/char literals and respects a simple hideset to avoid recursive re-expansion.
-
Constructor Summary
ConstructorsConstructorDescriptionPreprocessor(IncludeResolver resolver) Preprocessor(IncludeResolver resolver, Map<String, String> compatibilityPredefines) Creates a preprocessor with explicit compatibility predefines.Preprocessor(IncludeResolver resolver, Map<String, String> compatibilityPredefines, Map<String, Map<String, String>> compatibilityFunctionPredefines) Creates a preprocessor with object-like and function-like compatibility predefines. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringpreprocess(String source) Preprocess source text without filesystem includes.preprocess(Path sourcePath, String source) static Stringpreprocess(Path sourcePath, String source, String sysInclPath, String quoteInclPath) static Stringstatic PreprocessedSourcepreprocessWithMapping(String source) preprocessWithMapping(Path sourcePath, String source) preprocessWithMapping(Path sourcePath, String source, String displayPath) static IncludeResolver
-
Constructor Details
-
Preprocessor
-
Preprocessor
Creates a preprocessor with explicit compatibility predefines.The predefined values are replacement source text. This constructor is used by mudlib boundary profiles to expose driver-compatibility macros, for example LDMud-shaped version probes, without making those macros JVMud-native LPC.
- Parameters:
resolver- include resolver for#includedirectivescompatibilityPredefines- macro names and replacement source text supplied by the active mudlib boundary
-
Preprocessor
public Preprocessor(IncludeResolver resolver, Map<String, String> compatibilityPredefines, Map<String, Map<String, String>> compatibilityFunctionPredefines) Creates a preprocessor with object-like and function-like compatibility predefines.Function-like entries are keyed by macro name and first-argument spelling. They let mudlib boundary profiles answer compile-time feature probes without hardcoding another driver's probe macro names in JVMud's compiler.
- Parameters:
resolver- include resolver for#includedirectivescompatibilityPredefines- object-like macro names and replacement source text supplied by the active mudlib boundarycompatibilityFunctionPredefines- function-like macro replacements supplied by the active mudlib boundary
-
-
Method Details
-
preprocess
Preprocess source text without filesystem includes.This helper builds a
Preprocessorthat rejects any attempt to resolve#includedirectives, making it suitable for string-only compilation flows. -
preprocessWithMapping
-
preprocess
-
preprocess
-
rejectingResolver
-
preprocess
-
preprocessWithMapping
-
preprocessWithMapping
-