Class GProduction

  • All Implemented Interfaces:
    java.lang.Cloneable, Parser.Symbol

    public class GProduction
    extends GDecl
    implements java.lang.Cloneable
    • Field Detail

      • tokenString_Name

        protected java.lang.String tokenString_Name
    • Constructor Detail

      • GProduction

        public GProduction()
      • GProduction

        @Constructor(name={"Type","Name","GRule"},
                     type={"Opt<Type>","String","List<GRule>"},
                     kind={"Opt","Token","List"})
        public GProduction​(Opt<Type> p0,
                           java.lang.String p1,
                           List<GRule> p2)
    • Method Detail

      • init$Children

        public void init$Children()
        Initializes the child array to the correct size. Initializes List and Opt nta children.
        Overrides:
        init$Children in class GDecl
      • numChildren

        protected int numChildren()
        Overrides:
        numChildren in class GDecl
      • clone

        public GProduction clone()
                          throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class GDecl
        Throws:
        java.lang.CloneNotSupportedException
      • fullCopy

        @Deprecated
        public GProduction fullCopy()
        Deprecated.
        Please use treeCopy or treeCopyNoTransform instead
        Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
        Specified by:
        fullCopy in class GDecl
        Returns:
        dangling copy of the subtree at this node
      • treeCopyNoTransform

        public GProduction treeCopyNoTransform()
        Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
        Specified by:
        treeCopyNoTransform in class GDecl
        Returns:
        dangling copy of the subtree at this node
      • treeCopy

        public GProduction treeCopy()
        Create a deep copy of the AST subtree at this node. The subtree of this node is traversed to trigger rewrites before copy. The copy is dangling, i.e. has no parent.
        Specified by:
        treeCopy in class GDecl
        Returns:
        dangling copy of the subtree at this node
      • setTypeOpt

        public void setTypeOpt​(Opt<Type> opt)
        Replaces the optional node for the Type child. This is the Opt node containing the child Type, not the actual child!
        Parameters:
        opt - The new node to be used as the optional node for the Type child.
      • setType

        public void setType​(Type node)
        Replaces the (optional) Type child.
        Parameters:
        node - The new node to be used as the Type child.
      • hasType

        public boolean hasType()
        Check whether the optional Type child exists.
        Returns:
        true if the optional Type child exists, false if it does not.
      • getType

        public Type getType()
        Retrieves the (optional) Type child.
        Returns:
        The Type child, if it exists. Returns null otherwise.
      • getTypeOpt

        @OptChild(name="Type")
        public Opt<Type> getTypeOpt()
        Retrieves the optional node for the Type child. This is the Opt node containing the child Type, not the actual child!
        Returns:
        The optional node for child the Type child.
      • getTypeOptNoTransform

        public Opt<Type> getTypeOptNoTransform()
        Retrieves the optional node for child Type. This is the Opt node containing the child Type, not the actual child!

        This method does not invoke AST transformations.

        Returns:
        The optional node for child Type.
      • setName

        public void setName​(java.lang.String value)
        Replaces the lexeme Name.
        Parameters:
        value - The new value for the lexeme Name.
      • getName

        @Token(name="Name")
        public java.lang.String getName()
        Retrieves the value for the lexeme Name.
        Returns:
        The value for the lexeme Name.
      • setGRuleList

        public void setGRuleList​(List<GRule> list)
        Replaces the GRule list.
        Parameters:
        list - The new list node to be used as the GRule list.
      • getNumGRule

        public int getNumGRule()
        Retrieves the number of children in the GRule list.
        Returns:
        Number of children in the GRule list.
      • getNumGRuleNoTransform

        public int getNumGRuleNoTransform()
        Retrieves the number of children in the GRule list. Calling this method will not trigger rewrites.
        Returns:
        Number of children in the GRule list.
      • getGRule

        public GRule getGRule​(int i)
        Retrieves the element at index i in the GRule list.
        Parameters:
        i - Index of the element to return.
        Returns:
        The element at position i in the GRule list.
      • hasGRule

        public boolean hasGRule()
        Check whether the GRule list has any children.
        Returns:
        true if it has at least one child, false otherwise.
      • addGRule

        public void addGRule​(GRule node)
        Append an element to the GRule list.
        Parameters:
        node - The element to append to the GRule list.
      • addGRuleNoTransform

        public void addGRuleNoTransform​(GRule node)
      • setGRule

        public void setGRule​(GRule node,
                             int i)
        Replaces the GRule list element at index i with the new node node.
        Parameters:
        node - The new node to replace the old list element.
        i - The list index of the node to be replaced.
      • getGRuleList

        @ListChild(name="GRule")
        public List<GRule> getGRuleList()
        Retrieves the GRule list.
        Returns:
        The node representing the GRule list.
      • getGRuleListNoTransform

        public List<GRule> getGRuleListNoTransform()
        Retrieves the GRule list.

        This method does not invoke AST transformations.

        Returns:
        The node representing the GRule list.
      • getGRuleNoTransform

        public GRule getGRuleNoTransform​(int i)
        Returns:
        the element at index i in the GRule list without triggering rewrites.
      • getGRules

        public List<GRule> getGRules()
        Retrieves the GRule list.
        Returns:
        The node representing the GRule list.
      • getGRulesNoTransform

        public List<GRule> getGRulesNoTransform()
        Retrieves the GRule list.

        This method does not invoke AST transformations.

        Returns:
        The node representing the GRule list.