Package loop.ast

Examples of loop.ast.Variable


      InlineListDef list = (InlineListDef) child;

      if (!list.children().isEmpty()) {
        Node first = list.children().get(0);
        if (first instanceof Variable) {
          Variable var = (Variable) first;

          if ("define".equals(var.name)) {
            return transformToFunctionDecl(list);
          } else {
            // This is a function call.
View Full Code Here


      throw new RuntimeException("Incorrect number of arguments: " + list);

    Node second = list.children().get(1);
    String name;
    if (second instanceof Variable) {
      Variable var = (Variable) second;

      name = var.name;
    } else
      throw new RuntimeException("Expected function name in (define)");

    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);
View Full Code Here

      return new BooleanLiteral(new Token(token.value, Token.Kind.FALSE, token.line, token.column));

    if (token.value.trim().isEmpty())
      return null;

    return new Variable(token.value);
  }
View Full Code Here

TOP

Related Classes of loop.ast.Variable

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.