public class Interpreter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static EvaluationEnvironment |
SIMPLE_EVALUATION_ENVIRONMENT
Evaluates function calls to itself.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dump(java.lang.Object value)
Converts an object to a TDD-like representation (not necessary valid
TDD).
|
static java.lang.Object |
eval(Fragment fragment,
EvaluationEnvironment ee,
boolean forceStringValues)
Evaluates a
Fragment as single TDD expression. |
static java.lang.Object |
eval(java.lang.String text)
Same as
eval(text, null, false, null) . |
static java.lang.Object |
eval(java.lang.String text,
EvaluationEnvironment ee,
boolean forceStringValues,
java.lang.String fileName)
Evaluates text as single TDD expression.
|
static java.lang.Object |
eval(java.lang.String text,
java.lang.String fileName)
Same as
eval(text, null, false, fileName) . |
static java.util.Map |
evalAsHash(java.lang.String text)
Same as
evalAsHash(text, null, false, null) . |
static java.util.Map |
evalAsHash(java.lang.String text,
EvaluationEnvironment ee,
boolean forceStringValues,
java.lang.String fileName)
Evaluates text as a list of key:value pairs.
|
static java.util.Map |
evalAsHash(java.lang.String text,
java.lang.String fileName)
Same as
evalAsHash(text, null, false, fileName) . |
static java.util.List |
evalAsSequence(java.lang.String text)
Same as
evalAsList(text, null, false, null) . |
static java.util.List |
evalAsSequence(java.lang.String text,
EvaluationEnvironment ee,
boolean forceStringValues,
java.lang.String fileName)
Evaluates text as a list values.
|
static java.util.List |
evalAsSequence(java.lang.String text,
java.lang.String fileName)
Same as
evalAsList(text, null, false, fileName) . |
EvaluationEnvironment |
getEvaluationEnvironment() |
java.lang.String |
getFileName() |
int |
getPosition() |
java.lang.String |
getText() |
static java.lang.String |
getTypeName(java.lang.Object value) |
static java.lang.String |
loadTdd(byte[] b,
java.lang.String defaultEncoding)
Loads a TDD file with utilizing #encoding:enc header.
|
static java.lang.String |
loadTdd(java.io.InputStream in,
java.lang.String defaultEncoding)
Loads a TDD file with utilizing #encoding:enc header.
|
public static final EvaluationEnvironment SIMPLE_EVALUATION_ENVIRONMENT
public static java.lang.Object eval(java.lang.String text, EvaluationEnvironment ee, boolean forceStringValues, java.lang.String fileName) throws EvalException
text
- the text to interpret.ee
- the EvaluationEnvironment
used to resolve function
calls. If it is null
then
SIMPLE_EVALUATION_ENVIRONMENT
will be used.forceStringValues
- specifies if expressions as true and
123 should be interpreted as strings, or as boolean and
number respectively.fileName
- the path of the source file, or other description of the
source. It is used for informative purposes only, as in error
messages.Map
, but never null
.EvalException
public static java.lang.Object eval(Fragment fragment, EvaluationEnvironment ee, boolean forceStringValues) throws EvalException
Fragment
as single TDD expression. The expression
can be surrounded with superfluous white-space.EvalException
eval(String, EvaluationEnvironment, boolean, String)
public static java.lang.Object eval(java.lang.String text, java.lang.String fileName) throws EvalException
eval(text, null, false, fileName)
.EvalException
eval(String, EvaluationEnvironment, boolean, String)
public static java.lang.Object eval(java.lang.String text) throws EvalException
eval(text, null, false, null)
.EvalException
eval(String, EvaluationEnvironment, boolean, String)
public static java.util.Map evalAsHash(java.lang.String text, EvaluationEnvironment ee, boolean forceStringValues, java.lang.String fileName) throws EvalException
text
- the text to interpret.ee
- the EvaluationEnvironment
used to resolve function
calls. If it is null
then
SIMPLE_EVALUATION_ENVIRONMENT
will be used.forceStringValues
- specifies if expressions as true and
123 should be interpreted as strings, or as boolean and
number respectively.fileName
- the path of the source file, or other description of the
source. It is used for informative purposes only, as in error
messages.Map
, but never null
.EvalException
public static java.util.Map evalAsHash(java.lang.String text) throws EvalException
evalAsHash(text, null, false, null)
.EvalException
evalAsHash(String, EvaluationEnvironment, boolean, String)
public static java.util.Map evalAsHash(java.lang.String text, java.lang.String fileName) throws EvalException
evalAsHash(text, null, false, fileName)
.EvalException
evalAsHash(String, EvaluationEnvironment, boolean, String)
public static java.util.List evalAsSequence(java.lang.String text, EvaluationEnvironment ee, boolean forceStringValues, java.lang.String fileName) throws EvalException
text
- the text to interpret.ee
- the EvaluationEnvironment
used to resolve function
calls. If it is null
then
SIMPLE_EVALUATION_ENVIRONMENT
will be used.forceStringValues
- specifies if expressions as true and
123 should be interpreted as strings, or as boolean and
number respectively.fileName
- the path of the source file, or other description of the
source. It is used for informative purposes only, as in error
messages.List
, but never null
.EvalException
public static java.util.List evalAsSequence(java.lang.String text) throws EvalException
evalAsList(text, null, false, null)
.EvalException
evalAsSequence(String, EvaluationEnvironment, boolean, String)
public static java.util.List evalAsSequence(java.lang.String text, java.lang.String fileName) throws EvalException
evalAsList(text, null, false, fileName)
.EvalException
evalAsSequence(String, EvaluationEnvironment, boolean, String)
public static java.lang.String loadTdd(java.io.InputStream in, java.lang.String defaultEncoding) throws java.io.IOException
in
- the stream that reads the content of the file.java.io.IOException
public static java.lang.String loadTdd(byte[] b, java.lang.String defaultEncoding) throws java.io.IOException
b
- the content of the file.java.io.IOException
public static java.lang.String dump(java.lang.Object value)
value
- the object to convertpublic static java.lang.String getTypeName(java.lang.Object value)
public int getPosition()
public java.lang.String getText()
public java.lang.String getFileName()
public EvaluationEnvironment getEvaluationEnvironment()