Class ScriptReader
java.lang.Object
com.blackrook.rookscript.compiler.ScriptReader
The main factory for reading and parsing a script file.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Default includer to use when none specified. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ScriptReaderIncluder
The singular instance for the default includer.static final ScriptReaderOptions
The singular instance for default options.static final String
-
Method Summary
Modifier and TypeMethodDescriptionstatic Script
read
(File file, ScriptHostFunctionResolver functionResolver) Reads a script from a starting text file.static Script
read
(File file, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) Reads a script from a starting text file.static Script
read
(File file, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a starting text file.static Script
read
(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) Reads a script from a starting text file.static Script
read
(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) Reads a script from a starting text file.static Script
read
(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a starting text file.static Script
read
(String text, ScriptHostFunctionResolver functionResolver) Reads a script from a String of text.static Script
read
(String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) Reads a script from a String of text.static Script
read
(String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a String of text.static Script
read
(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) Reads a script from a String of text.static Script
read
(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) Reads a script from a String of text.static Script
read
(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a String of text.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver) Reads a script.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) Reads a script.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) Reads a script.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) Reads a script.static Script
read
(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver) Reads a script from a reader stream.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) Reads a script from a reader stream.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a reader stream.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) Reads a script from a reader stream.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) Reads a script from a reader stream.static Script
read
(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a reader stream.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver) Reads a script from a String of text.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) Reads a script from a String of text.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a String of text.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) Reads a script from a String of text.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) Reads a script from a String of text.static Script
read
(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) Reads a script from a String of text.
-
Field Details
-
STREAMNAME_TEXT
- See Also:
-
DEFAULT_INCLUDER
The singular instance for the default includer. -
DEFAULT_OPTIONS
The singular instance for default options.
-
-
Method Details
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if file is null or a resolver is null.
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if file is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a String of text.- Parameters:
text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if file is null or a resolver is null.
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if file is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, String text, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a String of text.- Parameters:
streamName
- a name to assign to the stream.text
- the String to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.NullPointerException
- if text is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(File file, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a starting text file.- Parameters:
file
- the file to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if file is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, InputStream in, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script. Assumes platform default encoding.- Parameters:
streamName
- the name of the stream.in
- the stream to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if in is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if f is null or a resolver is null.
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if reader is null or a resolver is null.
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if reader is null or a resolver is null.
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if f is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if reader is null or a resolver is null.- Since:
- 1.8.0
-
read
public static Script read(String streamName, Reader reader, ScriptHostFunctionResolver functionResolver, ScriptScopeResolver scopeResolver, ScriptReaderIncluder includer, ScriptReaderOptions options) throws IOException Reads a script from a reader stream.- Parameters:
streamName
- the name of the stream.reader
- the reader to read from.functionResolver
- the host function resolver to use.scopeResolver
- the scope resolver to use.includer
- the includer to use to resolve "included" paths.options
- the reader options to use.- Returns:
- A new Script that contains all the read object hierarchy.
- Throws:
ScriptParseException
- if one or more parse errors happen.IOException
- if the stream can't be read.SecurityException
- if a read error happens due to OS permissioning.NullPointerException
- if reader is null or a resolver is null.- Since:
- 1.8.0
-