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

tests.java.org.python.antlr.PythonPartialTester Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
package org.python.antlr;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.Token;

/**
 * A walker producing a PythonTree AST.
 */
public class PythonPartialTester {

	public void parse(String[] args) throws Exception {
        try {
            PythonTree result = null;
            CharStream input = new ANTLRFileStream(args[0]);
            PythonPartialLexer lexer = new PythonPartialLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            PythonTokenSource indentedSource = new PythonTokenSource(tokens, "");
            tokens = new CommonTokenStream(indentedSource);
            PythonPartialParser parser = new PythonPartialParser(tokens);
            parser.single_input();
            System.out.println("SUCCEED");
        } catch (ParseException e) {
            System.out.println("FAIL:" + e);
        }
	}

	public static void main(String[] args) throws Exception {
		PythonPartialTester p = new PythonPartialTester();
		p.parse(args);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy