jwo.utils.syntaxhighlighter
Interface TokenTypes

All Known Implementing Classes:
JavaScanner, Scanner, ScriptScanner, SyntaxHighlighter

public interface TokenTypes

The TokenTypes interface defines the integer constants representing different types of tokens, for use with any languages. The constants are used in symbols to represent the types of similar tokens, and in scanners as scanner states, and in highlighters to determine the colour or style of tokens. There is also an array typeNames of textual names, indexed by type, for descriptive purposes.

The UNRECOGNIZED constant (zero) is for tokens which are completely unrecognised, usually consisting of a single illegal character. Other error tokens are represented by negative types, where -t represents an incomplete or malformed token of type t. An error token usually consists of the maximal legal substring of the source text.

The WHITESPACE constant is used to classify tokens which are to be discarded, it acts as a suitable scanner state at the beginning of a document, and it is used for the usual end-of-text sentinel token which marks the end of the document. Comments can optionally be classified as WHITESPACE and discarded, if they are not needed for highlighting. No other types besides UNRECOGNIZED and WHITESPACE are treated specially.

The constants are presented as an interface so that any class can implement the interface and use the names of the constants directly, without prefixing them with a class name.

Version:
1.0, February, 2006 modified 15th February, 2006.
Author:
Henk Muller, Minor modifications, Jo Wood.

Field Summary
static int BRACKET
           
static int CHARACTER
           
static int COMMENT
           
static int END_COMMENT
           
static int END_TAG
           
static int IDENTIFIER
           
static int KEYWORD
           
static int KEYWORD2
           
static int LITERAL
           
static int MID_COMMENT
           
static int NUMBER
           
static int OPERATOR
           
static int PUNCTUATION
           
static int SEPARATOR
           
static int START_COMMENT
           
static int STRING
           
static int TAG
           
static String[] typeNames
          The names of the token types, indexed by type, are provided for descriptive purposes and for use by properties files.
static int UNRECOGNIZED
           
static int URL
           
static int WHITESPACE
           
static int WORD
           
 

Field Detail

UNRECOGNIZED

static final int UNRECOGNIZED
See Also:
Constant Field Values

WHITESPACE

static final int WHITESPACE
See Also:
Constant Field Values

WORD

static final int WORD
See Also:
Constant Field Values

NUMBER

static final int NUMBER
See Also:
Constant Field Values

PUNCTUATION

static final int PUNCTUATION
See Also:
Constant Field Values

COMMENT

static final int COMMENT
See Also:
Constant Field Values

START_COMMENT

static final int START_COMMENT
See Also:
Constant Field Values

MID_COMMENT

static final int MID_COMMENT
See Also:
Constant Field Values

END_COMMENT

static final int END_COMMENT
See Also:
Constant Field Values

TAG

static final int TAG
See Also:
Constant Field Values

END_TAG

static final int END_TAG
See Also:
Constant Field Values

KEYWORD

static final int KEYWORD
See Also:
Constant Field Values

KEYWORD2

static final int KEYWORD2
See Also:
Constant Field Values

IDENTIFIER

static final int IDENTIFIER
See Also:
Constant Field Values

LITERAL

static final int LITERAL
See Also:
Constant Field Values

STRING

static final int STRING
See Also:
Constant Field Values

CHARACTER

static final int CHARACTER
See Also:
Constant Field Values

OPERATOR

static final int OPERATOR
See Also:
Constant Field Values

BRACKET

static final int BRACKET
See Also:
Constant Field Values

SEPARATOR

static final int SEPARATOR
See Also:
Constant Field Values

URL

static final int URL
See Also:
Constant Field Values

typeNames

static final String[] typeNames
The names of the token types, indexed by type, are provided for descriptive purposes and for use by properties files.



Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009