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.SerializableSymbol table- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,Variable>RESERVEDprivate static longserialVersionUIDprivate 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 VariablegetVariable(java.lang.String name)Get variable by namebooleanisReserved(java.lang.String name)Check variable has been reserved?static booleanisReservedKeyword(Variable v)static booleanisReservedKeyword(java.lang.String name)Token<?>reserve(Variable variable)Variablereserve(java.lang.String lexeme)private static voidreserveKeyword(Variable v)static VariabletryReserveKeyword(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)
-
-