Examples of Proto


Examples of com.dyuproject.protostuff.parser.Proto

    }
   
    public Proto loadFrom(File file, Proto importer) throws Exception
    {
        String key = file.getCanonicalPath();
        Proto proto = loadedProtos.get(key);
        if(proto == null)
            loadedProtos.put(key, proto = super.loadFrom(file, null));
       
        return proto;
    }
View Full Code Here

Examples of com.dyuproject.protostuff.parser.Proto

    }
   
    public Proto loadFrom(URL resource, Proto importer) throws Exception
    {
        String key = resource.toExternalForm();
        Proto proto = loadedProtos.get(key);
        if(proto == null)
            loadedProtos.put(key, proto = super.loadFrom(resource, null));
       
        return proto;
    }
View Full Code Here

Examples of com.dyuproject.protostuff.parser.Proto

    }
   
    public Proto loadFrom(File file, Proto importer) throws Exception
    {
        String key = file.getCanonicalPath();
        Proto proto = loadedProtos.get(key);
        if(proto == null)
            loadedProtos.put(key, proto = super.loadFrom(file, null));
       
        return proto;
    }
View Full Code Here

Examples of com.dyuproject.protostuff.parser.Proto

    }
   
    public Proto loadFrom(URL resource, Proto importer) throws Exception
    {
        String key = resource.toExternalForm();
        Proto proto = loadedProtos.get(key);
        if(proto == null)
            loadedProtos.put(key, proto = super.loadFrom(resource, null));
       
        return proto;
    }
View Full Code Here

Examples of detectiongame.proto.Proto

  /**
   * @param args
   */
  public static void main(String[] args) {
    DunGen game = null;
    Proto proto = null;
   
    boolean protoStart = false;
   
    for(int i = 0; i < args.length; i++) {
      if(args[i].equalsIgnoreCase("-proto")) {
        protoStart = true;
       
        proto = new Proto();
        proto.DISPLAY_WIDTH = 1280;
        proto.DISPLAY_HEIGHT = 800;
        proto.start();
      }
    }
   
    if(!protoStart) {
      game = new DunGen();
View Full Code Here

Examples of org.mvel2.ast.Proto

    this.splitAccumulator = splitAccumulator;
  }

  public Proto parse() {
    Proto proto = new Proto(protoName, pCtx);

    Mainloop:
    while (cursor < endOffset) {
      cursor = ParseTools.skipWhitespace(expr, cursor);

      int start = cursor;

      if (tk2 == null) {
        while (cursor < endOffset && isIdentifierPart(expr[cursor])) cursor++;

        if (cursor > start) {
          tk1 = new String(expr, start, cursor - start);

          if ("def".equals(tk1) || "function".equals(tk1)) {
            cursor++;
            cursor = ParseTools.skipWhitespace(expr, cursor);
            start = cursor;
            while (cursor < endOffset && isIdentifierPart(expr[cursor])) cursor++;

            if (start == cursor) {
              throw new CompileException("attempt to declare an anonymous function as a prototype member",
                  expr, start);
            }

            FunctionParser parser =
                new FunctionParser(new String(expr, start, cursor - start),
                    cursor, endOffset, expr, 0, pCtx, null);

            proto.declareReceiver(parser.getName(), parser.parse());
            cursor = parser.getCursor() + 1;

            tk1 = null;
            continue;
          }
        }

        cursor = ParseTools.skipWhitespace(expr, cursor);
      }

      if (cursor > endOffset) {
        throw new CompileException("unexpected end of statement in proto declaration: " + protoName,
            expr, start);
      }

      switch (expr[cursor]) {
        case ';':
          cursor++;
          calculateDecl();

          if (interpreted && type == DeferredTypeResolve.class) {
            /**
             * If this type could not be immediately resolved, it may be a look-ahead case, so
             * we defer resolution of the type until later and place it in the wait queue.
             */
            enqueueReceiverForLateResolution(deferredName,
                proto.declareReceiver(name, Proto.ReceiverType.DEFERRED, null), null);
          }
          else {
            proto.declareReceiver(name, type, null);
          }
          break;

        case '=':
          cursor++;
          cursor = ParseTools.skipWhitespace(expr, cursor);
          start = cursor;

          Loop:
          while (cursor < endOffset) {
            switch (expr[cursor]) {
              case '{':
              case '[':
              case '(':
              case '\'':
              case '"':
                cursor = balancedCaptureWithLineAccounting(expr, cursor, endOffset, expr[cursor], pCtx);
                break;

              case ';':
                break Loop;
            }
            cursor++;
          }

          calculateDecl();

          String initString = new String(expr, start, cursor++ - start);

          if (interpreted && type == DeferredTypeResolve.class) {
            enqueueReceiverForLateResolution(deferredName,
                proto.declareReceiver(name, Proto.ReceiverType.DEFERRED, null), initString);
          }
          else {
            proto.declareReceiver(name, type, (ExecutableStatement)
                subCompileExpression(initString, pCtx));
          }
          break;

        default:
View Full Code Here

Examples of org.mvel2.ast.Proto

          (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports();

      Object o = imports.values().toArray()[imports.size() - 1];

      if (o instanceof Proto) {
        Proto proto = (Proto) o;

        int last = proto.getCursorEnd();
        cursor--;

        /**
         * We walk backwards to ensure that the last valid statement was a proto declaration.
         */

        while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--;
        while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--;
        while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--;

        if (cursor != last) {
          throw new CompileException("unresolved reference (possible illegal forward-reference?): " +
              ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart());
        }
      }
    }
  }
View Full Code Here

Examples of org.mvel2.ast.Proto

    this.splitAccumulator = splitAccumulator;
  }

  public Proto parse() {
    Proto proto = new Proto(protoName);

    Mainloop:
    while (cursor < endOffset) {
      cursor = ParseTools.skipWhitespace(expr, cursor);

      int start = cursor;

      if (tk2 == null) {
        while (cursor < endOffset && isIdentifierPart(expr[cursor])) cursor++;

        if (cursor > start) {
          tk1 = new String(expr, start, cursor - start);

          if ("def".equals(tk1) || "function".equals(tk1)) {
            cursor++;
            cursor = ParseTools.skipWhitespace(expr, cursor);
            start = cursor;
            while (cursor < endOffset && isIdentifierPart(expr[cursor])) cursor++;

            if (start == cursor) {
              throw new CompileException("attempt to declare an anonymous function as a prototype member",
                  expr, start);
            }

            FunctionParser parser =
                new FunctionParser(new String(expr, start, cursor - start),
                    cursor, endOffset, expr, 0, pCtx, null);

            proto.declareReceiver(parser.getName(), parser.parse());
            cursor = parser.getCursor() + 1;

            tk1 = null;
            continue;
          }
        }

        cursor = ParseTools.skipWhitespace(expr, cursor);
      }

      if (cursor > endOffset) {
        throw new CompileException("unexpected end of statement in proto declaration: " + protoName,
            expr, start);
      }

      switch (expr[cursor]) {
        case ';':
          cursor++;
          calculateDecl();

          if (interpreted && type == DeferredTypeResolve.class) {
            /**
             * If this type could not be immediately resolved, it may be a look-ahead case, so
             * we defer resolution of the type until later and place it in the wait queue.
             */
            enqueueReceiverForLateResolution(deferredName,
                proto.declareReceiver(name, Proto.ReceiverType.DEFERRED, null), null);
          }
          else {
            proto.declareReceiver(name, type, null);
          }
          break;

        case '=':
          cursor++;
          cursor = ParseTools.skipWhitespace(expr, cursor);
          start = cursor;

          Loop:
          while (cursor < endOffset) {
            switch (expr[cursor]) {
              case '{':
              case '[':
              case '(':
              case '\'':
              case '"':
                cursor = balancedCaptureWithLineAccounting(expr, cursor, endOffset, expr[cursor], pCtx);
                break;

              case ';':
                break Loop;
            }
            cursor++;
          }

          calculateDecl();

          String initString = new String(expr, start, cursor++ - start);

          if (interpreted && type == DeferredTypeResolve.class) {
            enqueueReceiverForLateResolution(deferredName,
                proto.declareReceiver(name, Proto.ReceiverType.DEFERRED, null), initString);
          }
          else {
            proto.declareReceiver(name, type, (ExecutableStatement)
                subCompileExpression(initString, pCtx));
          }
          break;

        default:
View Full Code Here

Examples of org.mvel2.ast.Proto

          (LinkedHashMap<String, Object>) pCtx.getParserConfiguration().getImports();

      Object o = imports.values().toArray()[imports.size() - 1];

      if (o instanceof Proto) {
        Proto proto = (Proto) o;

        int last = proto.getCursorEnd();
        cursor--;

        /**
         * We walk backwards to ensure that the last valid statement was a proto declaration.
         */

        while (cursor > last && ParseTools.isWhitespace(expr[cursor])) cursor--;
        while (cursor > last && ParseTools.isIdentifierPart(expr[cursor])) cursor--;
        while (cursor > last && (ParseTools.isWhitespace(expr[cursor]) || expr[cursor] == ';')) cursor--;

        if (cursor != last) {
          throw new CompileException("unresolved reference (possible illegal forward-reference?): " +
              ProtoParser.getNextUnresolvedWaiting(), expr, proto.getCursorStart());
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.