Class CAstImpl

  • All Implemented Interfaces:
    CAst
    Direct Known Subclasses:
    CAstValueImpl

    public class CAstImpl
    extends Object
    implements CAst
    An implementation of CAst, i.e. a simple factory for creating capa ast nodes. This class simply creates generic nodes with a kind field, and either an array of children or a constant values. Note that there is no easy way to mutate these trees; do not change this (see CAstNode for the rationale for this rule).
    • Constructor Detail

      • CAstImpl

        public CAstImpl()
    • Method Detail

      • makeUnique

        public String makeUnique()
        Description copied from interface: CAst
        Make a new identifier, unqiue to this CAst instance.
        Specified by:
        makeUnique in interface CAst
      • makeNode

        public CAstNode makeNode​(int kind,
                                 CAstNode[] cs)
        Description copied from interface: CAst
        Make a node of type kind specifying an array of children.
        Specified by:
        makeNode in interface CAst
      • makeNode

        public CAstNode makeNode​(int kind,
                                 CAstNode c1,
                                 CAstNode[] cs)
        Description copied from interface: CAst
        Make a node of type kind giving a first child and array of the rest.
        Specified by:
        makeNode in interface CAst
      • makeNode

        public CAstNode makeNode​(int kind)
        Description copied from interface: CAst
        Make a node of type kind with no children.
        Specified by:
        makeNode in interface CAst
      • makeNode

        public CAstNode makeNode​(int kind,
                                 CAstNode c1)
        Description copied from interface: CAst
        Make a node of type kind with one child.
        Specified by:
        makeNode in interface CAst
      • makeNode

        public CAstNode makeNode​(int kind,
                                 CAstNode c1,
                                 CAstNode c2)
        Description copied from interface: CAst
        Make a node of type kind with two children.
        Specified by:
        makeNode in interface CAst
      • makeConstant

        public CAstNode makeConstant​(Object value)
        Description copied from interface: CAst
        Make an arbitrary object constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(boolean value)
        Description copied from interface: CAst
        Make a boolean constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(char value)
        Description copied from interface: CAst
        Make a char constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(short value)
        Description copied from interface: CAst
        Make a short integer constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(int value)
        Description copied from interface: CAst
        Make an integer constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(long value)
        Description copied from interface: CAst
        Make a long integer constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(float value)
        Description copied from interface: CAst
        Make a single-precision floating point constant node.
        Specified by:
        makeConstant in interface CAst
      • makeConstant

        public CAstNode makeConstant​(double value)
        Description copied from interface: CAst
        Make a double-precision floating point constant node.
        Specified by:
        makeConstant in interface CAst