Examples of IString


Examples of org.eclipse.imp.pdb.facts.IString

      monitor.event("Importing and normalizing grammar:" + name, 30);
      IConstructor grammar = getGrammar(monitor, name, definition);
      debugOutput(grammar.toString(), System.getProperty("java.io.tmpdir") + "/grammar.trm");
      String normName = name.replaceAll("::", "_");
      monitor.event("Generating java source code for parser: " + name,30);
      IString classString = (IString) evaluator.call(monitor, "generateObjectParser", vf.string(packageName), vf.string(normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/parser.java");
      monitor.event("Compiling generated java code: " + name, 30);
      return bridge.compileJava(loc, packageName + "." + normName, classString.getValue());
    catch (ClassCastException e) {
      throw new ImplementationError("parser generator:" + e.getMessage(), e);
    } catch (Throw e) {
      throw new ImplementationError("parser generator: " + e.getMessage() + e.getTrace());
    } finally {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

    try {
      monitor.event("Importing and normalizing grammar: " + name, 10);
      IConstructor grammar = getGrammar(monitor, name, definition);
      String normName = name.replaceAll("::", "_");
      monitor.event("Generating java source code for Rascal parser:" + name, 10);
      IString classString = (IString) evaluator.call(monitor, "generateMetaParser", vf.string(packageName), vf.string("$Rascal_" + normName), vf.string(packageName + "." + normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/metaParser.java");
      monitor.event("compiling generated java code: " + name, 10);
      return bridge.compileJava(loc, packageName + ".$Rascal_" + normName, objectParser.getClass(), classString.getValue());
    catch (ClassCastException e) {
      throw new ImplementationError("meta parser generator:" + e.getMessage(), e);
    } catch (Throw e) {
      throw new ImplementationError("meta parser generator: " + e.getMessage() + e.getTrace());
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

  public Class<IGTD<IConstructor, IConstructor, ISourceLocation>> getNewParser(IRascalMonitor monitor, URI loc, String name, IConstructor grammar) {
    monitor.startJob("Generating parser:" + name, 100, 60);
    try {
      String normName = name.replaceAll("::", "_").replaceAll("\\\\", "_");
      monitor.event("Generating java source code for parser: " + name,30);
      IString classString = (IString) evaluator.call(monitor, "newGenerate", vf.string(packageName), vf.string(normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/parser.java");
      monitor.event("Compiling generated java code: " + name, 30);
      return bridge.compileJava(loc, packageName + "." + normName, classString.getValue());
    catch (ClassCastException e) {
      throw new ImplementationError("parser generator:" + e.getMessage(), e);
    } catch (Throw e) {
      throw new ImplementationError("parser generator: " + e.getMessage() + e.getTrace());
    } finally {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

  private void printTransitions(PrintStream fos, ISet st){
    fos.println("des(0," + st.size() + "," + numberOfStates(st) + ")");
    for(IValue v : st){
      ITuple t = (ITuple) v;
      IInteger from = (IInteger) t.get(0);
      IString act = (IString) t.get(1);
      IInteger to = (IInteger) t.get(2);
      fos.print('(');
      fos.print(from.intValue());
      fos.print(',');
      fos.print("\"" + act.getValue() + "\"");
      fos.print(',');
      fos.print(to.intValue());
      fos.print(')');
      fos.println();
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

      monitor.event("Importing and normalizing grammar:" + name, 30);
      IConstructor grammar = convertMapToGrammar(definition);
      debugOutput(grammar.toString(), System.getProperty("java.io.tmpdir") + "/grammar.trm");
      String normName = name.replaceAll("::", "_");
      monitor.event("Generating java source code for parser: " + name,30);
      IString classString = (IString) evaluator.call(monitor, "generateObjectParser", vf.string(packageName), vf.string(normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/parser.java");
      monitor.event("Compiling generated java code: " + name, 30);
      Class<IGTD<IConstructor, IConstructor, ISourceLocation>> p = bridge.compileJava(loc, packageName + "." + normName, getClass(), classString.getValue());

      String className = normName;
      Class<?> clazz;
      for (ClassLoader cl: evaluator.getClassLoaders()) {
        try {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

    try {
      monitor.event("Importing and normalizing grammar: " + name, 10);
      IConstructor grammar = convertMapToGrammar(definition);
      String normName = name.replaceAll("::", "_");
      monitor.event("Generating java source code for Rascal parser:" + name, 10);
      IString classString = (IString) evaluator.call(monitor, "generateMetaParser", vf.string(packageName), vf.string("$Rascal_" + normName), vf.string(packageName + "." + normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/metaParser.java");
      monitor.event("compiling generated java code: " + name, 10);
      return bridge.compileJava(loc, packageName + ".$Rascal_" + normName, objectParser.getClass(), classString.getValue());
    catch (ClassCastException e) {
      throw new CompilerError("meta parser generator:" + e.getMessage() + e);
    } catch (Throw e) {
      throw new CompilerError("meta parser generator: " + e.getMessage() + e.getTrace());
    }
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

    monitor.startJob("Generating parser:" + name, 100, 60);
    try {

      String normName = name.replaceAll("::", "_").replaceAll("\\\\", "_");
      monitor.event("Generating java source code for parser: " + name,30);
      IString classString = (IString) evaluator.call(monitor, "newGenerate", vf.string(packageName), vf.string(normName), grammar);
      debugOutput(classString.getValue(), System.getProperty("java.io.tmpdir") + "/parser.java");
      monitor.event("Compiling generated java code: " + name, 30);
      return bridge.compileJava(loc, packageName + "." + normName, this.getClass(), classString.getValue());
    catch (ClassCastException e) {
      throw new CompilerError("parser generator:" + e.getMessage() + e);
    } catch (Throw e) {
      throw new CompilerError("parser generator: " + e.getMessage() + e.getTrace());
    } finally {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

        }
        sl = ValueFactoryFactory.getValueFactory().sourceLocation(uri);
      }
     
      String moduleName = Names.fullName(this.getName());
      IString mn = this.VF.string(moduleName);
     
      // Using the scheme, get back the correct importer
      ICallableValue importer = getImporter(resourceScheme, eval.getCurrentEnvt());
     
      if (importer != null) {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

        }
      }
     
      private Response translateFileResponse(Method method, IConstructor cons) {
        ISourceLocation l = (ISourceLocation) cons.get("file");
        IString mimeType = (IString) cons.get("mimeType");
        IMap header = (IMap) cons.get("header");
        URI uri = l.getURI();
       
        Response response;
        try {
          response = new Response(Status.OK, mimeType.getValue(), ctx.getResolverRegistry().getInputStream(uri));
          addHeaders(response, header);
          return response;
        } catch (IOException e) {
          e.printStackTrace(ctx.getStdErr());
          return new Response(Status.NOT_FOUND, "text/plain", l + " not found.\n" + e);
        }
      }

      private Response translateTextResponse(Method method, IConstructor cons) {
        IString mimeType = (IString) cons.get("mimeType");
        IMap header = (IMap) cons.get("header");
        IString data = (IString) cons.get("content");
        Status status = translateStatus((IConstructor) cons.get("status"));
       
        if (method != Method.HEAD) {
          switch (status) {
          case BAD_REQUEST:
          case UNAUTHORIZED:
          case NOT_FOUND:
          case FORBIDDEN:
          case RANGE_NOT_SATISFIABLE:
          case INTERNAL_ERROR:
            if (data.length() == 0) {
              data = vf.string(status.getDescription());
            }
          default:
            break;
          }
        }
        Response response = new Response(status, mimeType.getValue(), data.getValue());
        addHeaders(response, header);
        return response;
      }

      private void addHeaders(Response response, IMap header) {
View Full Code Here

Examples of org.eclipse.imp.pdb.facts.IString

    return new Document(nodeToElement(node));
  }

  private Element nodeToElement(IConstructor elt) {
    IConstructor ns = (IConstructor) elt.get(0);
    IString name = (IString) elt.get(1);
    IList kids = (IList) elt.get(2);
    Element e = new Element(name.getValue(), namespaceToNamespace(ns));
    for (IValue k: kids) {
      IConstructor n = (IConstructor) k;
      if (n.getConstructorType() == Factory.Node_attribute) {
        e.setAttribute(nodeToAttribute(n));
      }
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.