jwo.landserf.script
Class ScriptScanner

java.lang.Object
  extended by jwo.utils.syntaxhighlighter.Scanner
      extended by jwo.landserf.script.ScriptScanner
All Implemented Interfaces:
TokenTypes

public class ScriptScanner
extends Scanner

A Landscript language scanner that highlights LandScript keywords, syntax etc.

Version:
2.3, 27th September, 2008.
Author:
Jo Wood, based on code originally provided by Henk Muller

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
ScriptScanner()
          Creates a LandScript scanner that can provide syntax highlighting of LandScript.
ScriptScanner(String version)
          Creates a LandsScript scanner, for a given version.
 
Method Summary
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 LandScript syntax.
 void setCommands(HashSet commands)
          Sets the commands to be highlighted by the scanner.
 void setFunctions(HashSet functions)
          Sets the map algebra functions to be highlighted by the scanner.
 void setVariables(Set variables)
          Sets the map variables to be highlighted by the scanner.
 void setVariableTypes(HashSet varTypes)
          Sets the script variable types to be highlighted by the scanner.
 
Methods inherited from class jwo.utils.syntaxhighlighter.Scanner
change, find, getToken, initSymbolTable, position, remove, scan, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptScanner

public ScriptScanner()
Creates a LandScript scanner that can provide syntax highlighting of LandScript.


ScriptScanner

public ScriptScanner(String version)
Creates a LandsScript scanner, for a given version.

Parameters:
version - LandScript version to scan. Currently only supports '1.0'.
Method Detail

setCommands

public void setCommands(HashSet commands)
Sets the commands to be highlighted by the scanner.

Parameters:
commands - List of commands.

setFunctions

public void setFunctions(HashSet functions)
Sets the map algebra functions to be highlighted by the scanner.

Parameters:
functions - List of functions.

setVariableTypes

public void setVariableTypes(HashSet varTypes)
Sets the script variable types to be highlighted by the scanner.

Parameters:
varTypes - List of variable types.

setVariables

public void setVariables(Set variables)
Sets the map variables to be highlighted by the scanner.

Parameters:
variables - List of variables.

read

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

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

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