public class JavaAST extends AST
AST.MetaData| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<java.lang.String> |
KEYWORDS
The set of Java keywords besides primitive types, modifiers, and void.
|
static java.util.Set<java.lang.String> |
MODIFIERS
The set of Java modifiers.
|
static java.util.Set<java.lang.String> |
PRIMITIVES
The set of Java primitive types.
|
protected java.util.Map<java.lang.String,java.lang.Class<?>> |
resolvedTypes
The map from Java class names to their classes.
|
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 and Description |
|---|
JavaAST()
Create a new Java AST instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
endOfType(java.lang.String args,
int start)
Determine the last index (exclusive) of the generic type argument
starting at the specified index.
|
protected java.lang.String |
externAction(Type type)
Convert the specified action type to a string.
|
protected java.lang.String |
externList(Type type)
Convert the specified list type to a string.
|
protected java.lang.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(java.lang.String s)
Convert the specified string representation of an action type
into the type.
|
protected Type |
internList(java.lang.String s)
Convert the specified string representation of a list type into
the type.
|
protected Type |
internUser(java.lang.String s)
Convert the specified string representation of a user-defined
type into its internal representation.
|
boolean |
isGenericNode(java.lang.String s)
Determine whether the specified string represents the generic
node type.
|
boolean |
isVoid(java.lang.String s)
Determine whether the specified string represents the void type.
|
java.lang.Class<?> |
resolve(java.lang.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.
|
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, unifypublic static final java.util.Set<java.lang.String> PRIMITIVES
public static final java.util.Set<java.lang.String> MODIFIERS
public static final java.util.Set<java.lang.String> KEYWORDS
protected java.util.Map<java.lang.String,java.lang.Class<?>> resolvedTypes
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(java.lang.String s)
ASTpublic boolean isGenericNode(java.lang.String s)
ASTisGenericNode in class ASTs - The type as a string.true if the string represents the generic
node type.protected Type internList(java.lang.String s)
ASTinternList in class ASTs - The list type as a string.ErrorT.TYPE if the string does not
represent a list.protected Type internAction(java.lang.String s)
ASTinternAction in class ASTs - The action type as a string.ErrorT.TYPE if the string does not
represent an action.protected Type internUser(java.lang.String s)
ASTinternUser in class ASTs - The user-defined type as a string.protected int endOfType(java.lang.String args,
int start)
args - The generic type arguments.start - The start index.protected java.lang.String externList(Type type)
ASTexternList in class ASTtype - The list type.protected java.lang.String externAction(Type type)
ASTexternAction in class ASTtype - The action type.protected java.lang.String externUser(Type type)
ASTexternUser in class ASTtype - The user-defined type.protected Constants.FuzzyBoolean hasLocationUser(Type type)
ASThasLocationUser in class ASTtype - The type.protected Type unifyUser(Type t1, Type t2, boolean strict)
ASTunifyUser 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 java.lang.Class<?> resolve(java.lang.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.Copyright © 2014. All Rights Reserved.