All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfml.parsing.cfml.antlr.MainTree Maven / Gradle / Ivy

There is a newer version: 2.11.0
Show newest version
package cfml.parsing.cfml.antlr;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.antlr.runtime.tree.Tree;

public class MainTree {
	public static void main(String[] args) {
		try {
			CharStream input = new ANTLRFileStream("./src/cfml/parsing/cfml/antlr/input3");
			XMLLexer lex = new XMLLexer(input);
			
			CommonTokenStream tokens = new CommonTokenStream(lex);
			XMLParser parser = new XMLParser(tokens);
			XMLParser.compilationUnit_return root = parser.compilationUnit();
			System.out.println("tree=" + ((Tree) root.tree).toStringTree());
			
			CommonTreeNodeStream nodes = new CommonTreeNodeStream(root.tree);
			XMLTree walker = new XMLTree(nodes);
			walker.document();
		} catch (Throwable t) {
			System.out.println("exception: " + t);
			t.printStackTrace();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy