Package de.hunsicker.jalopy.language.antlr

Examples of de.hunsicker.jalopy.language.antlr.JavaNode


        // create formatter context for this file
        BeautifierContext formatterContext = new BeautifierContext();

        // use formatter context to traverse the abstract syntax tree
        JavaNode node = createJavaNode(sequence, file);
        traverseAst(node, formatterContext, 0);

        Set<TypeContext> sequences = formatterContext.getSequences();

        // dump all detected sequences to system out in DEBUG mode
View Full Code Here


        if (LOG.isDebugEnabled()) {
            LOG.debug("TRAVERSING: " + ast.getType());
        }

        // traverse all children
        JavaNode child = (JavaNode) ast.getFirstChild();
        if (child != null) {
            traverseAst(child, context, depth + 1);
        }

        context.postProcess(ast);


        // print if a type was detected
        if (ast.getType() == IDENT) {
            context.addToCurrentTypeContext(ast);
            if (LOG.isDebugEnabled()) {
                LOG.debug(preparePrintln(depth)+context.getCurrentTypeContext());
            }
        }

        // continue visiting the tree (traverse siblings)
        JavaNode next = (JavaNode) ast.getNextSibling();
        while (next != null) {
            traverseAst(next, context, depth);
            next = (JavaNode) next.getNextSibling();
        }

        return -1;
    }
View Full Code Here

  protected JavaNode createJavaNode(
      org.hybridlabs.source.beautifier.CharacterSequence sequence,
      File file) {
    initialize();

    JavaNode node = null;
    Jalopy jalopy = initializeJalopy();
    final PrintStream out = System.out;
    try {
      // redirecting System.out to log4j appender
      System.setOut(outToLog4J(out));
View Full Code Here

        // create formatter context for this file
        BeautifierContext formatterContext = new BeautifierContext();

        // use formatter context to traverse the abstract syntax tree
        JavaNode node = createJavaNode(sequence, file);
        traverseAst(node, formatterContext, 0);
       
        Set sequences = formatterContext.getSequences();
       
        // dump all detected sequences to system out in DEBUG mode
View Full Code Here

        if (DEBUG) {
            System.out.println("TRAVERSING: " + ast.getType());
        }
       
        // traverse all children
        JavaNode child = (JavaNode) ast.getFirstChild();
        if (child != null) {
            traverseAst(child, context, depth + 1);
        }

        // print if a type was detected
        if (ast.getType() == 79) {
            context.addToCurrentTypeContext(ast);
            if (DEBUG) {
                preparePrintln(depth);
                System.out.println(context.getCurrentTypeContext());
            }
        }
       
        // continue visiting the tree (traverse siblings)
        JavaNode next = (JavaNode) ast.getNextSibling();
        while (next != null) {
            traverseAst(next, context, depth);
            next = (JavaNode) next.getNextSibling();
        }

        context.postProcess(ast);
        return -1;
    }
View Full Code Here

        initialize();

        Jalopy jalopy = initializeJalopy();
        jalopy.setInput(sequence.getString(), file.getAbsolutePath());
       
        JavaNode node = jalopy.parse();

        return node;
    }
View Full Code Here

TOP

Related Classes of de.hunsicker.jalopy.language.antlr.JavaNode

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.