Package editor

Class GosuDocument

All Implemented Interfaces:
Serializable, Document

public class GosuDocument extends PlainDocument
This is quite primitive in that it simply provides support for lexically analyzing the Gosu source.
See Also:
  • Field Details

    • CommentAttribute

      static final Object CommentAttribute
      Key to be used in AttributeSet's holding a value of Token.
    • _pe

      private ParseResultsException _pe
    • _locations

      private List<IParseTree> _locations
    • _locationsOffset

      private int _locationsOffset
    • _charArray

      private char[] _charArray
    • _instructor

      private ITokenizerInstructor _instructor
  • Constructor Details

    • GosuDocument

      public GosuDocument()
  • Method Details

    • createScanner

      public GosuDocument.Scanner createScanner()
      Returns:
      A new lexical analyzer for this document.
    • setParseResultsException

      public void setParseResultsException(ParseResultsException pe)
    • getParseResultsException

      public ParseResultsException getParseResultsException()
    • setLocations

      public void setLocations(List<IParseTree> locations)
      The parsed Locations for the document.
    • getLocations

      public List<IParseTree> getLocations()
    • setLocationsOffset

      public void setLocationsOffset(int locationsOffset)
    • hasErrorStartingAt

      public boolean hasErrorStartingAt(int iPos)
    • getParseWarningStartingAt

      public Pair<Boolean,ParseWarningForDeprecatedMember> getParseWarningStartingAt(int iPos)
    • getStyleCodeAtPosition

      public Integer getStyleCodeAtPosition(int iPosition)
      Returns a style code for the absolute position in the document or null if no code is mapped.
    • getStyleCodeForParsedElement

      private Integer getStyleCodeForParsedElement(int iPosition, IParsedElement parsedElem)
      Given a IParsedElement return a special Style. Or return null if no special style exists for the IParsedElement.
    • getScannerStart

      public int getScannerStart(int p)
      Fetch a reasonable location to start scanning given the desired start location. This allows for adjustments needed to accomodate multiline comments.
    • insertUpdate

      protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
      Updates document structure as a result of text insertion. This will happen within a write lock. The superclass behavior of updating the line map is executed followed by marking any comment areas that should backtracked before scanning.
      Overrides:
      insertUpdate in class PlainDocument
      Parameters:
      chng - the change event
      attr - the set of attributes
    • removeUpdate

      protected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
      Updates any document structure as a result of text removal. This will happen within a write lock. The superclass behavior of updating the line map is executed followed by placing a lexical update command on the analyzer queue.
      Overrides:
      removeUpdate in class PlainDocument
      Parameters:
      chng - the change event
    • setTokenizerInstructor

      public void setTokenizerInstructor(ITokenizerInstructor tokenizerInstructor)