Package com.googlecode.aviator.lexer
Class SymbolTable
- java.lang.Object
-
- com.googlecode.aviator.lexer.SymbolTable
-
- All Implemented Interfaces:
java.io.Serializable
public class SymbolTable extends java.lang.Object implements java.io.Serializable
Symbol table- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,Variable>
RESERVED
private static long
serialVersionUID
private java.util.Map<java.lang.String,Variable>
table
-
Constructor Summary
Constructors Constructor Description SymbolTable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Variable
getVariable(java.lang.String name)
Get variable by nameboolean
isReserved(java.lang.String name)
Check variable has been reserved?static boolean
isReservedKeyword(Variable v)
static boolean
isReservedKeyword(java.lang.String name)
Token<?>
reserve(Variable variable)
Variable
reserve(java.lang.String lexeme)
private static void
reserveKeyword(Variable v)
static Variable
tryReserveKeyword(Variable var)
Try to reserve key word, return the reserved variable if success, otherwise return itself.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
table
private final java.util.Map<java.lang.String,Variable> table
-
RESERVED
private static final java.util.Map<java.lang.String,Variable> RESERVED
-
-
Method Detail
-
reserveKeyword
private static void reserveKeyword(Variable v)
-
isReservedKeyword
public static boolean isReservedKeyword(java.lang.String name)
-
isReservedKeyword
public static boolean isReservedKeyword(Variable v)
-
isReserved
public boolean isReserved(java.lang.String name)
Check variable has been reserved?- Parameters:
name
-- Returns:
-
tryReserveKeyword
public static Variable tryReserveKeyword(Variable var)
Try to reserve key word, return the reserved variable if success, otherwise return itself.- Parameters:
var
-- Returns:
-
getVariable
public Variable getVariable(java.lang.String name)
Get variable by name- Parameters:
name
-- Returns:
-
reserve
public Variable reserve(java.lang.String lexeme)
-
-