Package com.oracle.truffle.api.source
Class NullSourceSection
- java.lang.Object
-
- com.oracle.truffle.api.source.NullSourceSection
-
- All Implemented Interfaces:
SourceSection
public class NullSourceSection extends java.lang.Object implements SourceSection
A special subtype ofSourceSectionthat represents unavailable source, e.g. for language builtins.
-
-
Constructor Summary
Constructors Constructor Description NullSourceSection(java.lang.String kind, java.lang.String name)Placeholder for source that is unavailable, e.g.NullSourceSection(java.lang.String kind, java.lang.String name, java.lang.String asCode)Placeholder for source that is unavailable, e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCharEndIndex()Returns the index of the text position immediately following the last character in the section.intgetCharIndex()Returns the 0-based index of the first character in this section.intgetCharLength()Returns the length of this section in characters.java.lang.StringgetCode()Returns text described by this section.java.lang.StringgetIdentifier()Returns terse text describing this source section, typically used for printing the section.LineLocationgetLineLocation()Gets a representation of the first line of the section, suitable for a hash key.java.lang.StringgetShortDescription()Returns a short description of the source section, using just the file name, rather than its full path.SourcegetSource()Representation of the source program that contains this section.intgetStartColumn()Returns the 1-based column number of the first character in this section (inclusive).intgetStartLine()Returns 1-based line number of the first character in this section (inclusive).java.lang.StringtoString()
-
-
-
Constructor Detail
-
NullSourceSection
public NullSourceSection(java.lang.String kind, java.lang.String name)Placeholder for source that is unavailable, e.g. for language builtins.- Parameters:
kind- the general category, e.g. "JS builtin"name- specific name for this section
-
NullSourceSection
public NullSourceSection(java.lang.String kind, java.lang.String name, java.lang.String asCode)Placeholder for source that is unavailable, e.g. for language builtins.- Parameters:
kind- the general category, e.g. "JS builtin"name- specific name for this sectionasCode- string to return whengetCode()is called
-
-
Method Detail
-
getSource
public final Source getSource()
Description copied from interface:SourceSectionRepresentation of the source program that contains this section.- Specified by:
getSourcein interfaceSourceSection- Returns:
- the source object
-
getStartLine
public final int getStartLine()
Description copied from interface:SourceSectionReturns 1-based line number of the first character in this section (inclusive).- Specified by:
getStartLinein interfaceSourceSection- Returns:
- the starting line number
-
getLineLocation
public final LineLocation getLineLocation()
Description copied from interface:SourceSectionGets a representation of the first line of the section, suitable for a hash key.- Specified by:
getLineLocationin interfaceSourceSection
-
getStartColumn
public final int getStartColumn()
Description copied from interface:SourceSectionReturns the 1-based column number of the first character in this section (inclusive).- Specified by:
getStartColumnin interfaceSourceSection- Returns:
- the starting column number
-
getCharIndex
public final int getCharIndex()
Description copied from interface:SourceSectionReturns the 0-based index of the first character in this section.- Specified by:
getCharIndexin interfaceSourceSection- Returns:
- the starting character index
-
getCharLength
public final int getCharLength()
Description copied from interface:SourceSectionReturns the length of this section in characters.- Specified by:
getCharLengthin interfaceSourceSection- Returns:
- the number of characters in the section
-
getCharEndIndex
public final int getCharEndIndex()
Description copied from interface:SourceSectionReturns the index of the text position immediately following the last character in the section.- Specified by:
getCharEndIndexin interfaceSourceSection- Returns:
- the end position of the section
-
getIdentifier
public final java.lang.String getIdentifier()
Description copied from interface:SourceSectionReturns terse text describing this source section, typically used for printing the section.- Specified by:
getIdentifierin interfaceSourceSection- Returns:
- the identifier of the section
-
getCode
public final java.lang.String getCode()
Description copied from interface:SourceSectionReturns text described by this section.- Specified by:
getCodein interfaceSourceSection- Returns:
- the code as a String object
-
getShortDescription
public final java.lang.String getShortDescription()
Description copied from interface:SourceSectionReturns a short description of the source section, using just the file name, rather than its full path.- Specified by:
getShortDescriptionin interfaceSourceSection- Returns:
- a short description of the source section
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-