Class TokenScanner

java.lang.Object
org.fife.rsta.ac.common.TokenScanner

public class TokenScanner extends Object
Returns non-whitespace, non-comment tokens from an RSyntaxDocument, one at a time. This can be used by simplistic LanguageSupports to "parse" for simple, easily-identifiable tokens, such as curly braces and TokenTypes.VARIABLEs. For example, to identify code blocks for languages structured like C and Java, you can use this class in conjunction with CodeBlock and VariableDeclaration to create an easily-parsable model of your source code.
Version:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.fife.ui.rsyntaxtextarea.RSyntaxDocument
     
    private int
     
    private Element
     
    private org.fife.ui.rsyntaxtextarea.Token
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TokenScanner(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc)
     
    TokenScanner(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.fife.ui.rsyntaxtextarea.RSyntaxDocument
    Returns the document being parsed.
    org.fife.ui.rsyntaxtextarea.Token
    Returns the next non-whitespace, non-comment token in the text area.
    private org.fife.ui.rsyntaxtextarea.Token
    Returns the next token in the text area.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • doc

      private org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc
    • root

      private Element root
    • t

      private org.fife.ui.rsyntaxtextarea.Token t
    • line

      private int line
  • Constructor Details

    • TokenScanner

      public TokenScanner(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
    • TokenScanner

      public TokenScanner(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc)
  • Method Details

    • getDocument

      public org.fife.ui.rsyntaxtextarea.RSyntaxDocument getDocument()
      Returns the document being parsed.
      Returns:
      The document.
    • next

      public org.fife.ui.rsyntaxtextarea.Token next()
      Returns the next non-whitespace, non-comment token in the text area.
      Returns:
      The next token, or null if we are at the end of its document.
    • nextRaw

      private org.fife.ui.rsyntaxtextarea.Token nextRaw()
      Returns the next token in the text area.
      Returns:
      The next token, or null if we are at the end of its document.