org.apache.bsf.engines.javascript

Class FnOrScript


public class FnOrScript
extends java.lang.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).

Field Summary

protected Vector
m_breakpoints
protected DocumentCell
m_cell
protected int
m_charCount
protected int
m_column
protected Hashtable
m_functionMap
protected int
m_lineCount
protected boolean
m_lineDefined
protected int
m_offset
protected Script
m_script
protected int
m_startLine
protected StringBuffer
m_text
protected Vector
m_units

Constructor Summary

FnOrScript(DocumentCell cell)

Method Summary

BreakPoint
addBreakpoint(BreakPoint bp)
void
addCompilationUnit(Context cx, DebuggableScript dbgScript, StringBuffer source)
void
compile(Context cx, Scriptable global)
protected BreakPoint
createBreakpoint(BreakPoint bp)
BreakPoint
findBreakpointAtLine(int lineno)
BreakPoint
findBreakpointAtOffset(int offset)
int
getCharCount()
int
getColumn()
DocumentCell
getDocument()
int
getFirstLine()
StringBuffer
getFnOrScriptAsStringBuffer()
int
getLineCount()
int
getOffset()
Script
getScript()
BreakPoint
removeBreakpoint(int bpid)
void
specifyLinesPos(Reader reader, int startLine, int column)
void
specifyRange(Reader reader, int offset)

Field Details

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 Details

FnOrScript

public FnOrScript(DocumentCell cell)

Method Details

addBreakpoint

public BreakPoint addBreakpoint(BreakPoint bp)


addCompilationUnit

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


compile

public void compile(Context cx,
                    Scriptable global)
            throws BSFException,
                   IOException


createBreakpoint

protected BreakPoint createBreakpoint(BreakPoint bp)


findBreakpointAtLine

public BreakPoint findBreakpointAtLine(int lineno)
            throws BSFException


findBreakpointAtOffset

public BreakPoint findBreakpointAtOffset(int offset)
            throws BSFException


getCharCount

public int getCharCount()
            throws BSFException


getColumn

public int getColumn()
            throws BSFException


getDocument

public DocumentCell getDocument()


getFirstLine

public int getFirstLine()
            throws BSFException


getFnOrScriptAsStringBuffer

public StringBuffer getFnOrScriptAsStringBuffer()


getLineCount

public int getLineCount()
            throws BSFException


getOffset

public int getOffset()
            throws BSFException


getScript

public Script getScript()


removeBreakpoint

public BreakPoint removeBreakpoint(int bpid)


specifyLinesPos

public void specifyLinesPos(Reader reader,
                            int startLine,
                            int column)
            throws BSFException,
                   IOException


specifyRange

public void specifyRange(Reader reader,
                         int offset)
            throws BSFException,
                   IOException