/// <summary> /// Creates a new AST node using the specified AST Node Type name. /// </summary> /// <param name="tok">Token instance to be used to initialize the new AST Node.</param> /// <param name="ASTNodeTypeName"> /// Fully qualified name of the Type to be used for creating the new AST Node. /// </param> /// <returns>A newly created and initialized AST node object.</returns> /// <remarks> /// Once created, the new AST node is initialized with the specified Token /// instance. The <see cref="System.Type"/> used for creating this new AST /// node is determined solely by <c>ASTNodeTypeName</c>. /// <para>The AST Node type must have a default/parameterless constructor.</para> /// </remarks> public virtual AST create(IToken tok, string ASTNodeTypeName) { AST newNode = createFromNodeName(ASTNodeTypeName); newNode.initialize(tok); return(newNode); }
/// <summary> /// Creates and initializes a new AST node using the specified Token Type ID. /// The <see cref="System.Type"/> used for creating this new AST node is /// determined by the following: /// <list type="bullet"> /// <item>the current TokenTypeID-to-ASTNodeType mapping (if any) or,</item> /// <item>the <see cref="defaultASTNodeTypeObject_"/> otherwise</item> /// </list> /// </summary> /// <param name="type">Token type ID to be used to create new AST Node.</param> /// <returns>An initialized AST node object.</returns> public virtual AST create(int type) { AST newNode = createFromNodeType(type); newNode.initialize(type, ""); return(newNode); }
/// <summary> /// Creates a new AST node using the specified AST Node Type name. Once created, /// the new AST node is initialized with the specified Token type ID and string. /// The <see cref="System.Type"/> used for creating this new AST node is /// determined solely by <c>ASTNodeTypeName</c>. /// The AST Node type must have a default/parameterless constructor. /// </summary> /// <param name="type">Token type ID to be used to create new AST Node.</param> /// <param name="txt">Text for initializing the new AST Node.</param> /// <param name="ASTNodeTypeName">Fully qualified name of the Type to be used for creating the new AST Node.</param> /// <returns>An initialized AST node object.</returns> public virtual AST create(int type, string txt, string ASTNodeTypeName) { AST newNode = createFromNodeName(ASTNodeTypeName); newNode.initialize(type, txt); return(newNode); }
/// <summary> /// Returns a copy of the specified AST Node instance. The copy is obtained by /// using the <see cref="ICloneable"/> method Clone(). /// </summary> /// <param name="t">AST Node to copy.</param> /// <returns>An AST Node (or null if <c>t</c> is null).</returns> public virtual AST dup(AST t) { // The Java version is implemented using code like this: if (t == null) { return(null); } AST dup_edNode = createFromAST(t); dup_edNode.initialize(t); return(dup_edNode); }
/// <summary> /// Returns a copy of the specified AST Node instance. The copy is obtained by /// using the <see cref="ICloneable"/> method Clone(). /// </summary> /// <param name="t">AST Node to copy.</param> /// <returns>An AST Node (or null if <c>t</c> is null).</returns> public virtual AST dup(AST t) { // The Java version is implemented using code like this: if (t == null) { return(null); } AST dup_edNode = createFromNodeTypeObject(t.GetType()); dup_edNode.initialize(t); return(dup_edNode); //return (AST)((t == null) ? null : t.Clone()); }