jwo.utils.syntaxhighlighter
Class JavaScanner

java.lang.Object
  extended by jwo.utils.syntaxhighlighter.Scanner
      extended by jwo.utils.syntaxhighlighter.JavaScanner
All Implemented Interfaces:
TokenTypes

public class JavaScanner
extends Scanner

A Java language scanner that highlights Java keywords, syntax etc.

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

Field Summary
 
Fields inherited from class jwo.utils.syntaxhighlighter.Scanner
buffer, end, start, state, symbolTable
 
Fields inherited from interface jwo.utils.syntaxhighlighter.TokenTypes
BRACKET, CHARACTER, COMMENT, END_COMMENT, END_TAG, IDENTIFIER, KEYWORD, KEYWORD2, LITERAL, MID_COMMENT, NUMBER, OPERATOR, PUNCTUATION, SEPARATOR, START_COMMENT, STRING, TAG, typeNames, UNRECOGNIZED, URL, WHITESPACE, WORD
 
Constructor Summary
JavaScanner()
          Creates a Java scanner, for Java version 1.5 by default.
JavaScanner(String version)
          Creates a Java scanner, for a given version.
 
Method Summary
protected  void initSymbolTable()
          Overrides initSymbolTable to create Java-specific keywords and literals.
protected  Symbol lookup(int type, String name)
          Overrides lookup, but what about unicode escape translation?
protected  int read()
          Overrides the read method from the Scanner class and processes Java syntax.
 
Methods inherited from class jwo.utils.syntaxhighlighter.Scanner
change, find, getToken, position, remove, scan, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScanner

public JavaScanner()
Creates a Java scanner, for Java version 1.5 by default.


JavaScanner

public JavaScanner(String version)
Creates a Java scanner, for a given version.

Parameters:
version - Java version to scan. Should be between "1.1" and "1.5".
Method Detail

read

protected int read()
Overrides the read method from the Scanner class and processes Java syntax.

Overrides:
read in class Scanner
Returns:
Type of token that has been read.

initSymbolTable

protected void initSymbolTable()
Overrides initSymbolTable to create Java-specific keywords and literals.

Overrides:
initSymbolTable in class Scanner

lookup

protected Symbol lookup(int type,
                        String name)
Overrides lookup, but what about unicode escape translation?

Overrides:
lookup in class Scanner
Parameters:
type - Type of symbol to look for.
name - Name of symbol to look for.
Returns:
Symbol found, or new symbol if not present in lookup table.


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