Interface SourceSection

All Known Implementing Classes:
NullSourceSection

public interface SourceSection
Description of contiguous section of text within a Source 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.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the index of the text position immediately following the last character in the section.
    int
    Returns the 0-based index of the first character in this section.
    int
    Returns the length of this section in characters.
    Returns text described by this section.
    Returns terse text describing this source section, typically used for printing the section.
    Gets a representation of the first line of the section, suitable for a hash key.
    Returns a short description of the source section, using just the file name, rather than its full path.
    Representation of the source program that contains this section.
    int
    Returns the 1-based column number of the first character in this section (inclusive).
    int
    Returns 1-based line number of the first character in this section (inclusive).
  • Method Details

    • 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

      String getIdentifier()
      Returns terse text describing this source section, typically used for printing the section.
      Returns:
      the identifier of the section
    • getCode

      String getCode()
      Returns text described by this section.
      Returns:
      the code as a String object
    • getShortDescription

      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