Package anvil.script.expression

Examples of anvil.script.expression.Parent



  public void parse(TemplateParser parser, Tag tag)
  {
    Location location = getLocation();
    Parent parameters;
  
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, location, params);
      parameters = p.parseParameterList();
     
    } else {
      int size = 0;
      int n = tag.getLength();
      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);
        }
      }
    }

    String from = tag.getValue("from");
View Full Code Here


      jj_consume_token(-1);
      throw new ParseException();
    }
    List(false, false);
    Location location = toLocation(op);
    Parent assignment = null;
    switch(op.kind) {
    case ASSIGN:
      assignment = new AssignmentNode(location, count + 1);
      break;
    case ASSIGN_ADD:
      assignment = new AdditionAssignmentNode(location, count + 1);
      break;
    case ASSIGN_SUBSTRACT:
      assignment = new SubtractionAssignmentNode(location, count + 1);
      break;
    case ASSIGN_MULTIPLY:
      assignment = new MultiplicationAssignmentNode(location, count + 1);
      break;
    case ASSIGN_DIVIDE:
      assignment = new DivisionAssignmentNode(location, count + 1);
      break;
    case ASSIGN_REMAINDER:
      assignment = new ModuloAssignmentNode(location, count + 1);
      break;
    case ASSIGN_CONCAT:
      assignment = new ConcatenationAssignmentNode(location, count + 1);
      break;
    case ASSIGN_INIT:
      assignment = new InitAssignmentNode(location, count + 1);
      break;
    }
    assignment.setChild(count, pop());
    while(count-- > 0) {
      assignment.setChild(count, pop());
    }
    push(new Expression(assignment, location));
  }
View Full Code Here

  final public void Symbol(int role) throws ParseException {
  Token t;
  Token var = null;
  Location location;
  Parent args = null;
  Name name = new Name();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case MODULE:
    case SYMBOL:
    case FUNCTION:
View Full Code Here

  final public void ObjectConstruct(int role) throws ParseException {
  Token t;
  boolean terminated = false;
  boolean isMethod;
  Parent parameters;
    label_47:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case BEGIN:
      case DOT:
      case OPEN:
      case OPEN_BRACKET:
        ;
        break;
      default:
        jj_la1[138] = jj_gen;
        break label_47;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case OPEN:
        t = jj_consume_token(OPEN);
        ArgumentList();
        jj_consume_token(CLOSE);
        parameters = (Parent)pop();
        if (parameters.hasNamedParameters()) {
          error(toLocation(t), "Named parameters are ignored in anonymous calls");
        }
        push(new DynamicCallNode(pop(), parameters));
        break;
      case BEGIN:
        InlineFunction();
        parameters = new ExpressionList(pop());
        push(new DynamicCallNode(pop(), parameters));
        break;
      case DOT:
        jj_consume_token(DOT);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OPEN:
          t = jj_consume_token(OPEN);
          ExpressionStart();
          jj_consume_token(CLOSE);
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case OPEN:
            jj_consume_token(OPEN);
            ArgumentList();
            jj_consume_token(CLOSE);
            break;
          case BEGIN:
            InlineFunction();
                           push(new ExpressionList(pop()));
            break;
          default:
            jj_la1[139] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
          }
        if (terminated) {
          error(toLocation(t), "Empty brackets terminate variable expression");
        }
        parameters = (Parent)pop();
        if (parameters.hasNamedParameters()) {
          error(toLocation(t), "Named parameters are ignored in anonymous invokes");
        }
        Node method = pop();
        Node self = pop();
        push(new DynamicInvokeNode(self, method, parameters));
          break;
        case SYMBOL:
          t = jj_consume_token(SYMBOL);
                   isMethod = false;
          if (jj_2_23(2)) {
            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
            case OPEN:
              jj_consume_token(OPEN);
              ArgumentList();
              jj_consume_token(CLOSE);
              break;
            case BEGIN:
              InlineFunction();
                             push(new ExpressionList(pop()));
              break;
            default:
              jj_la1[140] = jj_gen;
              jj_consume_token(-1);
              throw new ParseException();
            }
          isMethod = true;
          } else {
            ;
          }
        if (terminated) {
          error(toLocation(t), "Empty brackets terminate variable expression");
        }
        if (isMethod) {
          parameters = (Parent)pop();
          if (parameters.hasNamedParameters()) {
            error(toLocation(t), "Named parameters are ignored in anonymous invokes");
          }
          push(new InvokeNode(pop(), t.image, parameters));
        } else {
          push(new AttributeNode(pop(), t.image));
View Full Code Here

    }
    jj_consume_token(CLOSE_BRACKET);
      if (node != null) {
        push(node);
      } else {
        Parent argv = new ExpressionList(argc);
        for(--argc; argc>=0; argc--) {
          argv.setChild(argc, pop());
        }
        push(new ArrayNode(argv));
      }
  }
View Full Code Here

      break;
    default:
      jj_la1[154] = jj_gen;
      ;
    }
    Parent argv = new ExpressionList(argc);
    for(int i=argc-1; i>=0; i--) {
      argv.setChild(i, pop());
    }
    push(argv);
  }
View Full Code Here

  }


  public void parse(TemplateParser parser, Tag tag)
  {
    Parent parameters;
    Location location = getLocation();
  
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, parser.getLocation(), params);
      parameters = p.parseParameterList();
   
    } else {
      int size = 0;
      int n = tag.getLength();
      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);
        }
      }
    }

    String dottedname = tag.getValue("function");
View Full Code Here

TOP

Related Classes of anvil.script.expression.Parent

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.