Class LexerBasedHighlighter

  • All Implemented Interfaces:
    SyntaxHighlighter
    Direct Known Subclasses:
    ScalaSyntaxHighlighter

    public abstract class LexerBasedHighlighter
    extends java.lang.Object
    implements SyntaxHighlighter
    Language-specific engine for syntax highlighting.
    Since:
    6.19.0
    Author:
    Clément Fournier
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  LexerBasedHighlighter.JflexLexer
      Generated lexers should implement this interface.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected LexerBasedHighlighter​(java.lang.String languageName)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      org.fxmisc.richtext.model.StyleSpans<java.util.Collection<java.lang.String>> computeHighlighting​(java.lang.String text)
      Computes the syntax highlighting on the given text.
      java.lang.String getLanguageTerseName()
      Gets the terse name of the language this highlighter cares for.
      protected abstract LexerBasedHighlighter.JflexLexer newLexer​(java.lang.String text, java.util.Set<java.lang.String> baseClasses)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LexerBasedHighlighter

        protected LexerBasedHighlighter​(java.lang.String languageName)
    • Method Detail

      • computeHighlighting

        public org.fxmisc.richtext.model.StyleSpans<java.util.Collection<java.lang.String>> computeHighlighting​(java.lang.String text)
        Description copied from interface: SyntaxHighlighter
        Computes the syntax highlighting on the given text. The returned spans are exactly the length of the given text.
        Specified by:
        computeHighlighting in interface SyntaxHighlighter
        Parameters:
        text - The text
        Returns:
        The computed style spans
      • getLanguageTerseName

        public final java.lang.String getLanguageTerseName()
        Description copied from interface: SyntaxHighlighter
        Gets the terse name of the language this highlighter cares for. That's used as a css class for text regions.
        Specified by:
        getLanguageTerseName in interface SyntaxHighlighter
        Returns:
        The terse name of the language