Package com.blackrook.rookscript.struct
Class PreprocessorLexer.DefaultIncluder
java.lang.Object
com.blackrook.rookscript.struct.PreprocessorLexer.DefaultIncluder
- All Implemented Interfaces:
PreprocessorLexer.Includer
- Enclosing class:
- PreprocessorLexer
public static class PreprocessorLexer.DefaultIncluder
extends Object
implements PreprocessorLexer.Includer
Default includer to use when none specified.
This includer can either pull from the classpath, URIs, or files.
- Paths that start with
classpath:
are parsed as resource paths in the current classpath. -
Else, the path is interpreted as a file path, with the following search order:
- Relative to parent of source stream.
- As is.
-
Method Summary
Modifier and TypeMethodDescriptiongetIncludeResource
(String path) Returns an openInputStream
for a path when the parser needs a resource.getIncludeResourcePath
(String streamName, String path) Returns a full path for a path when the parser needs a resource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.blackrook.rookscript.struct.PreprocessorLexer.Includer
getEncodingForIncludedResource
-
Method Details
-
getIncludeResourcePath
Description copied from interface:PreprocessorLexer.Includer
Returns a full path for a path when the parser needs a resource.- Specified by:
getIncludeResourcePath
in interfacePreprocessorLexer.Includer
- Parameters:
streamName
- the current name of the stream. This includer may use this to procure a relative path.path
- the stream path from the include directive.- Returns:
- the path to a possible resource, or null if no possible path is available.
- Throws:
IOException
- if an error occurs procuring a potential stream.
-
getIncludeResource
Description copied from interface:PreprocessorLexer.Includer
Returns an openInputStream
for a path when the parser needs a resource. By default, this attempts to open a file at the provided path.- Specified by:
getIncludeResource
in interfacePreprocessorLexer.Includer
- Parameters:
path
- the resolved stream path from the include directive.- Returns:
- an open
InputStream
for the requested resource, or null if not found. - Throws:
IOException
- if an error occurs opening a stream.
-