public class SelfCompiler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL |
static java.lang.String |
AND |
static java.lang.String |
ANSWER |
static java.lang.String |
APPEND |
static java.lang.String |
AS |
static java.lang.String |
ASSIGN |
static java.lang.String |
ASSOCIATE |
static java.lang.String |
ASSOCIATED |
static java.lang.String |
AT |
static java.lang.String |
BY |
static java.lang.String |
CALL |
static java.lang.String |
CASE |
static java.lang.String |
COUNT |
static java.lang.String |
DEBUG |
static java.lang.String |
DEFINE |
static java.lang.String |
DISSOCIATE |
static java.lang.String |
DO |
static java.lang.String |
EACH |
static java.lang.String |
ELSE |
static java.lang.String |
EQUAL |
static java.lang.String |
EQUATION |
static java.lang.String |
EVAL |
static java.lang.String |
EXCLUDE |
static java.lang.String |
FINALLY |
static java.lang.String |
FOR |
static java.lang.String |
FORMAT |
static java.lang.String |
FORMULA |
static java.lang.String |
FROM |
static java.lang.String |
FUNCTION |
static java.lang.String |
GET |
static java.lang.String |
GOTO |
static java.lang.String |
GREATER |
static java.lang.String |
IF |
static java.lang.String |
INCLUDE |
static java.lang.String |
INPUT |
static java.lang.String |
IS |
static java.lang.String |
LAST |
static java.lang.String |
LEARN |
static java.lang.String |
LESS |
static java.lang.String |
LOWERCASE |
static int |
MAX_FILE_SIZE |
static int |
MAX_LOAD_SIZE |
static java.lang.String |
META |
static java.lang.String |
NEW |
static java.lang.String |
NOT |
static java.lang.String |
OF |
static java.lang.String |
ON |
static java.util.List<java.lang.String> |
OPERATORS |
static java.lang.String |
OR |
static java.lang.String |
PART |
static java.lang.String |
PATTERN |
static java.util.List<Primitive> |
PINNED |
static java.lang.String |
PREVIOUS |
static java.lang.String |
PRIMITIVE |
static java.lang.String |
PRIMITIVE_TOKENS |
static java.lang.String |
PUSH |
static java.lang.String |
QUOTIENT |
static java.lang.String |
RANDOM |
static java.lang.String |
REDIRECT |
static java.lang.String |
RELATED |
static java.lang.String |
RELATION |
static java.lang.String |
REQUEST |
static java.lang.String |
RETURN |
static java.lang.String |
SENTENCE |
static java.lang.String |
SERVICE |
static java.lang.String |
SET |
static java.lang.String |
SRAI |
static java.lang.String |
SRAIX |
static java.lang.String |
STATE |
static java.lang.String |
TEMPLATE |
static java.lang.String |
THAT |
static java.lang.String |
THEN |
static java.lang.String |
THINK |
static java.lang.String |
TO |
static java.lang.String |
TOPIC |
static java.util.List<java.lang.String> |
TYPES |
static java.lang.String |
UPPERCASE |
static java.lang.String |
VAR |
static java.lang.String |
VARIABLE |
static java.lang.String |
VERTEX |
static java.lang.String |
WEAK |
static java.lang.String |
WEAKASSOCIATE |
static java.lang.String |
WHILE |
static java.lang.String |
WITH |
static java.lang.String |
WORD |
Constructor and Description |
---|
SelfCompiler() |
Modifier and Type | Method and Description |
---|---|
static void |
addGlobalVariables(Vertex input,
Vertex sentence,
Network network,
java.util.Map<Vertex,Vertex> variables) |
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> |
buildElementsMap(Network network) |
void |
ensureNext(char expected,
char other,
TextStream stream)
Throw a parse error if the next character does not match what is expected.
|
void |
ensureNext(char expected,
TextStream stream)
Throw a parse error if the next character does not match what is expected.
|
void |
ensureNext(java.lang.String expected,
TextStream stream)
Throw a parse error if the next word does not match what is expected.
|
Vertex |
evaluateEquation(java.lang.String code,
Vertex speaker,
Vertex target,
boolean pin,
boolean debug,
Network network)
Parse and evaluate the code.
|
Vertex |
evaluateExpression(java.lang.String code,
Vertex speaker,
Vertex target,
boolean pin,
boolean debug,
Network network)
Parse and evaluate the code.
|
void |
fastLoad(Vertex state) |
void |
fastLoadChildren(Vertex state) |
void |
fastUnpin(Vertex state) |
java.util.List<java.lang.String> |
getComments(TextStream stream) |
static SelfCompiler |
getCompiler() |
int |
getVersion() |
java.lang.String |
lower(java.lang.String token) |
Vertex |
parseCase(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the IF condition.
|
Vertex |
parseElement(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the reference to either a state, variable, equation, or raw data.
|
Vertex |
parseEquation(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the equation.
|
Vertex |
parseEquationForEvaluation(java.lang.String code,
Vertex speaker,
Vertex target,
boolean debug,
Network network)
Parse the code into a temporary equation so it can be evaluated.
|
Vertex |
parseFormula(Vertex formula,
TextStream stream,
boolean debug,
Network network)
Parse the formula.
|
Vertex |
parseFormula(Vertex formula,
TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the formula.
|
Vertex |
parseGoto(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the GOTO condition.
|
Vertex |
parseOperator(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the operator.
|
Vertex |
parsePattern(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the PATTERN condition.
|
Vertex |
parsePush(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the PUSH condition.
|
void |
parseQuotient(Vertex state,
TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the quotient.
|
Vertex |
parseReturn(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the RETURN condition.
|
Vertex |
parseState(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the state and any referenced states or variables.
|
Vertex |
parseStateMachine(java.io.File file,
java.lang.String encoding,
boolean debug,
Network network)
Get the contents of the URL to a .self file and parse it.
|
Vertex |
parseStateMachine(java.io.InputStream stream,
boolean debug,
Network network,
java.lang.String encoding,
int maxSize)
Get the contents of the stream to a .self file and parse it.
|
Vertex |
parseStateMachine(java.lang.String code,
boolean debug,
Network network)
Parse the code into a vertex state machine defined in the network.
|
Vertex |
parseStateMachine(java.net.URL url,
java.lang.String encoding,
boolean debug,
Network network)
Get the contents of the URL to a .self file and parse it.
|
Vertex |
parseTemplate(Vertex formula,
TextStream stream,
boolean debug,
Network network)
Parse the formula.
|
Vertex |
parseTemplate(Vertex formula,
TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the formula.
|
Vertex |
parseVariable(TextStream stream,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
boolean debug,
Network network)
Parse the variable.
|
void |
pin(Vertex element) |
void |
pin(Vertex element,
java.util.List<Primitive> relations,
long groupId,
java.util.Set<Vertex> processed) |
static void |
setCompiler(SelfCompiler compiler) |
java.lang.String |
toString() |
void |
unpin(Vertex element) |
void |
unpin(Vertex element,
java.util.List<Primitive> relations,
java.util.Set<Vertex> processed) |
public static int MAX_FILE_SIZE
public static int MAX_LOAD_SIZE
public static final java.lang.String PRIMITIVE_TOKENS
public static final java.lang.String IF
public static final java.lang.String WHILE
public static final java.lang.String GREATER
public static final java.lang.String LESS
public static final java.lang.String EQUAL
public static final java.lang.String OR
public static final java.lang.String CASE
public static final java.lang.String PATTERN
public static final java.lang.String CALL
public static final java.lang.String SRAI
public static final java.lang.String SRAIX
public static final java.lang.String REDIRECT
public static final java.lang.String REQUEST
public static final java.lang.String SERVICE
public static final java.lang.String LEARN
public static final java.lang.String EVAL
public static final java.lang.String FOR
public static final java.lang.String EACH
public static final java.lang.String ASSIGN
public static final java.lang.String TO
public static final java.lang.String ON
public static final java.lang.String WITH
public static final java.lang.String BY
public static final java.lang.String OF
public static final java.lang.String AS
public static final java.lang.String AT
public static final java.lang.String LAST
public static final java.lang.String AND
public static final java.lang.String GET
public static final java.lang.String ALL
public static final java.lang.String COUNT
public static final java.lang.String SET
public static final java.lang.String EXCLUDE
public static final java.lang.String INCLUDE
public static final java.lang.String IS
public static final java.lang.String RELATED
public static final java.lang.String RELATION
public static final java.lang.String WEAK
public static final java.lang.String ASSOCIATE
public static final java.lang.String WEAKASSOCIATE
public static final java.lang.String DISSOCIATE
public static final java.lang.String META
public static final java.lang.String DO
public static final java.lang.String THINK
public static final java.lang.String INPUT
public static final java.lang.String PART
public static final java.lang.String NEW
public static final java.lang.String APPEND
public static final java.lang.String NOT
public static final java.lang.String GOTO
public static final java.lang.String RETURN
public static final java.lang.String TEMPLATE
public static final java.lang.String THAT
public static final java.lang.String TOPIC
public static final java.lang.String QUOTIENT
public static final java.lang.String ANSWER
public static final java.lang.String FROM
public static final java.lang.String ASSOCIATED
public static final java.lang.String PREVIOUS
public static final java.lang.String WORD
public static final java.lang.String SENTENCE
public static final java.lang.String UPPERCASE
public static final java.lang.String LOWERCASE
public static final java.lang.String FORMAT
public static final java.lang.String PRIMITIVE
public static final java.lang.String DEFINE
public static final java.lang.String RANDOM
public static final java.lang.String DEBUG
public static final java.lang.String PUSH
public static final java.lang.String FINALLY
public static final java.lang.String THEN
public static final java.lang.String ELSE
public static java.util.List<java.lang.String> OPERATORS
public static final java.lang.String VARIABLE
public static final java.lang.String VERTEX
public static final java.lang.String VAR
public static final java.lang.String STATE
public static final java.lang.String EQUATION
public static final java.lang.String FUNCTION
public static final java.lang.String FORMULA
public static java.util.List<java.lang.String> TYPES
public static java.util.List<Primitive> PINNED
public static SelfCompiler getCompiler()
public static void setCompiler(SelfCompiler compiler)
public static void addGlobalVariables(Vertex input, Vertex sentence, Network network, java.util.Map<Vertex,Vertex> variables)
public int getVersion()
public Vertex parseStateMachine(java.lang.String code, boolean debug, Network network)
public Vertex evaluateExpression(java.lang.String code, Vertex speaker, Vertex target, boolean pin, boolean debug, Network network)
public Vertex evaluateEquation(java.lang.String code, Vertex speaker, Vertex target, boolean pin, boolean debug, Network network)
public Vertex parseEquationForEvaluation(java.lang.String code, Vertex speaker, Vertex target, boolean debug, Network network)
public Vertex parseStateMachine(java.net.URL url, java.lang.String encoding, boolean debug, Network network)
public Vertex parseStateMachine(java.io.File file, java.lang.String encoding, boolean debug, Network network)
public Vertex parseStateMachine(java.io.InputStream stream, boolean debug, Network network, java.lang.String encoding, int maxSize)
public java.util.List<java.lang.String> getComments(TextStream stream)
public void pin(Vertex element)
public void pin(Vertex element, java.util.List<Primitive> relations, long groupId, java.util.Set<Vertex> processed)
public void fastUnpin(Vertex state)
public void fastLoad(Vertex state)
public void fastLoadChildren(Vertex state)
public void unpin(Vertex element)
public void unpin(Vertex element, java.util.List<Primitive> relations, java.util.Set<Vertex> processed)
public Vertex parseState(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public void parseQuotient(Vertex state, TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseElement(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public void ensureNext(char expected, TextStream stream)
public void ensureNext(char expected, char other, TextStream stream)
public void ensureNext(java.lang.String expected, TextStream stream)
public Vertex parseVariable(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseEquation(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseTemplate(Vertex formula, TextStream stream, boolean debug, Network network)
public Vertex parseFormula(Vertex formula, TextStream stream, boolean debug, Network network)
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> buildElementsMap(Network network)
public Vertex parseTemplate(Vertex formula, TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseFormula(Vertex formula, TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseOperator(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public java.lang.String lower(java.lang.String token)
public Vertex parseCase(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parsePattern(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseReturn(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parseGoto(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public Vertex parsePush(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, boolean debug, Network network)
public java.lang.String toString()
toString
in class java.lang.Object