Class CssCustomFunctionNode

    • Field Detail

      • resultNodes

        protected java.util.List<CssValueNode> resultNodes
    • Constructor Detail

      • CssCustomFunctionNode

        public CssCustomFunctionNode​(java.lang.String gssFunctionName,
                                     SourceCodeLocation sourceCodeLocation)
        Constructor of the node.
        Parameters:
        gssFunctionName - name of the function "called" by this node
        sourceCodeLocation - location of this node
      • CssCustomFunctionNode

        public CssCustomFunctionNode​(CssCustomFunctionNode function)
        Copy constructor.
        Parameters:
        function - the copied custom function node
    • Method Detail

      • toString

        public java.lang.String toString()
        Description copied from class: CssValueNode
        Use for debugging only.
        Overrides:
        toString in class CssFunctionNode
        See Also:
        Object.toString()
      • getResult

        public java.util.List<CssValueNode> getResult()
        Returns:
        cached result of function value computation
      • setResult

        public void setResult​(java.util.List<CssValueNode> functionResult)
        Saves the value of function computation for later use.
        Parameters:
        functionResult - the list of nodes returned by the call to the GssFunction
      • fixupFunctionArguments

        public static java.util.List<CssValueNode> fixupFunctionArguments​(java.lang.Iterable<CssValueNode> functionParameters)
        Turns functionParameters containing comma and space literals into a correctly-grouped list of CssValueNodes. For example, in this code:
        * @def A 1 2 3 4; @def B 6 7 8 9; @def USE_A true; @def MARGIN selectFrom(USE_A, A, B);
         
        the selectFrom gets expanded to:
        * @def MARGIN selectFrom([true][,][1][ ][2][ ][3][ ][4][,][6][ ][7][ ][8][ ][9])
         
        where each value in braces is one parameter. That's 17 parameters. Passing that parameter list to this function returns a list with 3 values: true, 1 2 3 4, and 6 7 8 9.

        Note that this function must be passed value nodes that are already expanded as it will create CssLiteralNodes out of the values between commas via concatenation of their toString methods.

        Parameters:
        functionParameters - an iterable that contains resolved parameter values (no references)
        Returns:
        a list values that represent the actual arguments to the function, one value per argument