Package net.percederberg.grammatica.output

Examples of net.percederberg.grammatica.output.VisualBasicParserGenerator


     *
     * @param args           the command-line arguments
     * @param grammar        the grammar to use
     */
    private static void writeVisualBasicCode(String[] args, Grammar grammar) {
        VisualBasicParserGenerator gen;

        // Read command-line arguments
        gen = new VisualBasicParserGenerator(grammar);
        for (int i = 1; i < args.length; i++) {
            if (args[i].equals("--vboutput")) {
                gen.setBaseDir(new File(args[++i]));
            } else if (args[i].equals("--vbnamespace")) {
                gen.setNamespace(args[++i]);
            } else if (args[i].equals("--vbclassname")) {
                gen.setBaseName(args[++i]);
            } else if (args[i].equals("--vbpublic")) {
                gen.setPublicAccess(true);
            } else {
                printHelp("unrecognized option: " + args[i]);
                System.exit(1);
            }
        }

        // Write parser source code
        try {
            System.out.println("Writing Visual Basic parser source code...");
            gen.write();
            System.out.println("Done.");
        } catch (IOException e) {
            printError(e);
            System.exit(1);
        }
View Full Code Here


     *
     * @throws RuntimeException if the grammar couldn't be processed
     *             correctly
     */
    public void process(Grammar grammar) throws RuntimeException {
        VisualBasicParserGenerator gen;

        gen = new VisualBasicParserGenerator(grammar);
        gen.setBaseDir(dir);
        if (namespace != null) {
            gen.setNamespace(namespace);
        }
        if (prefix != null) {
            gen.setBaseName(prefix);
        }
        gen.setPublicAccess(publicAccess);
        try {
            System.out.println("Writing Visual Basic parser source code...");
            gen.write();
            System.out.println("Done.");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

TOP

Related Classes of net.percederberg.grammatica.output.VisualBasicParserGenerator

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.