Java Doc for AST.java in  » Parser » Rats-Parser-Generators » xtc » type » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » Rats Parser Generators » xtc.type 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   xtc.type.AST

All known Subclasses:   xtc.type.JavaAST,
AST
abstract public class AST (Code)
Common type operations for Rats! ASTs.

This class supports two views on a grammar's generic AST. The first view is dynamically typed, with all generic AST nodes represented by the canonical node type. The second view is statically typed, with all generic AST nodes represented by tuples organized into variants. Either way, this class supports the following types:

  • The void type represented by VoidT .
  • The unit type represented by UnitT .
  • Characters represented by an InternalT with name "char".
  • Strings represented by an InternalT with name "string".
  • Tokens represented by an InternalT with name "token".
  • Dynamically typed nodes represented by an InternalT with name "node".
  • Statically typed nodes represented by a VariantT with TupleT elements.
  • Parse tree annotations represented by an InternalT with name "formatting".
  • Lists represented by an InternalT with name "list".
  • Actions represented by an InternalT with name "action".
All node types have the Constants.ATT_NODE attribute; the dynamically typed node representing generic productions also has the Constants.ATT_GENERIC attribute.

In addition to generic ASTs, this class also supports user-defined types, which must be represented by types that are not listed above.

Concrete subclasses specify the mapping between strings and types. For mapping internal representations back to strings, the void type has name "void", the unit type has name "unit", and the wildcard has name "?".
author:
   Robert Grimm
version:
   $Revision: 1.36 $


Inner Class :public static class MetaData

Field Summary
final public static  TypeACTION
     The canonical parameterized action type.
final public static  TypeANY
     The canonical any type.
final public static  TypeCHAR
     The canonical character reference type.
final public static  TypeFORMATTING
     The canonical formatting node type.
final public static  TypeGENERIC
     The canonical dynamically typed generic node type.
final public static  Set<String>INTERNAL
     The set of internal type names.
final public static  TypeLIST
     The canonical parameterized list type.
final public static  TypeNODE
     The canonical dynamically typed node type.
final public static  TypeNULL_NODE
     The canonical null node type.
final public static  TypeSTRING
     The canonical string type.
final public static  TypeTOKEN
     The canonical token type.
final public static  TypeVOID
     The canonical void type, which is VoidT.TYPE .
final public static  TypeWILD_ACTION
     The canonical action instantiated with a wildcard element type.
final public static  TypeWILD_LIST
     The canonical list instantiated with a wildcard element type.
final protected  Map<String, Type>externToIntern
     The map from strings to type representations.
final protected  List<String>importedModules
     The list of imported module names.
final protected  Map<String, String>importedTypes
     The map from simple type names to fully qualified type names.
final protected  Map<String, String>internToExtern
     The map from internal type names to external types.
final protected  Map<String, String>originalNames
     The map from unqualified variant names to original names.
final protected  Map<String, List<VariantT>>tupleVariants
     The map from tuple names to variants containing the tuples.
final protected  Map<String, TupleT>tuples
     The map from tuple names to tuple types.
final protected  Map<String, Set<String>>variantNodes
     The map from variant names to nodes.
final protected  Map<String, VariantT>variants
     The map from variant names to variant types.

Constructor Summary
public  AST()
     Create a new instance.

Method Summary
public static  TypeactionOf(Type element)
     Create a new action type.
Parameters:
  element - The element type.
public  voidadd(TupleT tuple, VariantT variant)
     Add the specified tuple type to the specified variant type.
public  Typecombine(TupleT tuple1, TupleT tuple2, boolean flatten, boolean strict)
     Combine the specified tuple types into a consistent type.
public  Typeconcretize(Type type, Type concrete)
     Ensure that the specified type is concrete.
public  voidconcretizeTuples(VariantT variant, Type concrete)
     Concretize the specified variant type's tuples.
public  Stringextern(Type type)
     Convert the specified type to a string.
abstract protected  StringexternAction(Type type)
     Convert the specified action type to a string.
Parameters:
  type - The action type.
abstract protected  StringexternList(Type type)
     Convert the specified list type to a string.
Parameters:
  type - The list type.
abstract protected  StringexternUser(Type type)
     Convert the specified user-defined type to a string.
Parameters:
  type - The user-defined type.
public  Typeflatten(TupleT tuple, boolean strict)
     Flatten the specified tuple type.
public static  TypegetArgument(Type type)
     Get the specified instantiated type's only argument.
Parameters:
  type - The instantiated type.
public  MetaDatagetMetaData(VariantT variant)
     Determine the metadata for the specified variant.
Parameters:
  variant - The variant.
public  FuzzyBooleanhasLocation(Type type)
     Determine whether instances of the specified type have a source location.
abstract protected  FuzzyBooleanhasLocationUser(Type type)
     Determine whether instances of the specified user-defined type have a source location.
Parameters:
  type - The type.
public  booleanhasTuple(String name)
     Determine whether a tuple type with the specified name has been created before.
Parameters:
  name - The name.
public  booleanhasVariant(String name)
     Determine whether a variant type with the specified name has been created before.
public  voidimportModule(String module)
     Import the specified module.
public  voidimportType(String qualified, String simple)
     Import the specified type.
abstract public  voidinitialize(boolean hasNode, boolean hasToken, boolean hasFormatting, boolean hasAction)
     Initialize the mapping between external and internal representations.
public  Typeintern(String s)
     Convert the specified string representation of a type into the type.
abstract protected  TypeinternAction(String s)
     Convert the specified string representation of an action type into the type.
Parameters:
  s - The action type as a string.
abstract protected  TypeinternList(String s)
     Convert the specified string representation of a list type into the type.
Parameters:
  s - The list type as a string.
abstract protected  TypeinternUser(String s)
     Convert the specified string representation of a user-defined type into its internal representation.
Parameters:
  s - The user-defined type as a string.
public static  booleanisAction(Type type)
     Determine whether the specified type is an action.
Parameters:
  type - The type.
public static  booleanisAny(Type type)
     Determine whether the specified type is the any type.
Parameters:
  type - The type.
public static  booleanisChar(Type type)
     Determine whether the specified type is a character.
Parameters:
  type - The type.
public static  booleanisDynamicNode(Type type)
     Determine whether the specified type is a dynamically typed node.
Parameters:
  type - The type.
public static  booleanisFormatting(Type type)
     Determine whether the specified type is a formatting node.
Parameters:
  type - The type.
abstract public  booleanisGenericNode(String s)
     Determine whether the specified string represents the generic node type.
Parameters:
  s - The type as a string.
public static  booleanisGenericNode(Type type)
     Determine whether the specified type is a generic node.
Parameters:
  type - The type.
public static  booleanisList(Type type)
     Determine whether the specified type is a list.
Parameters:
  type - The type.
public  booleanisMonomorphic(String name)
     Determine whether the tuple type with the specified name has been created before and is monomorphic.
Parameters:
  name - The name.
public static  booleanisNode(Type type)
     Determine whether the specified type is a node.
Parameters:
  type - The type.
public static  booleanisNullNode(Type type)
     Determine whether the specified type is a null node.
Parameters:
  type - The type.
public static  booleanisOptional(Type type)
     Determine whether the specified type is optional.
Parameters:
  type - The type.
public static  booleanisStaticNode(Type type)
     Determine whether the specified type is a statically typed node.
Parameters:
  type - The type.
public static  booleanisString(Type type)
     Determine whether the specified type is a string.
Parameters:
  type - The type.
public static  booleanisToken(Type type)
     Determine whether the specified type is a token.
Parameters:
  type - The type.
public static  booleanisUser(Type type)
     Determine whether the specified type is user-defined.
Parameters:
  type - The type.
public static  booleanisVariable(Type type)
     Determine whether the specified type is variable.
Parameters:
  type - The type.
abstract public  booleanisVoid(String s)
     Determine whether the specified string represents the void type.
Parameters:
  s - The type as a string.
public static  booleanisVoid(Type type)
     Determine whether the specified type is the void type.
Parameters:
  type - The type.
public static  TypelistOf(Type element)
     Create a new list type.
Parameters:
  element - The element type.
public static  TypemarkOptional(Type type)
     Mark the specified type as optional.
Parameters:
  type - The type.
public static  TypemarkVariable(Type type)
     Mark the specified type as variable.
Parameters:
  type - The type.
public  booleanoverlap(VariantT v1, VariantT v2)
     Determine whether the specified variants overlap.
public  voidprint(Type type, Printer printer, boolean refIsDecl, boolean qualified, String module)
     Print the specified type.
public  StringtoOriginal(VariantT variant)
     Get the original name for the specified variant.

The specified variant must have been created with AST.toVariant(String,boolean) .
Parameters:
  variant - The variant.

public  TupleTtoTuple(String name)
     Get the tuple type with the specified name.
public  TupleTtoTuple(VariantT variant)
     Get the polymorphic tuple for the specified variant.

The specified variant must have been created with AST.toVariant(String,boolean) .
Parameters:
  variant - The variant.

public  VariantTtoVariant(String name, boolean poly)
     Get the variant type with the specified name.
public  StringtoVariantName(String name)
     Convert the specified production's name into a variant name. This method converts the name from Rats!' camel case naming convention into ML's lower case with underscores naming convention.
public  List<VariantT>toVariants(TupleT tuple)
     Get the specified tuple's variants.

The specified tuple must have been created with AST.toTuple(String) or AST.toTuple(VariantT) .

public  Typeunify(Type t1, Type t2, boolean strict)
     Unify the specified types.
protected  Typeunify(VariantT v1, VariantT v2)
     Unify the specified statically typed nodes.
abstract protected  TypeunifyUser(Type t1, Type t2, boolean strict)
     Unify the specified user-defined types.

Field Detail
ACTION
final public static Type ACTION(Code)
The canonical parameterized action type.



ANY
final public static Type ANY(Code)
The canonical any type.



CHAR
final public static Type CHAR(Code)
The canonical character reference type.



FORMATTING
final public static Type FORMATTING(Code)
The canonical formatting node type.



GENERIC
final public static Type GENERIC(Code)
The canonical dynamically typed generic node type.



INTERNAL
final public static Set<String> INTERNAL(Code)
The set of internal type names.



LIST
final public static Type LIST(Code)
The canonical parameterized list type.



NODE
final public static Type NODE(Code)
The canonical dynamically typed node type.



NULL_NODE
final public static Type NULL_NODE(Code)
The canonical null node type.



STRING
final public static Type STRING(Code)
The canonical string type.



TOKEN
final public static Type TOKEN(Code)
The canonical token type.



VOID
final public static Type VOID(Code)
The canonical void type, which is VoidT.TYPE .



WILD_ACTION
final public static Type WILD_ACTION(Code)
The canonical action instantiated with a wildcard element type.



WILD_LIST
final public static Type WILD_LIST(Code)
The canonical list instantiated with a wildcard element type.



externToIntern
final protected Map<String, Type> externToIntern(Code)
The map from strings to type representations.



importedModules
final protected List<String> importedModules(Code)
The list of imported module names. Each module name should end with the separator necessary for creating a fully qualified type name by appending a simple name.



importedTypes
final protected Map<String, String> importedTypes(Code)
The map from simple type names to fully qualified type names.



internToExtern
final protected Map<String, String> internToExtern(Code)
The map from internal type names to external types. Valid type names are void, unit, any, char, string, token, node, formatting, list, and action as well as ? for wildcards.



originalNames
final protected Map<String, String> originalNames(Code)
The map from unqualified variant names to original names.



tupleVariants
final protected Map<String, List<VariantT>> tupleVariants(Code)
The map from tuple names to variants containing the tuples.



tuples
final protected Map<String, TupleT> tuples(Code)
The map from tuple names to tuple types.



variantNodes
final protected Map<String, Set<String>> variantNodes(Code)
The map from variant names to nodes.



variants
final protected Map<String, VariantT> variants(Code)
The map from variant names to variant types.




Constructor Detail
AST
public AST()(Code)
Create a new instance. This constructor allocates the internal data structures for mapping between external and internal types but does not initialize them.
See Also:   AST.initialize(boolean,boolean,boolean,boolean)




Method Detail
actionOf
public static Type actionOf(Type element)(Code)
Create a new action type.
Parameters:
  element - The element type. The corresponding action type.



add
public void add(TupleT tuple, VariantT variant)(Code)
Add the specified tuple type to the specified variant type. If the tuple is not a member of the specified variant, this method adds it, while also updating its internal state.

The specified tuple must have been created with AST.toTuple(String) or AST.toTuple(VariantT) . The specified variant must have been created with AST.toVariant(String,boolean) .
Parameters:
  tuple - The tuple.
Parameters:
  variant - The variant.




combine
public Type combine(TupleT tuple1, TupleT tuple2, boolean flatten, boolean strict)(Code)
Combine the specified tuple types into a consistent type. The types must be tuples with the same name.
Parameters:
  tuple1 - The first tuple.
Parameters:
  tuple2 - The second tuple.
Parameters:
  flatten - The flag for flattening lists.
Parameters:
  strict - The flag for strict unification. The combined tuple type or ErrorT.TYPE if the twotuple types cannot be combined into a consistent type.



concretize
public Type concretize(Type type, Type concrete)(Code)
Ensure that the specified type is concrete. This method replaces occurrences of the wildcard type with the specified replacement; though it does not process variant types to avoid infinite recursions. It assumes that list and action types are instantiated.
See Also:   AST.concretizeTuples(VariantT,Type)
Parameters:
  type - The type.
Parameters:
  concrete - The concrete replacement for wildcards. The concrete type.



concretizeTuples
public void concretizeTuples(VariantT variant, Type concrete)(Code)
Concretize the specified variant type's tuples. This method updates any tuples in place.
See Also:   AST.concretize(Type,Type)
Parameters:
  variant - The variant.
Parameters:
  concrete - The concrete replacement for wildcards.



extern
public String extern(Type type)(Code)
Convert the specified type to a string. This method defers to AST.externList(Type) , AST.externAction(Type) , and AST.externUser(Type) for list, action, and user-defined types, respectively.
Parameters:
  type - The type. The type as a string.



externAction
abstract protected String externAction(Type type)(Code)
Convert the specified action type to a string.
Parameters:
  type - The action type. The type as a string.



externList
abstract protected String externList(Type type)(Code)
Convert the specified list type to a string.
Parameters:
  type - The list type. The type as a string.



externUser
abstract protected String externUser(Type type)(Code)
Convert the specified user-defined type to a string.
Parameters:
  type - The user-defined type. The type as a string.



flatten
public Type flatten(TupleT tuple, boolean strict)(Code)
Flatten the specified tuple type. If the specified tuple has a list element, this method combines the first such list type with all succeeding element types into a single list type, modifying the specified tuple type.
Parameters:
  tuple - The tuple type.
Parameters:
  strict - The flag for strict unification. The updated tuple type or ErrorT.TYPE if typescannot be unified.



getArgument
public static Type getArgument(Type type)(Code)
Get the specified instantiated type's only argument.
Parameters:
  type - The instantiated type. The argument type.



getMetaData
public MetaData getMetaData(VariantT variant)(Code)
Determine the metadata for the specified variant.
Parameters:
  variant - The variant. The corresponding metadata.



hasLocation
public FuzzyBoolean hasLocation(Type type)(Code)
Determine whether instances of the specified type have a source location. This method defers to AST.hasLocationUser(Type) for user-defined types.
Parameters:
  type - The type. The inexact answer.



hasLocationUser
abstract protected FuzzyBoolean hasLocationUser(Type type)(Code)
Determine whether instances of the specified user-defined type have a source location.
Parameters:
  type - The type. The inexact answer.



hasTuple
public boolean hasTuple(String name)(Code)
Determine whether a tuple type with the specified name has been created before.
Parameters:
  name - The name. true if a tuple type with the name exists.



hasVariant
public boolean hasVariant(String name)(Code)
Determine whether a variant type with the specified name has been created before. This method first converts the name from Rats!' camel case naming convention into ML's lower case with underscores naming convention. It then checks whether a variant type with that name has been returned by AST.toVariant(String,boolean) before.
See Also:   AST.toVariantName(String)
Parameters:
  name - The name in camel case. true if a variant type with the name exists.



importModule
public void importModule(String module)(Code)
Import the specified module. This method adds the module to the list of imported modules AST.importedModules . The specified module name must end with the appropriate separator.
Parameters:
  module - The module name.



importType
public void importType(String qualified, String simple)(Code)
Import the specified type. This method adds a mapping from the specified simple type name to the specified qualified type name to the imported types AST.importedTypes .
Parameters:
  qualified - The fully qualified name.
Parameters:
  simple - The simple name.



initialize
abstract public void initialize(boolean hasNode, boolean hasToken, boolean hasFormatting, boolean hasAction)(Code)
Initialize the mapping between external and internal representations. This method fills the AST.externToIntern and AST.internToExtern data structures.
Parameters:
  hasNode - Flag to indicate use of built-in nodes.
Parameters:
  hasToken - Flag to indicate use of tokens.
Parameters:
  hasFormatting - Flag to indicate use of formatting.
Parameters:
  hasAction - Flag to indicate use of actions.



intern
public Type intern(String s)(Code)
Convert the specified string representation of a type into the type. This method defers to AST.internList(String) , AST.internAction(String) , and AST.internUser(String) for list, action, and user-defined types, respectively.
Parameters:
  s - The type as a string. The type.



internAction
abstract protected Type internAction(String s)(Code)
Convert the specified string representation of an action type into the type.
Parameters:
  s - The action type as a string. The type or ErrorT.TYPE if the string does notrepresent an action.



internList
abstract protected Type internList(String s)(Code)
Convert the specified string representation of a list type into the type.
Parameters:
  s - The list type as a string. The type or ErrorT.TYPE if the string does notrepresent a list.



internUser
abstract protected Type internUser(String s)(Code)
Convert the specified string representation of a user-defined type into its internal representation.
Parameters:
  s - The user-defined type as a string. The type.



isAction
public static boolean isAction(Type type)(Code)
Determine whether the specified type is an action.
Parameters:
  type - The type. true if the type is an action.



isAny
public static boolean isAny(Type type)(Code)
Determine whether the specified type is the any type.
Parameters:
  type - The type. true if the type is the any type.



isChar
public static boolean isChar(Type type)(Code)
Determine whether the specified type is a character.
Parameters:
  type - The type. true if the type is a character.



isDynamicNode
public static boolean isDynamicNode(Type type)(Code)
Determine whether the specified type is a dynamically typed node.
Parameters:
  type - The type. true if the type is a dynamically typednode.



isFormatting
public static boolean isFormatting(Type type)(Code)
Determine whether the specified type is a formatting node.
Parameters:
  type - The type. true if the type is a formatting node.



isGenericNode
abstract public boolean isGenericNode(String s)(Code)
Determine whether the specified string represents the generic node type.
Parameters:
  s - The type as a string. true if the string represents the genericnode type.



isGenericNode
public static boolean isGenericNode(Type type)(Code)
Determine whether the specified type is a generic node.
Parameters:
  type - The type. true if the type is a generic node.



isList
public static boolean isList(Type type)(Code)
Determine whether the specified type is a list.
Parameters:
  type - The type. true if the type is a list.



isMonomorphic
public boolean isMonomorphic(String name)(Code)
Determine whether the tuple type with the specified name has been created before and is monomorphic.
Parameters:
  name - The name. true if a tuple type with the name existsand is monomorphic.



isNode
public static boolean isNode(Type type)(Code)
Determine whether the specified type is a node.
Parameters:
  type - The type. true if the type is a node.



isNullNode
public static boolean isNullNode(Type type)(Code)
Determine whether the specified type is a null node.
Parameters:
  type - The type. true if the type is a null node.



isOptional
public static boolean isOptional(Type type)(Code)
Determine whether the specified type is optional.
Parameters:
  type - The type. true if the specified type is optional.



isStaticNode
public static boolean isStaticNode(Type type)(Code)
Determine whether the specified type is a statically typed node.
Parameters:
  type - The type. true if the type is a statically typed node.



isString
public static boolean isString(Type type)(Code)
Determine whether the specified type is a string.
Parameters:
  type - The type. true if the type is a string.



isToken
public static boolean isToken(Type type)(Code)
Determine whether the specified type is a token.
Parameters:
  type - The type. true if the type is a token.



isUser
public static boolean isUser(Type type)(Code)
Determine whether the specified type is user-defined.
Parameters:
  type - The type. true if the type is a user-defined type.



isVariable
public static boolean isVariable(Type type)(Code)
Determine whether the specified type is variable.
Parameters:
  type - The type. true if the specified type is variable.



isVoid
abstract public boolean isVoid(String s)(Code)
Determine whether the specified string represents the void type.
Parameters:
  s - The type as a string. true if the string represents the void type.



isVoid
public static boolean isVoid(Type type)(Code)
Determine whether the specified type is the void type.
Parameters:
  type - The type. true if the type is the void type.



listOf
public static Type listOf(Type element)(Code)
Create a new list type.
Parameters:
  element - The element type. The corresponding list type.



markOptional
public static Type markOptional(Type type)(Code)
Mark the specified type as optional.
Parameters:
  type - The type. The optional type.



markVariable
public static Type markVariable(Type type)(Code)
Mark the specified type as variable.
Parameters:
  type - The type. The variable type.



overlap
public boolean overlap(VariantT v1, VariantT v2)(Code)
Determine whether the specified variants overlap. Two variants overlap if they include tuples representing the same generic node.

The specified variants must have been created with AST.toVariant(String,boolean) .
Parameters:
  v1 - The first variant.
Parameters:
  v2 - The second variant. true if the two variants overlap.




print
public void print(Type type, Printer printer, boolean refIsDecl, boolean qualified, String module)(Code)
Print the specified type.
Parameters:
  printer - The printer.
Parameters:
  type - The type.
Parameters:
  refIsDecl - The flag for whether a variant type referencealso is a declaration.
Parameters:
  qualified - The flag for printing qualified names.
Parameters:
  module - The current module name, which may be null.



toOriginal
public String toOriginal(VariantT variant)(Code)
Get the original name for the specified variant.

The specified variant must have been created with AST.toVariant(String,boolean) .
Parameters:
  variant - The variant. The original name in Rats!' camel case.




toTuple
public TupleT toTuple(String name)(Code)
Get the tuple type with the specified name. If this method has not been invoked on the specified name before, it returns a new tuple type, which is incomplete. Otherwise, it simply returns the previoulsy created tuple type.
Parameters:
  name - The name. The corresponding tuple type.



toTuple
public TupleT toTuple(VariantT variant)(Code)
Get the polymorphic tuple for the specified variant.

The specified variant must have been created with AST.toVariant(String,boolean) .
Parameters:
  variant - The variant. The corresponding polymorphic tuple.




toVariant
public VariantT toVariant(String name, boolean poly)(Code)
Get the variant type with the specified name. This method first converts the name from Rats!' camel case naming convention into ML's lower case with underscores naming convention. Then, if this method has not been invoked on the specified name before, it returns a new variant type with an empty list of tuples. Otherwise, it simply returns the previously created variant type. The returned variant type has the Constants.ATT_NODE attribute.
See Also:   AST.toVariantName(String)
Parameters:
  name - The name in camel case.
Parameters:
  poly - The flag for whether the variant is polymorphic. The corresponding variant type.



toVariantName
public String toVariantName(String name)(Code)
Convert the specified production's name into a variant name. This method converts the name from Rats!' camel case naming convention into ML's lower case with underscores naming convention. It preserves any qualifier.
Parameters:
  name - The production's name. The corresponding variant name.



toVariants
public List<VariantT> toVariants(TupleT tuple)(Code)
Get the specified tuple's variants.

The specified tuple must have been created with AST.toTuple(String) or AST.toTuple(VariantT) . It must have been added to any variants with AST.add(TupleT,VariantT) .
Parameters:
  tuple - The tuple. The tuple's variants.




unify
public Type unify(Type t1, Type t2, boolean strict)(Code)
Unify the specified types. If the strict flag is set, statically and dynamically typed nodes do not unify. If the flag is not set, they do unify and otherwise incompatible types unify to the any type. This method defers to AST.unify(VariantT,VariantT) for statically typed nodes and to AST.unifyUser(Type,Type,boolean) for user-defined types.
Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type.
Parameters:
  strict - The flag for strict unification. The unified type or ErrorT.TYPE if the two typesdo not unify.



unify
protected Type unify(VariantT v1, VariantT v2)(Code)
Unify the specified statically typed nodes. Statically typed nodes unify through polymorphic variant types, unless they reference the same underlying AST node.
Parameters:
  v1 - The first variant.
Parameters:
  v2 - The second variant. The unified variant.



unifyUser
abstract protected Type unifyUser(Type t1, Type t2, boolean strict)(Code)
Unify the specified user-defined types. Note that this method need not handle instantiated types but must preserve parameterize types.
Parameters:
  t1 - The first user-defined type.
Parameters:
  t2 - The second user-defined type.
Parameters:
  strict - The flag for strict unification. The unified type or ErrorT.TYPE if the two typesdo not unify.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.