org.apache.bsf.engines.javascript

Class FnOrScript

public class FnOrScript extends Object

This class represents a function or script, that is, a piece of a document that is provided to the JavaScript engine for evaluation, execution, or simply compilation. A FnOrScript represents a range of lines or characters in its document. For now, Rhino only supports ranges of lines, really, but the code for offsets is there anyway. Warning: Offsets have never been quite tested yet... A FnOrScript has compilation units. When Rhino compiles a function or a script, even in interpreted mode where the compilation is done to JavaScript bytecode, it calls back its debugger with different compilation units; see Debugger::handleCompilationDone method on the RhinoEngineDebugger class. A FnOrScript also keeps track of the known breakpoints in its range of lines or characters. It makes sure that they are propagated to the underlying Rhino engine (i.e. set) as well as unpropagated (i.e. unset).

UNKNOWN: Olivier Gruber

Field Summary
protected Vectorm_breakpoints
protected DocumentCellm_cell
protected intm_charCount
protected intm_column
protected Hashtablem_functionMap
protected intm_lineCount
protected booleanm_lineDefined
protected intm_offset
protected Scriptm_script
protected intm_startLine
protected StringBufferm_text
protected Vectorm_units
Constructor Summary
FnOrScript(DocumentCell cell)
Method Summary
BreakPointaddBreakpoint(BreakPoint bp)
voidaddCompilationUnit(Context cx, DebuggableScript dbgScript, StringBuffer source)
voidcompile(Context cx, Scriptable global)
protected BreakPointcreateBreakpoint(BreakPoint bp)
BreakPointfindBreakpointAtLine(int lineno)
BreakPointfindBreakpointAtOffset(int offset)
intgetCharCount()
intgetColumn()
DocumentCellgetDocument()
intgetFirstLine()
StringBuffergetFnOrScriptAsStringBuffer()
intgetLineCount()
intgetOffset()
ScriptgetScript()
BreakPointremoveBreakpoint(int bpid)
voidspecifyLinesPos(Reader reader, int startLine, int column)
voidspecifyRange(Reader reader, int offset)

Field Detail

m_breakpoints

protected Vector m_breakpoints

m_cell

protected DocumentCell m_cell

m_charCount

protected int m_charCount

m_column

protected int m_column

m_functionMap

protected Hashtable m_functionMap

m_lineCount

protected int m_lineCount

m_lineDefined

protected boolean m_lineDefined

m_offset

protected int m_offset

m_script

protected Script m_script

m_startLine

protected int m_startLine

m_text

protected StringBuffer m_text

m_units

protected Vector m_units

Constructor Detail

FnOrScript

public FnOrScript(DocumentCell cell)

Method Detail

addBreakpoint

public BreakPoint addBreakpoint(BreakPoint bp)

addCompilationUnit

public void addCompilationUnit(Context cx, DebuggableScript dbgScript, StringBuffer source)

compile

public void compile(Context cx, Scriptable global)

createBreakpoint

protected BreakPoint createBreakpoint(BreakPoint bp)

findBreakpointAtLine

public BreakPoint findBreakpointAtLine(int lineno)

findBreakpointAtOffset

public BreakPoint findBreakpointAtOffset(int offset)

getCharCount

public int getCharCount()

getColumn

public int getColumn()

getDocument

public DocumentCell getDocument()

getFirstLine

public int getFirstLine()

getFnOrScriptAsStringBuffer

public StringBuffer getFnOrScriptAsStringBuffer()

getLineCount

public int getLineCount()

getOffset

public int getOffset()

getScript

public Script getScript()

removeBreakpoint

public BreakPoint removeBreakpoint(int bpid)

specifyLinesPos

public void specifyLinesPos(Reader reader, int startLine, int column)

specifyRange

public void specifyRange(Reader reader, int offset)