Package org.dmd.util.parsing

Examples of org.dmd.util.parsing.TokenArrayList


 
  public void run(){
        BufferedReader  in = new BufferedReader(new InputStreamReader(System.in));
        String          currLine    = null;
        Classifier    classifier   = new Classifier();
        TokenArrayList  tokens     = null;
//        MvcDoc      mvcdoc    = new MvcDoc();
       
       
        if (autogen.booleanValue()){
         
          for(ConfigVersion version: configFinder.getVersions().values()){
            ConfigLocation loc = version.getLatestVersion();
           
//                DebugInfo.debug(loc.toString());
           
            if (!loc.isFromJAR()){
              // Wasn't in a jar, so try to generate
//                  DebugInfo.debug("Config is not from JAR - generating: " + loc.getConfigName());
              generateFromConfig(version);
            }
           
            aggregateManager.mergeDefinitions(defManager);
          }
         
          System.out.println("DONE");
         
      try {
        if (docdir.length() > 0){
          if (workspace.length() > 0)
              docGenerator.dumpDocumentation(workspace.toString() + "/" + docdir.toString());
          else
            docGenerator.dumpDocumentation(docdir.toString());
        }
      } catch (IOException e) {
        System.err.println(e.toString());
        e.printStackTrace();
        System.exit(1);
      }

          System.exit(0);
        }
       
       
        System.out.println("\nmvw generator - enter the name of a Model View Whatever config\n");
        System.out.println("Enter ? for a list of configs...\n\n");
       
        while(true){
            try{
              String s = in.readLine();
              if (s == null)
                return;
             
                currLine = s.trim();

                if (currLine.length() == 0)
                    continue;
               
                tokens = classifier.classify(currLine, false);
               
                if (tokens.size() == 0)
                  continue;
               
                ConfigVersion currConfig = configFinder.getConfig(tokens.nth(0).getValue());

                if (tokens.nth(0).getValue().equals("?")){
                  System.out.println("");
                 
                  System.out.println(configFinder.getSearchInfo() + "\n");
                 
                  Iterator<ConfigVersion> it = configFinder.getVersions().values().iterator();
                  while(it.hasNext()){
                    ConfigVersion version = it.next();
                    ConfigLocation loc = version.getLatestVersion();
                   
                    if (loc.getJarFilename() == null){
                        System.out.println(format.sprintf(loc.getConfigName()) + "   version: " + loc.getVersion());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                    else{
                      System.out.println(format.sprintf("JAR " + loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                  }
                  System.out.println("");
                }
                else if (currConfig == null){
                  System.err.println("\n" + currLine + " is not a recoginized config name.\n\n");
                }
                else{
                  try {
            parser.parseConfig(currConfig.getLatestVersion());
           
//            codeGenerator.setDefinitionManager(defManager);
           
                    if (tokens.size() == 2){
                      // Might be a doc request
                      if (tokens.nth(1).getValue().equals("doc")){
//                        if (defManager.getTheApplication() == null){
//                          System.err.println("\n" + "The doc option is only valid for application definitions.\n\n");
//                        }
//                        else{
//                          mvcdoc.dumpAppDoc(currConfig.getLatestVersion(), defManager);
View Full Code Here


  }
 
  public void run() throws DmcValueExceptionSet, DmcRuleExceptionSet {
        BufferedReader  in = new BufferedReader(new InputStreamReader(System.in));
        String          currLine    = null;
        TokenArrayList  tokens    = null;
//        boolean      shared    = false;
       
        if (autogen.booleanValue()){
         
          for(ConfigVersion version: finder.getVersions().values()){
            ConfigLocation loc = version.getLatestVersion();
            if (!loc.isFromJAR()){
              // Wasn't in a jar, so try to generate
              generateFromConfig(loc);
            }
          }
         
      try {
        if (docdir.length() > 0){
          if (workspace.length() > 0)
              docGenerator.dumpDocumentation(workspace.toString() + "/" + docdir.toString());
          else
            docGenerator.dumpDocumentation(docdir.toString());
        }
      } catch (IOException e) {
        System.err.println(e.toString());
        e.printStackTrace();
        System.exit(1);
      }
         
          System.exit(0);
        }

        System.out.println("\n-- dmo generator utility --\n");
        System.out.println("Enter the name of a local (non-JAR) schema to generate its code\n");
        System.out.println("Enter ? for a list of schemas...\n\n");
        while(true){
            try{
              String s = in.readLine();
              if (s == null)
                return;
             
                currLine = s.trim();

              if (currLine.length() == 0)
                    continue;
               
              tokens = classifier.classify(currLine, false);

//                DmsSchemaLocation currLoc = finder.getLocation(tokens.nth(0).getValue());
//                DmsSchemaLocation currLoc = finder.getLocation(tokens.nth(0).getValue());
              ConfigVersion    config    = finder.getConfig(tokens.nth(0).getValue());
              ConfigLocation    currLoc  = null;
             
              if (config != null)
                currLoc = config.getLatestVersion();

                if (currLine.equals("?")){
                 
                  System.out.println("");
                 
                  System.out.println(finder.getSearchInfo() + "\n");
                 
                  Iterator<ConfigVersion> it = finder.getVersions().values().iterator();
                  while(it.hasNext()){
                    ConfigVersion version = it.next();
                    ConfigLocation loc = version.getLatestVersion();
                   
                    if (loc.getJarFilename() == null){
                        System.out.println(format.sprintf(loc.getConfigName()) + "   version: " + loc.getVersion());
//                      System.out.println(format.sprintf(loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                    else{
                      System.out.println(format.sprintf("JAR " + loc.getConfigName()) + " " + loc.getDirectory());
                      System.out.println(format.sprintf("") + " " + loc.getConfigParentDirectory() + "\n");
                    }
                  }
                  System.out.println("");
                }
                else if (currLoc == null){
                  System.err.println("\n" + currLine + " is not a recoginized schema name.\n\n");
                }
                else{
                  if (currLoc.isFromJAR()){
                    System.out.println("You can only generate code from schemas in your local environment.\n\n");
                    continue;
                  }
                 
                  try {
                    // Create a new manager into which the parsed schemas will be loaded
                    readSchemas = new SchemaManager();
                   
                    // Parse the specified schema
            SchemaDefinition sd = parser.parseSchema(readSchemas, tokens.nth(0).getValue(), false);
           
            // Generate the code
           
            FileUpdateManager.instance().reportProgress(System.out);
            FileUpdateManager.instance().reportErrors(System.err);
View Full Code Here

TOP

Related Classes of org.dmd.util.parsing.TokenArrayList

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.