Class ReplSession
java.lang.Object
org.ek9lang.cli.ReplSession
Manages the REPL session state including mode, source buffers, and defined symbols.
Delegates buffer operations to SectionedBuffers and command handling to MetaCommandHandler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumResult of processing a single line of input. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new REPL session with default error level 0.ReplSession(int initialErrorLevel) Create a new REPL session with the specified initial error level. -
Method Summary
Modifier and TypeMethodDescriptionAssemble all buffers into valid EK9 source code.Get source with line numbers for display.voidClear tracked symbols (called when buffers are cleared).voidvoidintgetBufferIndex(int actualLineNumber) Get the buffer index for a given actual source line number.intGet the last line added to the program buffer.Get the pending filename for save/load operations.booleanbooleanloadFromVisitor(ReplSourceVisitor visitor) Load content from a parsed EK9 file via the visitor.processInput(String input) Process a line of user input.voidRemove the last line added to the current mode's buffer.voidSave current buffer state for undo.voidsetErrorLevel(int level) voidsetRunning(boolean running) voidsetStrictMode(boolean strict) voidtrackVariable(String name) Track a variable that was defined in program mode.booleanundo()Undo the last buffer modification.
-
Constructor Details
-
ReplSession
public ReplSession(int initialErrorLevel) Create a new REPL session with the specified initial error level. -
ReplSession
public ReplSession()Create a new REPL session with default error level 0.
-
-
Method Details
-
processInput
Process a line of user input. -
saveUndoState
public void saveUndoState()Save current buffer state for undo. -
undo
public boolean undo()Undo the last buffer modification. -
clearTrackedSymbols
public void clearTrackedSymbols()Clear tracked symbols (called when buffers are cleared). -
setRunning
public void setRunning(boolean running) -
setErrorLevel
public void setErrorLevel(int level) -
setStrictMode
public void setStrictMode(boolean strict) -
assembleSource
Assemble all buffers into valid EK9 source code. -
assembleSourceWithLineNumbers
Get source with line numbers for display. -
getBufferIndex
public int getBufferIndex(int actualLineNumber) Get the buffer index for a given actual source line number. -
getPrompt
-
getCurrentMode
-
getErrorLevel
public int getErrorLevel() -
isRunning
public boolean isRunning() -
isStrictMode
public boolean isStrictMode() -
enterContinuationMode
public void enterContinuationMode() -
exitContinuationMode
public void exitContinuationMode() -
getLastMessage
-
getDefinedVariables
-
getDefinedFunctions
-
getDefinedTypes
-
trackVariable
Track a variable that was defined in program mode. -
getLastProgramLine
Get the last line added to the program buffer. -
removeLastLine
public void removeLastLine()Remove the last line added to the current mode's buffer. -
getPendingFilename
Get the pending filename for save/load operations. -
loadFromVisitor
Load content from a parsed EK9 file via the visitor.
-