Package specwalker

Examples of specwalker.ASTSpecWalker


       
        if(bean.getHelp())
            usage(clp);
        FileSystem fSystem = FileSystems.getDefault();
        boolean specParsed = false;
        ASTSpecWalker walker = new ASTSpecWalker();
        if(bean.printSchema()){
            String inputFile = bean.getSpecInputFile();
           
            try {
                if(clangAST.Driver.parseSpecFile(inputFile) != 0)
                        System.exit(1);
            } catch (IOException ex) {
                System.err.println(ex.getMessage());
                System.exit(1);
            }
           
            String outputFile = table.getClangSpecName() + ".logic";
            Path outputPath = fSystem.getPath(outputFile);
           
            try (BufferedWriter writer = Files.newBufferedWriter(outputPath, StandardCharsets.UTF_8);){
               
                walker.walk(new PrintLogicQLSchema(writer));
                specParsed = true;
            }
            catch(IOException ex){
                System.err.println(ex.getMessage());
                System.exit(1);
            }
        }
       
        if(bean.createPlugin()){
            try {
                if(!specParsed){
                    if(clangAST.Driver.parseSpecAndAuxFile(bean.getSpecInputFile(), bean.getAuxInputFile()) != 0)
                        System.exit(1);
                }
                else {
                    if(clangAST.Driver.parseAuxFile(bean.getAuxInputFile()) != 0)
                        System.exit(1);
                }
               
                String outputFilename = table.getClangSpecName() + ".h";
                Path outputFile = fSystem.getPath(outputFilename);
               
                try(BufferedWriter writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8);){
                    walker.walk(new PrintClangCsvPlugin(writer));
                }

            } catch (IOException ex) {
                System.err.println(ex.getMessage());
                System.exit(1);
            }
        }
       
        if(bean.genImportCode()){
            try{
                if(!specParsed){
                    if(clangAST.Driver.parseSpecFile(bean.getSpecInputFile()) != 0)
                        System.exit(1);
                }
               
                String outputFilename = table.getClangSpecName() + "-import.logic";
                Path outputFile = fSystem.getPath(outputFilename);
               
                try(BufferedWriter writer = Files.newBufferedWriter(outputFile, StandardCharsets.UTF_8);){
                    Path csvOutDir = bean.getCsvOutDir();
                    if(Files.exists(csvOutDir)){
                        if(!Files.isDirectory(csvOutDir)){
                            System.err.println(csvOutDir.toString() + "is not a directory");
                            System.exit(1);
                        }
                    }
                    else{
                        Files.createDirectories(csvOutDir);
                    }
                    walker.walk(new PrintLogicQLImportCode(writer, csvOutDir, bean.getDelim()));
                }
            }
            catch (IOException ex){
                System.err.println(ex.getMessage());
                System.exit(1);
View Full Code Here

TOP

Related Classes of specwalker.ASTSpecWalker

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.