Class BoxArrayLiteral

All Implemented Interfaces:
IBoxLiteral, BoxVisitable

public class BoxArrayLiteral extends BoxExpression implements IBoxLiteral
AST Node representing an array literal. An array literal is surrounded by square braces [] and contains zero or more comma-delimited expressions. Example
 []
 [1,2,3]
 ["foo","bar"]
 [
 [1,2],
 [3,4],
 "brad"
 ]
 
  • Constructor Details

    • BoxArrayLiteral

      public BoxArrayLiteral(List<BoxExpression> values, Position position, String sourceText)
      Creates the AST node for an anonymous argument
      Parameters:
      values - initialization values
      position - position of the statement in the source code
      sourceText - source code that originated the Node
  • Method Details

    • getValues

      public List<BoxExpression> getValues()
    • setValues

      public void setValues(List<BoxExpression> values)
    • isLiteral

      public boolean isLiteral()
      Description copied from class: BoxExpression
      Utility method to detect if an expression node is a terminal Literal
      Overrides:
      isLiteral in class BoxExpression
      Returns:
      true if it is false otherwise
    • toMap

      public Map<String,Object> toMap()
      Overrides:
      toMap in class BoxNode
    • accept

      public void accept(VoidBoxVisitor v)
      Description copied from interface: BoxVisitable
      Accept method for visitor support.
      Specified by:
      accept in interface BoxVisitable
      Parameters:
      v - the visitor implementation
    • accept

      public BoxNode accept(ReplacingBoxVisitor v)
      Description copied from interface: BoxVisitable
      Accept method for replacing visitor support. Each accept returns the node, or a replacement node.
      Specified by:
      accept in interface BoxVisitable
      Parameters:
      v - the visitor implementation
    • getDescription

      public String getDescription()
      Description copied from class: BoxNode
      Returns a human-readable description of the node, which it manufactures from the class name.

      While that is quite often good enough, override this method in subclasses to provide a better description when this default does not work quite right.

      Overrides:
      getDescription in class BoxNode
      Returns:
      human readable description of the expression, for use in error messages etc