Package anvil.script

Examples of anvil.script.Name


        FunctionStatement function = getFunctionStatement();
        if (function.getType() == Type.CONSTRUCTOR) {
          BlockStatement block = function.getBlockStatement();
          if (parent == function && block.isEmpty()) {
            _expression = new Expression(new LinkNode(this, location,
              new Name().add(Name.SUPER, "super"), parameters, LinkNode.SUPER), location);

          } else {
            parser.error(location, "Superclass constructor invoke must appear as a first statement (characters between tags are considered statements)");
          }
        } else {
          parser.error(location, "Superclass constructor invoke may only appear in constructor");
        }
       
      } else {
        // super.method(params, ...)
        _expression = new Expression(new LinkNode(this, location,
            new Name().add(Name.SUPER, "super").add(method), parameters, LinkNode.GET), location);
           
      }
     
    } else {
      if (method == null) {
        parser.error(location, "Attribute 'method' not given");
        return;
      }
     
      if (from == null) {
        // method(params, ...)
        _expression = new Expression(new LinkNode(this, location,
            new Name().add(method), parameters, LinkNode.GET), location);
           
      } else {
        // expr.method(params, ...)
        Expression self = Grammar.parseExpression(from, location, parser);
        _expression = new Expression(new InvokeNode(self, method, parameters), location);
View Full Code Here


  private Expression buildExpr(Location location, String handler, String method, ExpressionList args)
  {
    if (handler != null) {
      handler = handler.trim();
      return new Expression(new LinkNode(this, location,
        new Name().add(_namespace).add(handler), args,
        LinkNode.GET) ,location);
       
    } else if (method != null) {
      return new Expression(new InvokeNode(FRAME, method, EMPTY_ARGS), location);
     
View Full Code Here

  public synchronized void register(String dottedname, NativeNamespace lib)
  {
    if (!Grammar.isValidIdentifier(lib.getName())) {
      throw new RuntimeException("Name of '"+dottedname+"' is invalid");
    }
    Name name = Grammar.parseDottedName(dottedname);
    IncrementalScope scope = this;   
    int i = 0;
    int n = name.size();
    while(i < n) {
      String s = name.get(i++);
      Type type = scope.lookupDeclaration(s);
      if (type == null) {
        if (i < n) {
          SyntheticNamespace ns = new SyntheticNamespace(scope, s);
          scope.addDeclaration(ns);
View Full Code Here

  }

  final public Name Name(Name name) throws ParseException {
  Token t;
    if (name == null) {
      name = new Name();
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SYMBOL:
      t = jj_consume_token(SYMBOL);
      break;
View Full Code Here

    {if (true) return name;}
    throw new Error("Missing return statement in function");
  }

  final public Name[] RequestedDeclarations() throws ParseException {
  Name name;
  Token as = null;
  ArrayList decls = new ArrayList();
    name = Name(null);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOT:
    case AS:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AS:
        jj_consume_token(AS);
        as = jj_consume_token(SYMBOL);
        break;
      case DOT:
        jj_consume_token(DOT);
        jj_consume_token(STAR);
                     name.enableStar();
        break;
      default:
        jj_la1[8] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[9] = jj_gen;
      ;
    }
      decls.add(name);
      if (as != null) {
        name.setAs(as.image);
        as = null;
      }
    label_6:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case COMMA:
        ;
        break;
      default:
        jj_la1[10] = jj_gen;
        break label_6;
      }
      jj_consume_token(COMMA);
      name = Name(null);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT:
      case AS:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case AS:
          jj_consume_token(AS);
          as = jj_consume_token(SYMBOL);
          break;
        case DOT:
          jj_consume_token(DOT);
          jj_consume_token(STAR);
                       name.enableStar();
          break;
        default:
          jj_la1[11] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[12] = jj_gen;
        ;
      }
      decls.add(name);
      if (as != null) {
        name.setAs(as.image);
        as = null;
      }
    }
    {if (true) return (Name[])decls.toArray(new Name[decls.size()]);}
    throw new Error("Missing return statement in function");
View Full Code Here

  final public void Import() throws ParseException {
  Token t;
  Token href;
  Token as = null;
  Name entity = null;
  Name[] decls;
  boolean added = false;
    DefinitionStatement scope = flowPeek().getDefinitionStatement();
    try {
      t = jj_consume_token(IMPORT);
      Location location = toLocation(t);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING_LITERAL:
        href = jj_consume_token(STRING_LITERAL);
        String pathinfo = Conversions.unescape(href.image, true);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case AS:
        case COLON:
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case AS:
            jj_consume_token(AS);
            as = jj_consume_token(SYMBOL);
            scope.addHrefImport(this, location, pathinfo, as.image, null, false);
            added = true;
            break;
          case COLON:
            jj_consume_token(COLON);
            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
            case MODULE:
            case SYMBOL:
              decls = RequestedDeclarations();
              scope.addHrefImport(this, location, pathinfo, null, decls, false);
              added = true;
              break;
            case STAR:
              jj_consume_token(STAR);
              scope.addHrefImport(this, location, pathinfo, null, null, true);
              added = true;
              break;
            default:
              jj_la1[13] = jj_gen;
              jj_consume_token(-1);
              throw new ParseException();
            }
            break;
          default:
            jj_la1[14] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
          }
          break;
        default:
          jj_la1[15] = jj_gen;
          ;
        }
        if (!added) {
          scope.addHrefImport(this, location, pathinfo, null, null, false);
        }
        break;
      case MODULE:
      case SYMBOL:
        entity = Name(null);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT:
        case AS:
        case COLON:
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case DOT:
            jj_consume_token(DOT);
            jj_consume_token(STAR);
            scope.addEntityImport(this, location, entity, null, true);
            added = true;
            break;
          case AS:
            jj_consume_token(AS);
            as = jj_consume_token(SYMBOL);
            entity.setAs(as.image);
            scope.addEntityImport(this, location, entity, null, false);
            added = true;
            break;
          case COLON:
            jj_consume_token(COLON);
View Full Code Here

      ArgumentList();
      jj_consume_token(CLOSE);
      jj_consume_token(SEMICOLON);
      Location location = toLocation(t);
      flowPushChild(new EvalStatement(flowPeek(), location, new Expression(
          new LinkNode(flowPeek(), location, new Name().add(t), (Parent)pop(),
          LinkNode.SUPER), location)));
      flowPop();
      break;
    default:
      jj_la1[24] = jj_gen;
View Full Code Here

      flowPop();
      flowPop();
  }

  final public LinkNode EntityReference(Location location) throws ParseException {
  Name name;
    name = Name(null);
    {if (true) return new LinkNode(flowPeek(), location, name);}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

    }
  }

  final public void IsExpression() throws ParseException {
  Token t;
  Name name;
  boolean not = false;
    LazyExpression();
    label_44:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
View Full Code Here

  }

  final public void NewConstruct() throws ParseException {
  Token t;
  Location location;
  Name name = new Name();
    t = jj_consume_token(NEW);
      location = toLocation(t);
      name.add(t);
    Name(name);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case OPEN:
      jj_consume_token(OPEN);
      ArgumentList();
View Full Code Here

TOP

Related Classes of anvil.script.Name

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.