Code Search for Developers
 
 
  

ConstructorsCategory.groovy from Groovy Eclipse Monkey at Krugle


Show ConstructorsCategory.groovy syntax highlighted

package chap1;

class ConstructorsCategory 
{
    static closures = 
    [ 
    	compound : { s1, s2 -> new CompoundStm( stm1:s1, stm2:s2 ) },
        assign : { id, exp -> new AssignStm( id:id, exp:exp ) },
        opExp : { left, op, right -> new OpExp( left:left, op:op, right:right ) },
        add : { left, right -> new OpExp( left:left, op:Ops.PLUS, right:right ) },
        sub : { left, right -> new OpExp( left:left, op:Ops.MINUS, right:right ) },
        times : { left, right -> new OpExp( left:left, op:Ops.TIMES, right:right ) },
        num : { num -> new NumExp( num:num ) },
        eseqExp : { stm, exp ->  new EseqExp( stm:stm, exp:exp ) },
        idExp: { id -> new IdExp( id:id ) },
        lastExpList: { head -> new LastExpList( head:head ) },
        pairExpList: { head, tail -> new PairExpList( head:head, tail: tail ) },
        printStm: { exps -> new PrintStm( exps:exps ) }
    ]
    static Object invokeMethod( final String name, final Object args )
    {
        if( !closures.containsKey( name ) )
            throw new MissingMethodException( name, this.getClass(), args )
        return closures.get( name ).call( args )
    }
}



See more files for this project here

Groovy Eclipse Monkey

Groovy Monkey is a Utility for Eclipse that enables you to create scripts in Groovy, Beanshell, Python or Ruby to run directly in Eclipse. This tool can be used to Eclipse API exploration, automation scripts, and rapid plugin prototyping.

Project homepage: http://sourceforge.net/projects/groovy-monkey
Programming language(s): Groovy,Java,XML
License: other

  AllTests.java
  AssignStm.groovy
  CompoundStm.groovy
  ConstructorsCategory.groovy
  EseqExp.groovy
  Exp.groovy
  ExpList.groovy
  IdExp.groovy
  IntAndTable.groovy
  LastExpList.groovy
  NumExp.groovy
  OpExp.groovy
  Ops.java
  PairExpList.groovy
  PrintStm.groovy
  Prog1.groovy
  Prog2.groovy
  Prog2Test.groovy
  Stm.groovy