Package com.google.template.soy.exprtree

Examples of com.google.template.soy.exprtree.FunctionNode.numChildren()


  public void testParseFunctionCall() throws Exception {

    ExprRootNode<?> expr = (new ExpressionParser("isFirst($x)")).parseExpression();
    FunctionNode isFirstFn = (FunctionNode) expr.getChild(0);
    assertEquals("isFirst", isFirstFn.getFunctionName());
    assertEquals(1, isFirstFn.numChildren());
    assertEquals("$x", ((DataRefNode) isFirstFn.getChild(0)).toSourceString());

    expr = (new ExpressionParser("round(3.14159, 2)")).parseExpression();
    FunctionNode roundFn = (FunctionNode) expr.getChild(0);
    assertEquals("round", roundFn.getFunctionName());
View Full Code Here


    assertEquals("$x", ((DataRefNode) isFirstFn.getChild(0)).toSourceString());

    expr = (new ExpressionParser("round(3.14159, 2)")).parseExpression();
    FunctionNode roundFn = (FunctionNode) expr.getChild(0);
    assertEquals("round", roundFn.getFunctionName());
    assertEquals(2, roundFn.numChildren());
    assertEquals(3.14159, ((FloatNode) roundFn.getChild(0)).getValue());
    assertEquals(2, ((IntegerNode) roundFn.getChild(1)).getValue());
  }

View Full Code Here

              "The special function 'remainder' is for use in plural messages" +
                  " (tag " + node.toSourceString() + ").",
              node);
        }
        // 'remainder' with no parameters or more than one parameter. Bad!
        if (functionNode.numChildren() != 1) {
          throw SoySyntaxExceptionUtils.createWithNode(
              "The function 'remainder' has to have exactly one argument" +
                  " (tag " + node.toSourceString() + ").",
              node);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.