Package com.oracle.truffle.api.source
Class NullSourceSection
java.lang.Object
com.oracle.truffle.api.source.NullSourceSection
- All Implemented Interfaces:
SourceSection
A special subtype of
SourceSection
that represents unavailable source, e.g. for language
builtins.-
Constructor Summary
ConstructorsConstructorDescriptionNullSourceSection
(String kind, String name) Placeholder for source that is unavailable, e.g.NullSourceSection
(String kind, String name, String asCode) Placeholder for source that is unavailable, e.g. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Returns the index of the text position immediately following the last character in the section.final int
Returns the 0-based index of the first character in this section.final int
Returns the length of this section in characters.final String
getCode()
Returns text described by this section.final String
Returns terse text describing this source section, typically used for printing the section.final LineLocation
Gets a representation of the first line of the section, suitable for a hash key.final String
Returns a short description of the source section, using just the file name, rather than its full path.final Source
Representation of the source program that contains this section.final int
Returns the 1-based column number of the first character in this section (inclusive).final int
Returns 1-based line number of the first character in this section (inclusive).toString()
-
Constructor Details
-
NullSourceSection
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
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 Details
-
getSource
Description copied from interface:SourceSection
Representation of the source program that contains this section.- Specified by:
getSource
in interfaceSourceSection
- Returns:
- the source object
-
getStartLine
public final int getStartLine()Description copied from interface:SourceSection
Returns 1-based line number of the first character in this section (inclusive).- Specified by:
getStartLine
in interfaceSourceSection
- Returns:
- the starting line number
-
getLineLocation
Description copied from interface:SourceSection
Gets a representation of the first line of the section, suitable for a hash key.- Specified by:
getLineLocation
in interfaceSourceSection
-
getStartColumn
public final int getStartColumn()Description copied from interface:SourceSection
Returns the 1-based column number of the first character in this section (inclusive).- Specified by:
getStartColumn
in interfaceSourceSection
- Returns:
- the starting column number
-
getCharIndex
public final int getCharIndex()Description copied from interface:SourceSection
Returns the 0-based index of the first character in this section.- Specified by:
getCharIndex
in interfaceSourceSection
- Returns:
- the starting character index
-
getCharLength
public final int getCharLength()Description copied from interface:SourceSection
Returns the length of this section in characters.- Specified by:
getCharLength
in interfaceSourceSection
- Returns:
- the number of characters in the section
-
getCharEndIndex
public final int getCharEndIndex()Description copied from interface:SourceSection
Returns the index of the text position immediately following the last character in the section.- Specified by:
getCharEndIndex
in interfaceSourceSection
- Returns:
- the end position of the section
-
getIdentifier
Description copied from interface:SourceSection
Returns terse text describing this source section, typically used for printing the section.- Specified by:
getIdentifier
in interfaceSourceSection
- Returns:
- the identifier of the section
-
getCode
Description copied from interface:SourceSection
Returns text described by this section.- Specified by:
getCode
in interfaceSourceSection
- Returns:
- the code as a String object
-
getShortDescription
Description copied from interface:SourceSection
Returns a short description of the source section, using just the file name, rather than its full path.- Specified by:
getShortDescription
in interfaceSourceSection
- Returns:
- a short description of the source section
-
toString
-