Package anvil.script.expression

Examples of anvil.script.expression.ExpressionList


    try {
      TerminalArgumentList();
      return (Parent)pop();
    } catch (ParseException e) {
      error(_location, e.getMessage());
      return new ExpressionList(0);
    }
  }
View Full Code Here


    try {
      TerminalList();
      return (ExpressionList)pop();
    } catch (ParseException e) {
      error(_location, e.getMessage());
      return new ExpressionList(0);
    }
  }
View Full Code Here

      for (int i=0; i<n; i++) {
        if (tag.getName(i).equalsIgnoreCase("param")) {
          size++;
        }
      }
      parameters = new ExpressionList(size);
      int c = 0;
      for (int i=0; i<n; i++) {
        if (tag.getName(i).equalsIgnoreCase("param")) {
          Expression expression = Grammar.parseExpression(tag.getValue(i), location, parser);
          parameters.setChild(c++, expression);
View Full Code Here

      code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "hasMoreElements", "()Z"));
      code.if_eq(_endscope);

      if (_index != null) {
       
        new AssignmentNode(new ExpressionList(_index,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              _indexvar.compile(context, GET);
            }
          })).compile(context, Node.GET);
         
        code.pop();
       
        _indexvar.compile(context, new Node() {
          public void compile(ByteCompiler context, int operation)
          {
            Code code_ = context.getCode();
            _indexvar.compile(context, GET);
            code_.invokevirtual(code_.getPool().addMethodRef(context.TYPE_ANY,
              "increase", "()Lanvil/core/Any;"));
          }
        });
        code.pop();
      }

      if (_key != null) {
        new AssignmentNode(new ExpressionList(_key,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              _enumvar.compile(context, Node.GET);
              code_.invokeinterface(pool_.addInterfaceMethodRef("anvil/java/util/BindingEnumeration", "nextKey", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }


      if (_value != null) {
        new AssignmentNode(new ExpressionList(_value,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              _enumvar.compile(context, Node.GET);
              code_.invokeinterface(pool_.addInterfaceMethodRef("java/util/Enumeration", "nextElement", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();

      } else
        _enumvar.compile(context, Node.GET);
        code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "nextElement", "()Ljava/lang/Object;"));
        code.pop();

      }

      _statement.compile(context);
      code.go_to(_startscope);
      _endscope.bind();
      _startscope.bind(start);

    } else {

      final int l_enum = code.addLocal();
      final int l_index = (_index != null) ? code.addLocal() : 0;
      if (l_index != 0) {
        code.iconst(0);
        code.istore(l_index);
      }

      // create enumeration, and wrap it
      int clazz1 = pool.addClass("java/util/Enumeration");
      int clazz2 = pool.addClass("anvil/java/util/BindingEnumeration");
      _expression.compile(context, Expression.GET);
      code.invokevirtual(pool.addMethodRef(context.TYPE_ANY, "enumeration", "()Lanvil/java/util/BindingEnumeration;"));
      code.astore(l_enum);
      int sun_hack_1 = 10 + l_enum;

      Target start = code.getTarget();
      _startscope = code.getSource();
      _endscope = code.getSource();

      code.aload(l_enum);
      int sun_hack_2 = 10 + l_enum;
     
      code.invokeinterface(pool.addInterfaceMethodRef(clazz1, "hasMoreElements", "()Z"));
      code.if_eq(_endscope);

      if (_index != null) {
        new AssignmentNode(new ExpressionList(_index,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              code_.iload(l_index);
              code_.iinc(l_index, 1);
              code_.invokestatic(code_.getPool().addMethodRef(
                context.TYPE_ANY, "create", "(I)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }

      if (_key != null) {
        new AssignmentNode(new ExpressionList(_key,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
              code_.aload(l_enum);
              code_.invokeinterface(pool_.addInterfaceMethodRef("anvil/java/util/BindingEnumeration", "nextKey", "()Ljava/lang/Object;"));
              code_.invokestatic(pool_.addMethodRef(context.TYPE_ANY, "create", "(Ljava/lang/Object;)Lanvil/core/Any;"));
            }
          })).compile(context, Node.GET);
        code.pop();
      }

      if (_value != null) {
        new AssignmentNode(new ExpressionList(_value,
          new Node() {
            public void compile(ByteCompiler context, int operation)
            {
              Code code_ = context.getCode();
              ConstantPool pool_ = code_.getPool();
View Full Code Here

      if (buffer.length()>0) {
        sections.add(new ConstantNode(Conversions.unescape(buffer.toString(), false)));
      }
     
      n = sections.size();
      ExpressionList list = new ExpressionList(n);
      for(int i=0; i<n; i++) {
        list.setChild(i, (Node)sections.get(i));
      }
      return new StringBufferNode(list);
     
    } else {
      return new ConstantNode(Conversions.unescape(image, false));
View Full Code Here

        }
      }
    }

    int n = nodes.size();
    ExpressionList childs = new ExpressionList(n);
    for(int i=0; i<n; i++) {
      childs.setChild(i, (Node)nodes.get(i));
    }

    Location location = getLocation();
   
    _init = buildExpr(location,
      _tagdef.getInitHandler(),
      null,
      new ExpressionList(
        new ParentNode(), new ConstantNode(_name),
        new ArrayNode(childs)));
       
    _start = buildExpr(location,
      _tagdef.getStartHandler(),
View Full Code Here

  public void parse(TemplateParser parser, Tag tag)
  {
    String expr = tag.getValue("value");
    if (expr != null) {
      ExpressionParser p = new ExpressionParser(parser, getLocation(), expr);
      ExpressionList list = p.parseExpressionList();
      int n = list.childs();
      _expressions = new Expression[n];
      for(int i=0; i<n; i++) {
        _expressions[i] = new Expression(list.getChild(i), getLocation());
      }
    }

    int n = tag.getLength();
    String name;
View Full Code Here

    default:
      jj_la1[55] = jj_gen;
      ;
    }
    jj_consume_token(CLOSE);
      ExpressionList types = null;
      if (count > 0) {
        types = new ExpressionList(count);
        for(count--; count>=0; count--) {
          types.setChild(count, ((Expression)pop()).getChild(0));
        }
      }
      Location location = toLocation(t);
      Expression assignment = (Expression)pop();
      Statement context = (trystmt != null) ? trystmt : flowPeek();
View Full Code Here

          while(argc-- > 0) {
            list.setChild(argc, pop());
          }
          push(list);
        } else {
          ExpressionList list = new ExpressionList(argc);
          while(argc-- > 0) {
            list.setChild(argc, pop());
          }
          push(list);
        }
      }
  }
View Full Code Here

    default:
      jj_la1[128] = jj_gen;
      if (jj_2_17(2)) {
        jj_consume_token(OPEN);
        jj_consume_token(CLOSE);
      push(new ExpressionList(0));
        ObjectConstruct(LinkNode.GET);
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OPEN:
          jj_consume_token(OPEN);
View Full Code Here

TOP

Related Classes of anvil.script.expression.ExpressionList

Copyright © 2018 www.massapicom. 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.