net.sf.xslthl.highlighters
Class KeywordsHighlighter

java.lang.Object
  extended by net.sf.xslthl.Highlighter
      extended by net.sf.xslthl.highlighters.KeywordsHighlighter

public class KeywordsHighlighter
extends Highlighter

Scans for registered keywords Accepted parameters:

keywords
Keywords this highlighter recognizes. Can be used multiple times
ignoreCase
If this element is present the keywords are case insensitive.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.xslthl.Highlighter
Highlighter.IgnoreCaseComparator
 
Field Summary
protected  boolean exclusiveChars
          If true, then startChars and partChars are the only characters accepted for the identifiers
protected  boolean ignoreCase
          Ignore case of the keywords.
protected  Collection<String> keywords
          the keywords this highligher accepts
protected  String partChars
          Optional extra character sequence that defines the part of an identifier
protected  String startChars
          Optional extra character sequence that defines the start of an identifier
 
Fields inherited from class net.sf.xslthl.Highlighter
styleName, XMLname
 
Constructor Summary
KeywordsHighlighter()
           
 
Method Summary
protected  void appendUnique(StringBuilder buf, char ch)
           
 String getDefaultStyle()
          The default style name
 boolean highlight(CharIter in, List<Block> out)
          Perform highlighting on the current token stream.
 void init(Params params)
          Initializer
protected  boolean isIdentifierPart(char ch)
           
protected  boolean isIdentifierStart(char ch)
           
 boolean startsWith(CharIter in)
          return true if the current character is a possible match for this highlighter
 
Methods inherited from class net.sf.xslthl.Highlighter
isNewLine, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keywords

protected Collection<String> keywords
the keywords this highligher accepts


ignoreCase

protected boolean ignoreCase
Ignore case of the keywords.


startChars

protected String startChars
Optional extra character sequence that defines the start of an identifier


partChars

protected String partChars
Optional extra character sequence that defines the part of an identifier


exclusiveChars

protected boolean exclusiveChars
If true, then startChars and partChars are the only characters accepted for the identifiers

Constructor Detail

KeywordsHighlighter

public KeywordsHighlighter()
Method Detail

init

public void init(Params params)
          throws HighlighterConfigurationException
Description copied from class: Highlighter
Initializer

Overrides:
init in class Highlighter
Throws:
HighlighterConfigurationException

appendUnique

protected void appendUnique(StringBuilder buf,
                            char ch)

startsWith

public boolean startsWith(CharIter in)
Description copied from class: Highlighter
return true if the current character is a possible match for this highlighter

Overrides:
startsWith in class Highlighter
Returns:

highlight

public boolean highlight(CharIter in,
                         List<Block> out)
Description copied from class: Highlighter
Perform highlighting on the current token stream. Return true when highlighting was performed, or false in case of a false positive.

Specified by:
highlight in class Highlighter
Returns:

getDefaultStyle

public String getDefaultStyle()
Description copied from class: Highlighter
The default style name

Specified by:
getDefaultStyle in class Highlighter
Returns:

isIdentifierStart

protected boolean isIdentifierStart(char ch)
Parameters:
ch -
Returns:
True if this character is a valid start of an identifier

isIdentifierPart

protected boolean isIdentifierPart(char ch)
Parameters:
ch -
Returns:
True if this character is a valid part of an identifier


Copyright © 2005-2014. All Rights Reserved.