Package coneforest.psylla
Class Interpreter
- java.lang.Object
-
- java.lang.Thread
-
- coneforest.psylla.Interpreter
-
- All Implemented Interfaces:
PsyContext
,PsyConvertableToName
,PsyConvertableToString
,PsyObject
,Runnable
public class Interpreter extends Thread implements PsyContext
An interpreter.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description Interpreter()
Creates a new Psylla language interpreter.Interpreter(DictStack dstack)
-
Method Summary
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface coneforest.psylla.core.PsyContext
getId, join, psyJoin, toSyntaxString
-
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyClone, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, typeName
-
-
-
-
Constructor Detail
-
Interpreter
public Interpreter()
Creates a new Psylla language interpreter.
-
Interpreter
public Interpreter(DictStack dstack)
-
-
Method Detail
-
operandStack
public OperandStack operandStack()
Returns the operand stack.- Returns:
- the operand stack.
-
operandStackBacked
public OperandStack operandStackBacked(int count) throws PsyException
- Throws:
PsyException
-
dictStack
public DictStack dictStack()
Returns the dictionary stack.- Returns:
- the dictionary stack.
-
executionStack
public ExecutionStack executionStack()
Returns the execution stack.- Returns:
- the execution stack.
-
namespacePool
public NamespacePool namespacePool()
Returns the namespace pool.- Returns:
- the namespace pool.
-
classLoader
public ClassLoader classLoader()
-
where
public PsyDictlike where(String name)
-
psyWhere
public PsyDictlike psyWhere(PsyStringy oKey)
-
load
public <T extends PsyObject> T load(String name) throws PsyException
- Throws:
PsyException
-
psyLoad
public <T extends PsyObject> T psyLoad(PsyStringy oKey) throws PsyException
- Throws:
PsyException
-
handleExecutionStack
public void handleExecutionStack()
-
handleExecutionStack
public void handleExecutionStack(int level)
-
currentDict
public PsyDictlike currentDict()
Returns the current dictionary.- Returns:
- the current dictionary.
-
systemDict
public PsyDictlike systemDict()
Returns system dictionary.- Returns:
- the system dictionary.
-
userDict
public PsyDictlike userDict()
Returns the user dictionary.- Returns:
- the user dictionary.
-
currentNamespace
public PsyNamespace currentNamespace()
Returns the current namespace.- Returns:
- the current namespace.
-
setReader
public void setReader(Reader reader)
-
setWriter
public void setWriter(Writer writer)
-
setErrorWriter
public void setErrorWriter(Writer writer)
-
setRandomSeed
public void setRandomSeed(Long randomSeed) throws PsyException
- Throws:
PsyException
-
setClassPath
public void setClassPath(String[] classPath) throws PsyException
- Throws:
PsyException
-
setLibraryPath
public void setLibraryPath(String[] libraryPath) throws PsyException
- Throws:
PsyException
-
interpret
public void interpret(Reader reader)
-
interpret
public void interpret(String string)
-
interpret
public void interpret(PsyReader oReader)
-
interpretBraced
public void interpretBraced(PsyReader oReader) throws PsyException
- Throws:
PsyException
-
errorDict
public PsyDictlike errorDict() throws PsyException
- Throws:
PsyException
-
handleError
public void handleError(PsyException oException)
-
showStacks
public void showStacks()
-
execLevel
public int execLevel()
-
getStopFlag
public boolean getStopFlag()
-
setStopFlag
public void setStopFlag(boolean stopFlag)
-
pushLoopLevel
public int pushLoopLevel()
-
popLoopLevel
public int popLoopLevel()
-
currentLoopLevel
public int currentLoopLevel()
-
pushStopLevel
public int pushStopLevel()
-
popStopLevel
public int popStopLevel()
-
currentStopLevel
public int currentStopLevel()
-
setScriptName
public void setScriptName(String scriptName)
-
setShellArguments
public void setShellArguments(String[] args) throws PsyException
- Throws:
PsyException
-
quit
public void quit()
-
repl
public void repl() throws PsyException
- Throws:
PsyException
-
banner
public String banner()
-
prompt
public String prompt()
-
currentInterpreter
public static Interpreter currentInterpreter()
-
psyStop
public void psyStop()
-
loadLibraryResource
public void loadLibraryResource(PsyStringy oResourceName) throws PsyException
- Throws:
PsyException
-
psyRequire
public void psyRequire(PsyStringy oResourceName) throws PsyException
- Throws:
PsyException
-
-