pnuts.tools
Class DebugContext

java.lang.Object
  extended by pnuts.lang.Context
      extended by pnuts.tools.DebugContext
All Implemented Interfaces:
java.lang.Cloneable

public class DebugContext
extends Context

This class is a Context used in debug mode.


Field Summary
 
Fields inherited from class pnuts.lang.Context
beginColumn, beginLine, defaultErrorStream, defaultOutputStream, defaultTerminalStream, depth, endLine, environment, importEnv, loadingResource, moduleList, provideTable, unitTable
 
Constructor Summary
DebugContext()
           
DebugContext(Context context)
           
DebugContext(Package pkg)
           
 
Method Summary
 void addCommandListener(CommandListener listener)
           
 java.lang.Object clone(boolean clear_attributes, boolean clear_locals, boolean clear_listeners)
           
protected  void close(Function f, java.lang.Object[] args)
          Tracks stack depth (function return) in pure interpreter.
protected  int getBeginLine()
           
 int getCallDepth()
          Get the stack depth (in pure interpreter)
 Debugger getDebugger()
          Returns the debugger that controls this debug context
protected  int getEndLine()
           
 int getEvalDepth()
          Get the depth of evaluation.
protected  java.lang.Object getScriptSource()
          Get the source of the script.
protected  void onError(java.lang.Throwable t)
          This method is called when some exception is thrown.
protected  void onExit(java.lang.Object arg)
          This method is called when an evaluation is terminated normally.
protected  void open(Function f, java.lang.Object[] args)
          Tracks stack depth (function call) in pure interpreter.
 void removeCommandListener(CommandListener listener)
           
 void setDebugger(Debugger debugger)
          Registers the specified debugger as the controller of this debug context
protected  void updateLine(SimpleNode node, int beginLine, int beginColumn)
          This method is called when line number is changed.
 
Methods inherited from class pnuts.lang.Context
autoload, autoload, clearPackages, clone, clone, defined, get, getClassLoader, getConfiguration, getCurrentPackage, getErrorStream, getErrorWriter, getExitHook, getId, getImplementation, getName, getOutputStream, getPnutsImpl, getScriptEncoding, getTerminalStream, getTerminalWriter, getValue, getWriter, isVerbose, keys, loadModule, registerQuantityFactory, resolveClass, resolveSymbol, set, setClassLoader, setConfiguration, setCurrentPackage, setErrorStream, setErrorStream, setErrorWriter, setErrorWriter, setExitHook, setImplementation, setName, setOutputStream, setOutputStream, setOutputStream, setPnutsImpl, setScriptEncoding, setTerminalStream, setTerminalStream, setTerminalWriter, setTerminalWriter, setValue, setVerbose, setWriter, setWriter, unusePackage, updateColumn, updateLine, usedPackages, usePackage, usePackage, usePackage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugContext

public DebugContext()

DebugContext

public DebugContext(Package pkg)

DebugContext

public DebugContext(Context context)
Method Detail

setDebugger

public void setDebugger(Debugger debugger)
Registers the specified debugger as the controller of this debug context


getDebugger

public Debugger getDebugger()
Returns the debugger that controls this debug context


open

protected void open(Function f,
                    java.lang.Object[] args)
Tracks stack depth (function call) in pure interpreter. This method overrides Context.open().

Overrides:
open in class Context

close

protected void close(Function f,
                     java.lang.Object[] args)
Tracks stack depth (function return) in pure interpreter. This method overrides Context.close().

Overrides:
close in class Context

getEvalDepth

public int getEvalDepth()
Get the depth of evaluation. This value increases when load(), loadFile(), or eval() is called.


getCallDepth

public int getCallDepth()
Get the stack depth (in pure interpreter)


getBeginLine

protected int getBeginLine()

getEndLine

protected int getEndLine()

getScriptSource

protected java.lang.Object getScriptSource()
Description copied from class: Context
Get the source of the script.

Overrides:
getScriptSource in class Context
Returns:

  java.net.URL object, when the script is not precompiled
  pnuts.lang.Runtime object, when the script is precompiled

 

updateLine

protected void updateLine(SimpleNode node,
                          int beginLine,
                          int beginColumn)
This method is called when line number is changed.

Overrides:
updateLine in class Context
Parameters:
node - the current AST node
beginLine - the line number at which the current expression starts.
beginColumn - the column number at which theh current expression ends.

onError

protected void onError(java.lang.Throwable t)
This method is called when some exception is thrown.

Overrides:
onError in class Context

onExit

protected void onExit(java.lang.Object arg)
This method is called when an evaluation is terminated normally.

Overrides:
onExit in class Context

addCommandListener

public void addCommandListener(CommandListener listener)

removeCommandListener

public void removeCommandListener(CommandListener listener)

clone

public java.lang.Object clone(boolean clear_attributes,
                              boolean clear_locals,
                              boolean clear_listeners)