public class Constants
extends java.lang.Object
A named constant in an expression is substituted by its associated value when the expression is evaluated. The constants are stored in a hash table, using their names as key. The value of each constant is wrapped in a data token.
PtParser
Modifier and Type | Method and Description |
---|---|
static void |
add(java.lang.String name,
Token value)
Add a constant with the given name and value to the table.
|
static RecordToken |
constants()
Return a record representation of the constants.
|
static Token |
get(java.lang.String name)
Look up the value of the constant with the given name.
|
static Type |
nameToType(java.lang.String name)
Given a name defining a type, return the type, or null if
there is no such type.
|
static void |
remove(java.lang.String name)
Remove the constant with the given name from the table.
|
static java.util.TreeMap |
types()
Return a map from names to types, with the names sorted alphabetically.
|
public static void add(java.lang.String name, Token value)
name
- The name of the constant.value
- The value of the constant, wrapped in a data token.public static RecordToken constants()
public static Token get(java.lang.String name)
name
- The name of the constant.public static Type nameToType(java.lang.String name)
name
- The type name.public static void remove(java.lang.String name)
name
- The name of the constant to be removed from the table.public static java.util.TreeMap types()