Examples of OutputFile


Examples of org.javacc.parser.OutputFile

  }

  private static void generateTreeImpl()
  {
    File file = new File(jjtreeImplFile());
    OutputFile outputFile = null;

    try {
      String[] options = new String[] {"MULTI", "NODE_USES_PARSER", "VISITOR", "TRACK_TOKENS", "NODE_PREFIX", "NODE_EXTENDS", "NODE_FACTORY", "SUPPORT_CLASS_VISIBILITY_PUBLIC"};
      outputFile = new OutputFile(file, nodeVersion, options);
      outputFile.setToolName("JJTree");

      if (file.exists() && !outputFile.needToWrite) {
        return;
      }

      Map optionMap = new HashMap(Options.getOptions());
      optionMap.put("PARSER_NAME", JJTreeGlobals.parserName);
      optionMap.put("VISITOR_RETURN_TYPE", getVisitorReturnType());
      optionMap.put("VISITOR_DATA_TYPE", getVisitorArgumentType());
      optionMap.put("VISITOR_RETURN_TYPE_VOID", Boolean.valueOf(getVisitorReturnType().equals("void")));
      generateFile(outputFile, "/templates/cpp/TreeImplHeader.template", optionMap, false);

      boolean hasNamespace = JJTreeOptions.stringValue("NAMESPACE").length() > 0;
      if (hasNamespace) {
        outputFile.getPrintWriter().println("namespace " + JJTreeOptions.stringValue("NAMESPACE") + "{");
      }

      generateFile(outputFile, "/templates/cpp/SimpleNodeImpl.template", optionMap, false);
      for (Iterator i = nodesToGenerate.iterator(); i.hasNext(); ) {
        String s = (String)i.next();
        optionMap.put("NODE_TYPE", s);
        generateFile(outputFile, "/templates/cpp/MultiNodeImpl.template", optionMap, false);
      }

      if (hasNamespace) {
        outputFile.getPrintWriter().println("}");
      }
    } catch (IOException e) {
      throw new Error(e.toString());
    }
    finally {
      if (outputFile != null) { try { outputFile.close()} catch(IOException ioe) {} }
    }
  }
View Full Code Here

Examples of org.javacc.parser.OutputFile

    String name = nodeConstants();
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), name + ".h");
    headersForJJTreeH.add(file.getName());

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();

      List nodeIds = ASTNodeDescriptor.getNodeIds();
      List nodeNames = ASTNodeDescriptor.getNodeNames();

      generatePrologue(ostr);
View Full Code Here

Examples of org.javacc.parser.OutputFile

    }

    try {
      String name = visitorClass();
      File file = new File(visitorIncludeFile());
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();

      generatePrologue(ostr);
      ostr.println("#ifndef " + file.getName().replace('.', '_').toUpperCase().toUpperCase());
      ostr.println("#define " + file.getName().replace('.', '_').toUpperCase().toUpperCase());
      ostr.println("#include \"" + JJTreeGlobals.parserName + "Tree.h" + "\"");
View Full Code Here

Examples of org.javacc.parser.OutputFile

      return;
    }

    try {
      String[] options = new String[] {"MULTI", "NODE_USES_PARSER", "VISITOR", "TRACK_TOKENS", "NODE_PREFIX", "NODE_EXTENDS", "NODE_FACTORY", "SUPPORT_CLASS_VISIBILITY_PUBLIC"};
      OutputFile outputFile = new OutputFile(file, nodeVersion, options);
      outputFile.setToolName("JJTree");

      nodesGenerated.add(file.getName());

      if (!outputFile.needToWrite) {
        return;
      }

      if (nodeType.equals("Node")) {
        generateNode_cs(outputFile);
      } else if (nodeType.equals("SimpleNode")) {
        generateSimpleNode_cs(outputFile);
      } else {
        generateMULTINode_cs(outputFile, nodeType);
      }

      outputFile.close();

    } catch (IOException e) {
      throw new Error(e.toString());
    }
  }
View Full Code Here

Examples of org.javacc.parser.OutputFile

  {
    String name = nodeConstants();
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), name + ".cs");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();

      List nodeIds = ASTNodeDescriptor.getNodeIds();
      List nodeNames = ASTNodeDescriptor.getNodeNames();

      ostr.println("using System;");
View Full Code Here

Examples of org.javacc.parser.OutputFile

    String name = visitorClass();
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), name + ".cs");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();

      List nodeNames = ASTNodeDescriptor.getNodeNames();

      ostr.println("using System;");
      ostr.println("");
View Full Code Here

Examples of org.javacc.parser.OutputFile

    String className = defaultVisitorClass();
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), className + ".cs");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();

      List nodeNames = ASTNodeDescriptor.getNodeNames();

      ostr.println("using System;");
     
View Full Code Here

Examples of org.javacc.parser.OutputFile

  static void generateTreeState_java()
  {
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), nameState() + ".java");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();
      NodeFiles.generatePrologue(ostr);
      insertState(ostr);
      outputFile.close();
    } catch (IOException e) {
      throw new Error(e.toString());
    }
  }
View Full Code Here

Examples of org.javacc.parser.OutputFile

  static void generateTreeState_cs()
  {
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), nameState() + ".cs");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();
      CSNodeFiles.generatePrologue(ostr);
      insertStateCS(ostr);
      outputFile.close();
    } catch (IOException e) {
      throw new Error(e.toString());
    }
  }
View Full Code Here

Examples of org.javacc.parser.OutputFile

  static void generateTreeState_cs()
  {
    File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), nameState() + ".cs");

    try {
      OutputFile outputFile = new OutputFile(file);
      PrintWriter ostr = outputFile.getPrintWriter();
      CSNodeFiles.generatePrologue(ostr);
      insertStateCS(ostr);
      outputFile.close();
    } catch (IOException e) {
      throw new Error(e.toString());
    }
  }
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.