Package anvil.script

Examples of anvil.script.ParameterListDeclaration


  public FunctionBase(Scope parent, Method method, String name, Object[] parameters, Doc document)
  {
    super(parent, name, document);
    _method       = method;
    _functionname = method.getName();
    _parameters   = new ParameterListDeclaration(method, parameters, document);
    _isinner      = (name.indexOf('$')>=0);
    if (document != null) {
      Doc[] defines = document.find(Doc.T_DEFINE, null);
      int n = defines.length;
      if (n>0) {
View Full Code Here


  }


  public ParameterListDeclaration parseParameters(TemplateParser parser, Tag tag)
  {
    ParameterListDeclaration parameters = new ParameterListDeclaration();
    String params = tag.getValue("params");
    if (params != null) {
      ExpressionParser p = new ExpressionParser(parser, parser.getLocation(), params);
      p.parseParameterListDeclaration(parameters);
   
    } else {
      parameters.open();
      int n = tag.getLength();
      for(int i=0; i<n; i++) {
        String name = tag.getName(i);
        if (name.equalsIgnoreCase("param")) {

          String param = tag.getValue(i);
          Expression defaultexpr = null;

          if ((i<n-1) && tag.getName(i+1).equalsIgnoreCase("default")) {
            String def = tag.getValue(i+1);
            defaultexpr = Grammar.parseExpression(def, getLocation(), parser);
            i++;
          } else {
            if (parameters.hasDefaultValues()) {
              parser.error(getLocation(), "Parameters with default values must appear last");
              defaultexpr = null;
            }
          }

          if (Grammar.isValidIdentifier(param)) {
            if (parameters.isDeclared(param)) {
              parser.error(getLocation(), "Entity '"+param+"' is already declared");
            } else {
              parameters.add(param, defaultexpr);
            }
          } else {
            parser.error(getLocation(), "Parameter name '"+param+"' is invalid");
          }

        }
      }

      String rest = tag.getValue("rest");
      if (rest != null) {
        rest = rest.trim();
        if (!Grammar.isValidIdentifier(rest)) {
          parser.error(getLocation(), "Parameter '" + rest + "' is invalid");
        } else {
          if (parameters.isDeclared(rest)) {
            parser.error(getLocation(), "Entity '"+rest+"' is already declared");
          } else {
            parameters.add(PARAMETER_REST, rest, Any.EMPTY_TUPLE, null);
          }
        }
      }
      parameters.close();
    }
   
    return parameters;
  }
View Full Code Here

    parameters.close();
  }

  final public void InterfaceMethod() throws ParseException {
  Token t, s;
  ParameterListDeclaration parameters = new ParameterListDeclaration();
    t = jj_consume_token(FUNCTION);
    s = jj_consume_token(SYMBOL);
    jj_consume_token(OPEN);
    FunctionParameterList(parameters);
    jj_consume_token(CLOSE);
View Full Code Here

  final public void Function() throws ParseException {
  Token r = null;
  Token t;
  Token s;
  ParameterListDeclaration parameters = new ParameterListDeclaration();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SYNCHRONIZED:
      r = jj_consume_token(SYNCHRONIZED);
      break;
    default:
View Full Code Here

  final public void Method() throws ParseException {
  boolean is_synchronized = false;
  boolean is_static = false;
  Token t;
  Token s;
  ParameterListDeclaration parameters = new ParameterListDeclaration();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SYNCHRONIZED:
      t = jj_consume_token(SYNCHRONIZED);
                       is_synchronized = true;
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
View Full Code Here

      flowPop();
  }

  final public void InlineFunction() throws ParseException {
  Token t;
  ParameterListDeclaration parameters = new ParameterListDeclaration();
    jj_consume_token(BEGIN);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case PIPE:
      t = jj_consume_token(PIPE);
      FunctionParameterList(parameters);
      jj_consume_token(PIPE);
      break;
    case BOOLEAN_OR:
      t = jj_consume_token(BOOLEAN_OR);
        parameters.open();
        parameters.close();
      break;
    default:
      jj_la1[33] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
View Full Code Here

  public void finish()
  {
    if (_constructor == null) {
      _constructor = new ConstructorStatement(getLocation(), this, false, _name, null,
        new ParameterListDeclaration().open().close());
    }
  }
View Full Code Here

TOP

Related Classes of anvil.script.ParameterListDeclaration

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.