lexer
Class Lexer

java.lang.Object
  extended by lexer.Lexer
All Implemented Interfaces:
LexerConstants

public class Lexer
extends java.lang.Object
implements LexerConstants

A class for performing lexical analysis


Field Summary
static Token jj_nt
           
static int MAX_STRING_SIZE
          Maximum string size allowed
static Token token
           
static LexerTokenManager token_source
           
 
Fields inherited from interface lexer.LexerConstants
BOOLEAN_CONST, CLASS, DEFAULT, EOF, ID, INT_CONST, STRING_CONST, tokenImage
 
Constructor Summary
Lexer(java.io.InputStream stream)
           
Lexer(java.io.InputStream stream, java.lang.String encoding)
           
Lexer(LexerTokenManager tm)
           
Lexer(java.io.Reader stream)
           
Lexer(java.lang.String[] filenames, boolean debug)
          Lexer constructor
 
Method Summary
static void disable_tracing()
           
static void enable_tracing()
           
static ParseException generateParseException()
           
static java.lang.String getCurrFilename()
          Get the filename of the file currently being scanned
static Token getNextToken()
           
static Token getToken(int index)
           
 void printTokens()
          Print the tokens (called when using '-sl' command-line option) (note: not the best approach here -- if '-sl' is set then we scan program files twice)
static void ReInit(java.io.InputStream stream)
           
static void ReInit(java.io.InputStream stream, java.lang.String encoding)
           
 void ReInit(LexerTokenManager tm)
           
static void ReInit(java.io.Reader stream)
           
 void scan()
          Scan the tokens -- stops if lexical errors found
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_STRING_SIZE

public static final int MAX_STRING_SIZE
Maximum string size allowed

See Also:
Constant Field Values

token_source

public static LexerTokenManager token_source

token

public static Token token

jj_nt

public static Token jj_nt
Constructor Detail

Lexer

public Lexer(java.lang.String[] filenames,
             boolean debug)
Lexer constructor

Parameters:
filenames - array of filenames for the source files
debug - flag indicating whether debugging is enabled

Lexer

public Lexer(java.io.InputStream stream)

Lexer

public Lexer(java.io.InputStream stream,
             java.lang.String encoding)

Lexer

public Lexer(java.io.Reader stream)

Lexer

public Lexer(LexerTokenManager tm)
Method Detail

scan

public void scan()
          throws ParseException
Scan the tokens -- stops if lexical errors found

Throws:
ParseException

printTokens

public void printTokens()
                 throws ParseException
Print the tokens (called when using '-sl' command-line option) (note: not the best approach here -- if '-sl' is set then we scan program files twice)

Throws:
ParseException

getCurrFilename

public static java.lang.String getCurrFilename()
Get the filename of the file currently being scanned


ReInit

public static void ReInit(java.io.InputStream stream)

ReInit

public static void ReInit(java.io.InputStream stream,
                          java.lang.String encoding)

ReInit

public static void ReInit(java.io.Reader stream)

ReInit

public void ReInit(LexerTokenManager tm)

getNextToken

public static final Token getNextToken()

getToken

public static final Token getToken(int index)

generateParseException

public static ParseException generateParseException()

enable_tracing

public static final void enable_tracing()

disable_tracing

public static final void disable_tracing()