com.neoworks.rdc
Class Lexer

java.lang.Object
  |
  +--com.neoworks.rdc.Lexer

public class Lexer
extends java.lang.Object

A lexer class which will turn any input string into a list of tokens given a symbol table. The lexer is constructed by giving it the input string and the tokens to put into the symbol table. Then the list of lexed tokens can be retrived. All the lexing is done at one time not on demand. The list of tokens can then be passed. Using a parser.

See Also:
Token, Current properties ------------------ lineCommentDelim: Character for delimiting a line comment. (String) handleLineComments: Boolean.TRUE To handle comments, Boolean.FALSE otherwise. (Boolean)

Field Summary
static int DUMMY
          The dummy token type (internal only??)
static int END
          The END of the input
static int ID
          An identifier token
static int NONE
          A not real token (end of input)
static int NUM
          A number token
static int STRING
          A string token
 
Constructor Summary
Lexer(java.lang.String inputString, java.util.Vector newTokens)
          Constructor to make a new lexer with the given input string to parse.
 
Method Summary
 java.lang.Object getProperty(java.lang.String propertyName)
           
 boolean getTreatSingleQuoteAsString()
          Deprecated.  
 TokenList lexIt()
          Function to lext the input.
 void setProperty(java.lang.String propertyName, java.lang.Object property)
           
 void setTreatSingleQuoteAsString(boolean b)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMMY

public static final int DUMMY
The dummy token type (internal only??)

See Also:
Constant Field Values

NUM

public static final int NUM
A number token

See Also:
Constant Field Values

ID

public static final int ID
An identifier token

See Also:
Constant Field Values

STRING

public static final int STRING
A string token

See Also:
Constant Field Values

NONE

public static final int NONE
A not real token (end of input)

See Also:
Constant Field Values

END

public static final int END
The END of the input

See Also:
Constant Field Values
Constructor Detail

Lexer

public Lexer(java.lang.String inputString,
             java.util.Vector newTokens)
Constructor to make a new lexer with the given input string to parse. Also a vector of tokens can be passed to put into the symbol table when the lexer is initialized.

Parameters:
inputString - The input string to lex
newTokens - The tokens to put into the symbol table
Method Detail

setTreatSingleQuoteAsString

public void setTreatSingleQuoteAsString(boolean b)
Deprecated.  


getTreatSingleQuoteAsString

public boolean getTreatSingleQuoteAsString()
Deprecated.  


lexIt

public TokenList lexIt()
Function to lext the input. Scans the input and turns it into tokens. Returns the lexed output as a list of tokens.

Returns:
The list of tokens which have been lexed

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.Object property)

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)