at.dms.lexgen
Class DefinitionFile

java.lang.Object
  |
  +--at.dms.lexgen.DefinitionFile

class DefinitionFile
extends java.lang.Object

A token definition file for the lexer generator.


Constructor Summary
DefinitionFile(java.lang.String sourceFile, java.lang.String packageName, java.lang.String vocabulary, java.lang.String prefix, java.util.List definitions)
          Constructs a token definition file.
 
Method Summary
 int checkIdentifiers(java.util.Map identifiers, java.lang.String prefix, int id)
          Check for duplicate identifiers.
 java.lang.String getClassName()
          Returns the class name.
 java.lang.String getPackageName()
          Returns the package name.
 java.lang.String getPrefix()
          Returns the literal prefix.
 java.lang.String getVocabulary()
          Returns the vocabulary name,
 void printDefinition(java.io.PrintWriter out, java.lang.String prefix)
          Prints token definitions to definition file.
 void printInterface(java.io.PrintWriter out, java.lang.String parent)
          Prints the token definition to interface file.
 void putKeywords(java.util.List keywords, java.util.List types, java.lang.String prefix)
          Adds keywords to list.
static DefinitionFile read(java.lang.String sourceFile)
          Reads and parses a token definition file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionFile

public DefinitionFile(java.lang.String sourceFile,
                      java.lang.String packageName,
                      java.lang.String vocabulary,
                      java.lang.String prefix,
                      java.util.List definitions)
Constructs a token definition file.
Method Detail

read

public static DefinitionFile read(java.lang.String sourceFile)
                           throws LexgenError
Reads and parses a token definition file.
Parameters:
sourceFile - The name of the source file.
Returns:
A class info structure holding the information from the source.

checkIdentifiers

public int checkIdentifiers(java.util.Map identifiers,
                            java.lang.String prefix,
                            int id)
                     throws LexgenError
Check for duplicate identifiers.
Parameters:
identifiers - A table of all token identifiers.
prefix - The literal prefix.
id - The id of the first token.
Returns:
The id of the last token + 1

printDefinition

public void printDefinition(java.io.PrintWriter out,
                            java.lang.String prefix)
Prints token definitions to definition file.
Parameters:
out - the output stream.
prefix - the literal prefix.

printInterface

public void printInterface(java.io.PrintWriter out,
                           java.lang.String parent)
Prints the token definition to interface file.
Parameters:
out - The output stream.
parent - The super interface.

putKeywords

public void putKeywords(java.util.List keywords,
                        java.util.List types,
                        java.lang.String prefix)
Adds keywords to list.

getClassName

public java.lang.String getClassName()
Returns the class name.

getPackageName

public java.lang.String getPackageName()
Returns the package name.

getVocabulary

public java.lang.String getVocabulary()
Returns the vocabulary name,

getPrefix

public java.lang.String getPrefix()
Returns the literal prefix.