org.jruby.ast.executable
Class ISeqPosition

java.lang.Object
  extended by org.jruby.ast.executable.ISeqPosition
All Implemented Interfaces:
ISourcePosition

public class ISeqPosition
extends java.lang.Object
implements ISourcePosition

Author:
Ola Bini

Constructor Summary
ISeqPosition(YARVMachine.InstructionSequence iseq)
           
 
Method Summary
 void adjustStartOffset(int relativeValue)
          Modify startOffset by a relativeValue.
 int getEndLine()
          Which is the last(end) line that this source position occurs on (zero-based)
 int getEndOffset()
          Get offset (relative to beginning of source file) immediately after the last character represented by this source position
 java.lang.String getFile()
          Which file does this source position live in?
 int getStartLine()
          Which is the first(start) line that this source position occurs on (zero-based)
 int getStartOffset()
          Get offset (relative to beginning of source file) immediately before first character represented by this source position.
 ISourcePosition union(ISourcePosition position)
          Calculates the logical union of the two positions and creates a new resulting position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISeqPosition

public ISeqPosition(YARVMachine.InstructionSequence iseq)
Method Detail

getFile

public java.lang.String getFile()
Description copied from interface: ISourcePosition
Which file does this source position live in?

Specified by:
getFile in interface ISourcePosition
Returns:
name of the source file.

getStartLine

public int getStartLine()
Description copied from interface: ISourcePosition
Which is the first(start) line that this source position occurs on (zero-based)

Specified by:
getStartLine in interface ISourcePosition
Returns:

getEndLine

public int getEndLine()
Description copied from interface: ISourcePosition
Which is the last(end) line that this source position occurs on (zero-based)

Specified by:
getEndLine in interface ISourcePosition
Returns:
the line

adjustStartOffset

public void adjustStartOffset(int relativeValue)
Description copied from interface: ISourcePosition
Modify startOffset by a relativeValue. At times our grammar and lexer do not give us the exact positions we need so we need to manually tweak position. The bummer of this is this requires ISourcePosition implementations are mutable.

Specified by:
adjustStartOffset in interface ISourcePosition
Parameters:
relativeValue - to nudge startOffset up or down

getStartOffset

public int getStartOffset()
Description copied from interface: ISourcePosition
Get offset (relative to beginning of source file) immediately before first character represented by this source position.

Specified by:
getStartOffset in interface ISourcePosition
Returns:
the offset

getEndOffset

public int getEndOffset()
Description copied from interface: ISourcePosition
Get offset (relative to beginning of source file) immediately after the last character represented by this source position

Specified by:
getEndOffset in interface ISourcePosition
Returns:
the offset

union

public ISourcePosition union(ISourcePosition position)
Description copied from interface: ISourcePosition
Calculates the logical union of the two positions and creates a new resulting position

Specified by:
union in interface ISourcePosition
Parameters:
position - to be unioned against this position
Returns:
a new position


Copyright © 2002-2007 JRuby Team. All Rights Reserved.