Package com.oracle.truffle.api.source
Interface SourceSection
-
- All Known Implementing Classes:
NullSourceSection
public interface SourceSection
Description of contiguous section of text within aSource
of program code; supports multiple modes of access to the text and its location. A special null subtype should be used for code that is not available from source, e.g language builtins.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getCharEndIndex()
Returns the index of the text position immediately following the last character in the section.int
getCharIndex()
Returns the 0-based index of the first character in this section.int
getCharLength()
Returns the length of this section in characters.java.lang.String
getCode()
Returns text described by this section.java.lang.String
getIdentifier()
Returns terse text describing this source section, typically used for printing the section.LineLocation
getLineLocation()
Gets a representation of the first line of the section, suitable for a hash key.java.lang.String
getShortDescription()
Returns a short description of the source section, using just the file name, rather than its full path.Source
getSource()
Representation of the source program that contains this section.int
getStartColumn()
Returns the 1-based column number of the first character in this section (inclusive).int
getStartLine()
Returns 1-based line number of the first character in this section (inclusive).
-
-
-
Method Detail
-
getSource
Source getSource()
Representation of the source program that contains this section.- Returns:
- the source object
-
getStartLine
int getStartLine()
Returns 1-based line number of the first character in this section (inclusive).- Returns:
- the starting line number
-
getLineLocation
LineLocation getLineLocation()
Gets a representation of the first line of the section, suitable for a hash key.
-
getStartColumn
int getStartColumn()
Returns the 1-based column number of the first character in this section (inclusive).- Returns:
- the starting column number
-
getCharIndex
int getCharIndex()
Returns the 0-based index of the first character in this section.- Returns:
- the starting character index
-
getCharLength
int getCharLength()
Returns the length of this section in characters.- Returns:
- the number of characters in the section
-
getCharEndIndex
int getCharEndIndex()
Returns the index of the text position immediately following the last character in the section.- Returns:
- the end position of the section
-
getIdentifier
java.lang.String getIdentifier()
Returns terse text describing this source section, typically used for printing the section.- Returns:
- the identifier of the section
-
getCode
java.lang.String getCode()
Returns text described by this section.- Returns:
- the code as a String object
-
getShortDescription
java.lang.String getShortDescription()
Returns a short description of the source section, using just the file name, rather than its full path.- Returns:
- a short description of the source section
-
-