|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxtc.type.AST
xtc.type.JavaAST
public class JavaAST
Common type operations for Java ASTs.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class xtc.type.AST |
|---|
AST.MetaData |
| Field Summary | |
|---|---|
static Set<String> |
KEYWORDS
The set of Java keywords besides primitive types, modifiers, and void. |
static Set<String> |
MODIFIERS
The set of Java modifiers. |
static Set<String> |
PRIMITIVES
The set of Java primitive types. |
protected Map<String,Class<?>> |
resolvedTypes
The map from Java class names to their classes. |
| Fields inherited from class xtc.type.AST |
|---|
ACTION, ANY, CHAR, externToIntern, FORMATTING, GENERIC, importedModules, importedTypes, INTERNAL, internToExtern, LIST, NODE, NULL_NODE, originalNames, STRING, TOKEN, tuples, tupleVariants, variantNodes, variants, VOID, WILD_ACTION, WILD_LIST |
| Constructor Summary | |
|---|---|
JavaAST()
Create a new Java AST instance. |
|
| Method Summary | |
|---|---|
protected int |
endOfType(String args,
int start)
Determine the last index (exclusive) of the generic type argument starting at the specified index. |
protected String |
externAction(Type type)
Convert the specified action type to a string. |
protected String |
externList(Type type)
Convert the specified list type to a string. |
protected String |
externUser(Type type)
Convert the specified user-defined type to a string. |
protected Constants.FuzzyBoolean |
hasLocationUser(Type type)
Determine whether instances of the specified user-defined type have a source location. |
void |
initialize(boolean hasNode,
boolean hasToken,
boolean hasFormatting,
boolean hasAction)
Initialize the mapping between external and internal representations. |
protected Type |
internAction(String s)
Convert the specified string representation of an action type into the type. |
protected Type |
internList(String s)
Convert the specified string representation of a list type into the type. |
protected Type |
internUser(String s)
Convert the specified string representation of a user-defined type into its internal representation. |
boolean |
isGenericNode(String s)
Determine whether the specified string represents the generic node type. |
boolean |
isVoid(String s)
Determine whether the specified string represents the void type. |
Class<?> |
resolve(String name)
Resolve the specified type name to its class. |
protected Type |
unifyUser(Type t1,
Type t2,
boolean strict)
Unify the specified user-defined types. |
| Methods inherited from class xtc.type.AST |
|---|
actionOf, add, combine, concretize, concretizeTuples, extern, flatten, getArgument, getMetaData, hasLocation, hasTuple, hasVariant, importModule, importType, intern, isAction, isAny, isChar, isDynamicNode, isFormatting, isGenericNode, isList, isMonomorphic, isNode, isNullNode, isOptional, isStaticNode, isString, isToken, isUser, isVariable, isVoid, listOf, markOptional, markVariable, overlap, print, toOriginal, toTuple, toTuple, toVariant, toVariantName, toVariants, unify, unify |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Set<String> PRIMITIVES
public static final Set<String> MODIFIERS
public static final Set<String> KEYWORDS
protected Map<String,Class<?>> resolvedTypes
| Constructor Detail |
|---|
public JavaAST()
| Method Detail |
|---|
public void initialize(boolean hasNode,
boolean hasToken,
boolean hasFormatting,
boolean hasAction)
ASTAST.externToIntern
and AST.internToExtern data structures.
initialize in class ASThasNode - Flag to indicate use of built-in nodes.hasToken - Flag to indicate use of tokens.hasFormatting - Flag to indicate use of formatting.hasAction - Flag to indicate use of actions.public boolean isVoid(String s)
AST
isVoid in class ASTs - The type as a string.
true if the string represents the void type.public boolean isGenericNode(String s)
AST
isGenericNode in class ASTs - The type as a string.
true if the string represents the generic
node type.protected Type internList(String s)
AST
internList in class ASTs - The list type as a string.
ErrorT.TYPE if the string does not
represent a list.protected Type internAction(String s)
AST
internAction in class ASTs - The action type as a string.
ErrorT.TYPE if the string does not
represent an action.protected Type internUser(String s)
AST
internUser in class ASTs - The user-defined type as a string.
protected int endOfType(String args,
int start)
args - The generic type arguments.start - The start index.
protected String externList(Type type)
AST
externList in class ASTtype - The list type.
protected String externAction(Type type)
AST
externAction in class ASTtype - The action type.
protected String externUser(Type type)
AST
externUser in class ASTtype - The user-defined type.
protected Constants.FuzzyBoolean hasLocationUser(Type type)
AST
hasLocationUser in class ASTtype - The type.
protected Type unifyUser(Type t1,
Type t2,
boolean strict)
AST
unifyUser in class ASTt1 - The first user-defined type.t2 - The second user-defined type.strict - The flag for strict unification.
ErrorT.TYPE if the two types
do not unify.public Class<?> resolve(String name)
AST.importedTypes and AST.importedModules data
structures to map incomplete type names to fully qualified type
names. It caches results in the resolvedTypes data
structure to speed up future resolutions.
name - The type name.
null if the name
cannot be resolved.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||