Package org.codehaus.groovy.control

Examples of org.codehaus.groovy.control.SourceUnit.convert()


                                  List availDecls ) throws Exception
    {
        SourceUnit unit = SourceUnit.create( "groovy.script", text );       
        unit.parse( );
        unit.nextPhase();
        unit.convert( );
        ModuleNode module = unit.getAST( );

        ClassNode classNode = ( ClassNode ) module.getClasses( ).get( 0 );
        List methods = classNode.getDeclaredMethods( "run" );
        MethodNode method = ( MethodNode ) methods.get( 0 );
View Full Code Here


public abstract class TestParserSupport extends GroovyTestCase {

    public ModuleNode parse(String text, String description) throws Exception {
        SourceUnit unit = SourceUnit.create(description, text);
        unit.parse();
        unit.convert();

        return unit.getAST();
    }
}
View Full Code Here

public abstract class TestParserSupport extends GroovyTestCase {

    public ModuleNode parse(String text, String description) throws Exception {
        SourceUnit unit = SourceUnit.create(description, text);
        unit.parse();
        unit.convert();

        return unit.getAST();
    }
}
View Full Code Here

   private BlockStatement parseSource(String source)
   {
      SourceUnit sourceUnit = SourceUnit.create("script", source);
      sourceUnit.parse();
      sourceUnit.nextPhase();
      sourceUnit.convert();
      ModuleNode moduleNode = sourceUnit.getAST();
      return moduleNode.getStatementBlock();
   }

   /**
 
View Full Code Here

public abstract class TestParserSupport extends GroovyTestCase {

    public ModuleNode parse(String text, String description) throws Exception {
        SourceUnit unit = SourceUnit.create(description, text);
        unit.parse();
        unit.convert();

        return unit.getAST();
    }
}
View Full Code Here

  public ExpressionInfo build() {
    SourceUnit unit = SourceUnit.create("Spec expression", adjustedText);
    unit.parse();
    unit.completePhase();
    unit.convert();

    BlockStatement blockStat = unit.getAST().getStatementBlock();
    Assert.that(blockStat != null && blockStat.getStatements().size() == 1);
    Statement stat = blockStat.getStatements().get(0);
    Assert.that(stat instanceof ExpressionStatement);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.