gui.highlighting
Class JavaScanner

java.lang.Object
  extended by gui.highlighting.Scanner
      extended by gui.highlighting.JavaScanner
All Implemented Interfaces:
TokenTypes

public class JavaScanner
extends Scanner

Provide a hand-written scanner for the Java language.


Field Summary
 
Fields inherited from class gui.highlighting.Scanner
buffer, end, start, state, symbolTable
 
Fields inherited from interface gui.highlighting.TokenTypes
BINARY, BRACKET, CHARACTER, COMMENT, END_COMMENT, END_TAG, IDENTIFIER, KEYWORD, KEYWORD2, LITERAL, MID_COMMENT, NUMBER, OPERATOR, PUNCTUATION, QUOTE, SEPARATOR, START_COMMENT, STRING, TAG, typeNames, UNRECOGNIZED, URL, WHITESPACE, WORD
 
Constructor Summary
JavaScanner()
          Create a Java scanner, for Java version 1.5 by default.
 
Method Summary
protected  void initSymbolTable()
          Create the initial symbol table.
protected  Symbol lookup(int type, java.lang.String name)
          Lookup a symbol in the symbol table.
protected  int read()
          Override the read method from the Scanner class.
 
Methods inherited from class gui.highlighting.Scanner
change, find, getToken, position, 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()
Create a Java scanner, for Java version 1.5 by default.

Method Detail

read

protected int read()
Override the read method from the Scanner class.

Overrides:
read in class Scanner

initSymbolTable

protected void initSymbolTable()
Description copied from class: Scanner
Create the initial symbol table. This can be overridden to enter keywords, for example. The default implementation does nothing.

Overrides:
initSymbolTable in class Scanner

lookup

protected Symbol lookup(int type,
                        java.lang.String name)
Description copied from class: Scanner
Lookup a symbol in the symbol table. This can be overridden to implement keyword detection, for example. The default implementation just uses the table to ensure that there is only one shared occurrence of each symbol.

Overrides:
lookup in class Scanner