Package org.allspice.javacompiler

Examples of org.allspice.javacompiler.JavaTokenizer$Machine


   */
  public static void javac() throws Exception {
    // Get the compiler
    Compiler compiler = JavaCompilerCompiler.loadJavaCompiler();
    // Parse the file
    FileUnit fu = compiler.parse(new JavaTokenizer(new StringReader(source))) ;

    // Create a class with the parsed HelloWorld.
    ClassConverter.writeClassFiles(StdJavaExpressions.INSTANCE,new File(System.getProperty("java.io.tmpdir")),new FIFO<FileUnit>(fu)) ;
  }
View Full Code Here


   */
  public static Object javac(String line) throws Exception {
    // Get the compiler
    Compiler compiler = JavaCompilerCompiler.loadJavaCompiler();
    // Parse the file
    FileUnit fu = compiler.parse(new JavaTokenizer(new StringReader(String.format(source,line)))) ;

    // Create a class loader with the parsed ExprEval.
    ClassLoader loader = ClassConverter.createLoader(StdJavaExpressions.INSTANCE,new FIFO<FileUnit>(fu)) ;
    // invoke expr.
    Method m = loader.loadClass("ExprEval").getMethod("expr") ;
View Full Code Here

      is.close() ;
    }
  }
 
  public static <T> Class<T> makeClass(URL url,Reader classdecl,String className) throws Exception {
    FileUnit fu = compiler.parse(new JavaTokenizer(classdecl)) ;
    fu = fu.setFileName(url.getFile()) ;
    ClassLoader loader = ClassConverter.createLoader(StdJavaExpressions.INSTANCE,new FIFO<FileUnit>(fu)) ;
    return (Class<T>)loader.loadClass(className) ;
  }
View Full Code Here

import org.allspice.parser.parsetable.Token;
import org.allspice.parser.parsetable.TokenStream;

public class TestJavaTokenizer extends TestCase {
  public TokenStream makeTokenizer(String s) {
    return new JavaTokenizer(new StringReader(s)) ;
  }
View Full Code Here

TOP

Related Classes of org.allspice.javacompiler.JavaTokenizer$Machine

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.