Package loop.ast.script

Examples of loop.ast.script.ArgDeclList$Argument


    Node third = list.children().get(2);
    if (!(third instanceof InlineListDef))
      throw new RuntimeException("Expected argument definition");

    ArgDeclList args = new ArgDeclList();
    List<Node> exprs = reduce(third).children();
    for (Node expr : exprs) {
      Variable argName = (Variable) expr;
      args.add(new ArgDeclList.Argument(argName.name, null));
    }

    FunctionDecl functionDecl = new FunctionDecl(name, args);

    Node fourth = list.children().get(3);
View Full Code Here


      // Reset the parser in case we've already parsed an identifier.
      i--;
      return null;
    }

    ArgDeclList arguments = argDeclList();
    String name = anonymous ? null : funcName.get(0).value;
    startTokens = funcName != null ? funcName : startTokens;
    FunctionDecl functionDecl = new FunctionDecl(name, arguments).sourceLocation(startTokens);

    // We need to set the module name here because closures are not declared as
View Full Code Here

    if (null == first) {
      if (null == match(Token.Kind.RPAREN)) {
        addError("Expected ')' or identifier in function argument list", tokens.get(i - 1));
        throw new LoopCompileException();
      }
      return new ArgDeclList().sourceLocation(lparenTokens);
    }

    List<Token> optionalType = match(Token.Kind.ASSIGN, Token.Kind.TYPE_IDENT);
    ArgDeclList arguments = new ArgDeclList().sourceLocation(lparenTokens);

    String firstTypeName = optionalType == null ? null : optionalType.get(1).value;
    arguments.add(new ArgDeclList.Argument(first.get(0).value, firstTypeName));

    while (match(Token.Kind.COMMA) != null) {
      List<Token> nextArg = match(Token.Kind.IDENT);
      if (null == nextArg) {
        addError("Expected identifier after ',' in function arguments", tokens.get(i - 1));
        throw new LoopCompileException();
      }
      optionalType = match(Token.Kind.ASSIGN, Token.Kind.TYPE_IDENT);
      firstTypeName = optionalType == null ? null : optionalType.get(1).value;

      arguments.add(new ArgDeclList.Argument(nextArg.get(0).value, firstTypeName));
    }

    if (match(Token.Kind.RPAREN) == null) {
      addError("Expected ')' at end of function arguments", tokens.get(i - 1));
      throw new LoopCompileException();
View Full Code Here

    gBuilder.withOption(oBuilder.reset().withId(OPTION_QS).withShortName("qs").withLongName("querysilent").withDescription(
        "Silent Query the status of an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_QX).withShortName("qx").withLongName("queryposix").withDescription(
        "Query the status of a posix daemon. Return status as exit code").create());

    Argument pid = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to").withMinimum(1).withMaximum(1).withValidator(
        NumberValidator.getIntegerInstance()).create();

    gBuilder.withOption(oBuilder.reset().withId(OPTION_N).withShortName("n").withLongName("reconnect").withDescription(
        "recoNnect to existing application").withArgument(pid).create());

    Argument pid2 = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to").withMinimum(1).withMaximum(1).withValidator(
        NumberValidator.getIntegerInstance()).create();

    Argument defaultFile = aBuilder.reset().withName(DEFAULT_FILE).withDescription("Default Configuration File").withMinimum(0).withMaximum(1)
        .withValidator(VFSFileValidator.getExistingFileInstance().setBase(".")).create();
    /*
     * GroupBuilder childGbuilder = new GroupBuilder(); DefaultOptionBuilder
     * childoObuilder = new DefaultOptionBuilder("-", "--", true);
     *
 
View Full Code Here

                                    String defaultValue) {
    ArgumentBuilder argBuilder = new ArgumentBuilder().withName(name).withMinimum(1).withMaximum(1);
    if (defaultValue != null) {
      argBuilder = argBuilder.withDefault(defaultValue);
    }
    Argument arg = argBuilder.create();
    return new DefaultOptionBuilder().withLongName(name).withRequired(required).withShortName(shortName)
        .withArgument(arg).withDescription(description).create();
  }
View Full Code Here

    }
  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required){
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      create();
    return builder.
View Full Code Here

  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required, Validator validator){
   
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      withValidator(validator).
      create();
View Full Code Here

    }
  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required){
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      create();
    return builder.
View Full Code Here

  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required, Validator validator){
   
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      withValidator(validator).
      create();
View Full Code Here

    }
  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required){
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      create();
    return builder.
View Full Code Here

TOP

Related Classes of loop.ast.script.ArgDeclList$Argument

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.