Examples of FunctionNode


Examples of com.bazaarvoice.jless.ast.node.FunctionNode

    /**
     * Ident Arguments
     */
    Rule Function() {
        return Sequence(
                Ident(), push(new FunctionNode(match())),
                Arguments(), peek(1).addChild(pop())
        );
    }
View Full Code Here

Examples of com.google.template.soy.exprtree.FunctionNode


  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());
    assertEquals(2, roundFn.numChildren());
    assertEquals(3.14159, ((FloatNode) roundFn.getChild(0)).getValue());
    assertEquals(2, ((IntegerNode) roundFn.getChild(1)).getValue());
  }
View Full Code Here

Examples of com.google.template.soy.exprtree.FunctionNode

      return;
    }

    // Check for the function node with the function "remainder()".
    if (exprRootNode.getChild(0) instanceof FunctionNode) {
      FunctionNode functionNode = (FunctionNode) exprRootNode.getChild(0);
      if (functionNode.getFunctionName().equals("remainder")) {

        if (currPluralNode == null) {
          // 'remainder' outside 'plural'. Bad!
          throw SoySyntaxExceptionUtils.createWithNode(
              "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);
        }
        // 'remainder' with a different expression than the enclosing 'plural'. Bad!
        if (! functionNode.getChild(0).toSourceString().equals(
                  currPluralNode.getExpr().toSourceString())) {
          throw SoySyntaxExceptionUtils.createWithNode(
              "The parameter to 'remainder' has to be the same as the 'plural' variable" +
                  " (tag " + node.toSourceString() + ").",
              node);
View Full Code Here

Examples of com.google.template.soy.exprtree.FunctionNode

      ExprNode operand0a = node.getChild(0);
      ExprNode operand0b = operand0a.clone();
      ExprNode operand1 = node.getChild(1);

      FunctionNode isNonnullFnNode = new FunctionNode("isNonnull");
      isNonnullFnNode.addChild(operand0a);

      ConditionalOpNode condOpNode = new ConditionalOpNode();
      condOpNode.addChild(isNonnullFnNode);
      condOpNode.addChild(operand0b);
      condOpNode.addChild(operand1);
View Full Code Here

Examples of info.bliki.wiki.template.expr.ast.FunctionNode

    return new FloatNode(doubleString);
  }

  @Override
  public FunctionNode createFunction(final SymbolNode head) {
    return new FunctionNode(head);
  }
View Full Code Here

Examples of info.bliki.wiki.template.expr.ast.FunctionNode

    return new FunctionNode(head);
  }

  @Override
  public FunctionNode createFunction(final SymbolNode head, final ASTNode arg0) {
    return new FunctionNode(head, arg0);
  }
View Full Code Here

Examples of info.bliki.wiki.template.expr.ast.FunctionNode

    return new FunctionNode(head, arg0);
  }

  @Override
  public FunctionNode createFunction(final SymbolNode head, final ASTNode arg0, final ASTNode arg1) {
    return new FunctionNode(head, arg0, arg1);
  }
View Full Code Here

Examples of info.bliki.wiki.template.expr.ast.FunctionNode

  /**
   * Creates a new list with no arguments from the given header object .
   */
  @Override
  public FunctionNode createAST(final ASTNode headExpr) {
    return new FunctionNode(headExpr);
  }
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.FunctionNode

                }
            } else if (this instanceof Scope) {
                if (this instanceof ScriptNode) {
                    ScriptNode sof = (ScriptNode)this;
                    if (this instanceof FunctionNode) {
                        FunctionNode fn = (FunctionNode)this;
                        sb.append(' ');
                        sb.append(fn.getName());
                    }
                    sb.append(" [source name: ");
                    sb.append(sof.getSourceName());
                    sb.append("] [encoded source length: ");
                    sb.append(sof.getEncodedSourceEnd()
View Full Code Here

Examples of org.apache.flex.compiler.internal.tree.as.FunctionNode

     @return true if the node is in a constructor function.
     */
    @SuppressWarnings("unchecked")
    public static boolean isInConstructor(IASNode iNode)
    {
        FunctionNode fnode = (FunctionNode) searchUpForType(iNode, FunctionNode.class);
        return fnode != null && fnode.isConstructor();
    }
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.