Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This DSLD handles the @Delegate AST transform through a call to delegatesTo.

Code Block
import org.codehaus.groovy.ast.FieldNode

// fields is bound to a single FieldNode (if there is one delegate in the target type), 
// or a list of FieldNodes if there are multiple.
currentType(fields : findFieldfields(annotatedBy(Delegate))).accept {
	if (fields instanceof Collection) { 
		provider = "Delegate AST Transform"
	// fields is a collection of FieldNodes
	for (field in fields) {
			delegatesTo(field.declaringTypetype)
		}

	}
else if (fields instanceof FieldNode) {
		delegatesTo fields 
	} 
} 

Note that we could have used bind instead of currentType and had the same behavior.

Singleton

This shows how @Singleton is implemented. We need to explicitly use a bind pointcut here since we want to bind to the outermost pointcut.

Code Block
bind( type : currentType// Don't need to bind here since currentType is always available in a contribution block
currentType(annotatedBy(Singleton))).accept {
	method provider = "Singeton AST Transform"
	property name:"getInstanceinstance", type:typecurrentType, isStatic:true, declaringType:typecurrentType, doc:"Get the singleton instance of this Class"
	propertymethod name:"instancegetInstance", type:typecurrentType, isStatic:true, declaringType:typecurrentType, doc:"Get the singleton instance of this Class"
}

...

Code Block
import org.codehaus.groovy.ast.AnnotationNode
import org.codehaus.groovy.ast.expr.ClassExpression;
import org.codehaus.groovy.ast.expr.Expression;
import org.codehaus.groovy.ast.expr.ListExpression;

currentType(mixinmixins: findAnnotationannotatedBy(Mixin)).accept {
	//provider mixin= is"Mixin type AnnotationNode
	AST Transform"
	for (AnnotationNode mixin in mixins) {
		if (mixin instanceof AnnotationNode) {
			Expression expr = mixin.getMember("value")
			if (expr instanceof ClassExpression) {
				delegatesTo expr
			} else if (expr instanceof ListExpression) {
				for (Expression ex in expr?.expressions) {
					delegatesTo ex
				}
			}
		}
	}
}

SwingBuilder

Although this next example is quite long, it is fairly straight forward. We are just adding lots and lots and lots of methods to the SwingBuilder class. This script is only partially complete since we don't include documentation for all contributed methods. It might be possible to use BeanInfo to generate this script automatically.

Code Block
import groovy.model.DefaultTableColumn
import groovy.swing.SwingBuilder
import groovy.swing.impl.*
import javax.swing.*
import javax.swing.border.CompoundBorder;

import org.codehaus.groovy.binding.*
import java.awt.*

currentType(SwingBuilder).accept {
	provider = "SwingBuilder DSL"
	
	method name: "action", type: Action, useNamedArgs: true, params: [name: String, shortDescription: String, smallIcon: String, accelerator:String, closure: Closure], doc: 
	"""
	Actions are the lifeblood of a full fledged swing application. Other sources can expound on their usefullness.
	<br/> see <a href="http://groovy.codehaus.org/SwingBuilder.action">http://groovy.codehaus.org/SwingBuilder.action</a>
	"""
	method name: "frame", type: JFrame, useNamedArgs: true, params: [contentPane:Container, defaultCloseOperation:int, title:String, glassPane:Component, layeredPane:JLayeredPane, contentPane:Container],
	doc: """
	Generates a JFrame.
	<br/> see <a href="http://groovy.codehaus.org/SwingBuilder.frame">http://groovy.codehaus.org/SwingBuilder.frame</a>
	"""
	
	
	// and so on...
	method name: "actions", type: List, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "bean", useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "bind", type: FullBinding, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "borderLayout", type: BorderLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "boundedRangeModel", type: DefaultBoundedRangeModel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "box", type: Box, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "boxLayout", type: BoxLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "button", type: JButton, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "buttonGroup", type: ButtonGroup, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "cardLayout", type: CardLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "checkBox", type: JCheckBox, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "checkBoxMenuItem", type: JCheckBoxMenuItem, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "closureColumn", type: DefaultTableColumn, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "compoundBorder", type: CompoundBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "colorChooser", type: JColorChooser, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "comboBox", type: JComboBox, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "container", type: Container, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "desktopPane", type: JDesktopPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "dialog", type: JDialog, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "editorPane", type: JEditorPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "emptyBorder", type: border.EmptyBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "etchedBorder", type: border.EtchedBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "fileChooser", type: JFileChooser, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "flowLayout", type: FlowLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "formattedTextField", type: JFormattedTextField, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "gbc", type: GridBagConstraints, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "gridBagConstraints", type: GridBagConstraints, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "glue", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "gridBagConstraints", type: GridBagConstraints, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "gridBagLayout", type: GridBagLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "gridLayout", type: GridLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "hbox", type: Box, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "hglue", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "hstrut", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "internalFrame", type: JInternalFrame, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "label", type: JLabel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "layeredPane", type: JLayeredPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "list", type: JList, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "loweredBevelBorder", type: border.BevelBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "loweredEtchedBorder", type: border.EtchedBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "map", type: Map, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "matteBorder", type: border.MatteBorder, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "menu", type: JMenu, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "menuBar", type: JMenuBar, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "menuItem", type: JMenuItem, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "optionPane", type: JOptionPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "overlayLayout", type: OverlayLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "panel", type: JPanel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "passwordField", type: JPasswordField, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "popupMenum", type: JPopupMenu, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "progressBar", type: JProgressBar, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "propertyColumn", type: table.TableColumn, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "radioButton", type: JRadioButton, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "radioButtonMenuItem", type: JRadioButtonMenuItem, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "rigidArea", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "scrollBar", type: JScrollBar, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "scrollPane", type: JScrollPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "separator", type: JSeparator, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "slider", type: JSlider, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "spinner", type: JSpinner, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "spinnerDateModel", type: SpinnerDateModel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "spinnerListModel", type: SpinnerListModel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "spinnerNumberModel", type: SpinnerNumberModel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "splitPane", type: JSplitPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "springLayout", type: SpringLayout, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tabbedPane", type: JTabbedPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "table", type: JTable, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tableColumn", type: table.TableColumn, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tableLayout", type: TableLayoutRow, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tableModel", type: table.TableModel, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "td", type: TableLayoutCell, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "textArea", type: JTextArea, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "textField", type: JTextField, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "textPane", type: JTextPane, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "toggleButton", type: JToggleButton, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "toolbar", type: JToolBar, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tr", type: TableLayoutRow, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "tree", type: JTree, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "vbox", type: Box, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "vglue", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "viewport", type: JViewport, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "vstrut", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "widget", type: Component, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
	method name: "window", type: JWindow, useNamedArgs: true, doc: "See <a href=\"http://groovy.codehaus.org/Swing+Builder\">http://groovy.codehaus.org/Swing+Builder</a>"
}

...

Code Block
import org.codehaus.groovy.ast.ASTNode
import org.codehaus.groovy.ast.ClassNode
import org.codehaus.groovy.ast.expr.MapEntryExpression

/**
 * This is the meta DSL descriptor for *.dsld files.
 */

// first thing to do is to check that versions are correct
// for this script to be evaluated any further, all conditions must be met
// also supports grailsTooling and sts, which are synonyms and correspond to the STS version eg- 2.6.0
// we can add more version checking on request
supportsVersion(groovy:"1.7.8",groovyEclipse:"2.1.3")  

interface IPointcut {
	/**
	 * Accepts a contribution group to this Pointcut. What this means
	 * is that whenever this pointcut evaluates to a match, then the
	 * contribution group is evaluated with the bindings that have 
	 * been generated from the pointcut match
	 *   
	 * @param c the contribution group to accept
	 */
	def accept(Closure c);
} 


// You can store shared pointcuts in a variable 
// This particular pointcut matches all join points that are inside of a 
// groovy project and inside a file with a *.dsld extension and are scripts
def dsldFile = nature("org.eclipse.jdt.groovy.core.groovyNature") & fileExtension("dsld") & isScript()


// You can also create a closure around pointcuts and assign them to  
// a variable.  Note that when using these variables, you must include parens.
def insideContribution = { enclosingCallName("accept") & inClosure() }

// Ensure that the 'accept' method is available for all closures and variables that correspond to pointcuts
(dsldFile & ( ~ insideContribution() )  & ( ~currentType(subType(Script)) )).accept {
	delegatesTo IPointcut
}
 
// here we store all bound names inside of the wormhole so that they can be available later
(dsldFile & enclosingCallDeclaringType(subType(Script)) & (~ enclosingCallName("supportsVersion")) & 
    ( ~ inClosure() ) & bind(var : variableExpressioncurrentIdentifier())).accept {
	if (enclosingNode instanceof MapEntryExpression && 
			var.contains(((MapEntryExpression) enclosingNode).keyExpression == var)) {  
		def bindings = wormhole.bindings
		if (!bindings) {   
			bindings = [ ] 
			wormhole.bindings = bindings
		}   
		var.each { bindings << varit.text }
	}  
} 

// Define the kinds of pointcuts
// note the different ways of calling the two composite pointcuts
// Also, be careful to use parens around negation '~' since operator precedence may make the '~' apply to the call to 'accept' 
(dsldFile & ( ~ insideContribution() ) & currentType(subType(Script)) & (~enclosingCallName("registerPointcut")) & 
    currentTypeIsEnclosingType()).accept {
	provider = "the meta-DSLD script"
 
	// in here, we can list all pointcuts explicitly, or we can access the internal PointcutFactory object
	// A little bit naughty, but this is the easiest way to maintain consistency with all possible pointcuts
	// ...the PointcutFactory class is a secret class that is declared by groovy-eclipse
	// Yes, you can use many Eclipse classes here.  The editor won't like them, so they must be fully qualified
	// and you cannot import them or use them as types for variables 
	Map<String, String> pointcutNames = org.codehaus.groovy.eclipse.dsl.script.PointcutFactory.docRegistry
	for (pointcutName in pointcutNames.entrySet()) {
		method name : pointcutName.key, type: IPointcut, params : [pointcutArg : Object], doc : pointcutName.value
	}
	
	method name : "supportsVersion", type : void, params : [versionKindToName : Map.class ], 
	doc : 
	'''Specifies that this script is only active when the specified version constraints are met.  
	  Currently, only 3 constraints are available: groovy, groovyEclipse, sts, and grailsTooling.<br><br>
	  Use like this: 
	  <pre>supportsVersion(groovy:"1.7.10",groovyEclipse:"2.1.3")</pre>
	  This means that the current scipt requires <b>both</b> Groovy 1.7.10 or later and Groovy-Eclipse 2.1.3 or later'''
	
	method name : "registerPointcut", type : void, params : [name : String, pointcutBody : Closure], 
	doc : '''
	Registers a custom pointcut.  This pointcut is only available from within the current script.
	You must specify a name for the pointcut as well as a closure that evaluates whether or not there is a match'''
	
}

// Here, specify everything that can be used inside of an accept block (also called a Contribution Group)
(dsldFile & insideContribution()).accept { 
	provider = "the meta-DSLD script"
	property name : "provider", type : String, doc : """Specifies a <em>Provider</em> for the current contribution.  
	    This provider is displayed during content assist and in other places to give a quick hint as to where this 
	    contribution elementcomes from."""
	method name : "property", 
		   useNamedArgs : true, 
		   params : [name : String, 
			         type : Object, 
					 isStatic : boolean, 
					 declaringType : Object, 
					 provider: String, 
					 doc : String],
		  doc : """
		  Specifies a new property contribution.  <b>name</b> is mandatory, but all other parameters are optional.
		  """
		   
	method name : "method", 
	       useNamedArgs : true, 
		   params : [name : String, 
			         type : Object, 
					 params : Map, 
					 useNamedArgs : boolean, 
					 isStatic : boolean, 
					 declaringType : Object, 
					 provider: String, 
					 doc : String],
		  doc : """
		  Specifies a new method contribution.  <b>name</b> is mandatory, but all other parameters are optional.
		  """
		   
	method name : "delegatesTo", params : [ type : Object ], doc : """
			Specify that the currentType delegates tp the given type.  The currentType is the type being analyzed.  
			And the given type is specified as a parameter (either a String, Class, or ClassNode).  All fields and 
			methods of the given type will be available from the currentType.
			"""
	method name : "delegatesToUseNamedArgs", params : [ type : Object ], doc : """
			Specify that the currentType delegates tp the given type.  The currentType is the type being analyzed.  
			And the given type is specified as a parameter (either a String, Class, or ClassNode).  All fields and 
			methods of the given type will be available from the currentType.<br/><br/>
			Named arguments will be used for all methods.
			"""
	
	property name : "wormhole", type : Map, doc : """Use the wormhole to stuff in values calculated in one contribution group 
			to make it available later in another contribution group"""
	
	property name : "currentType", type : ClassNode, 
			doc : "This is the declaring type of the current expression being evaluated."
	property name : "currentNode", type : ASTNode, doc : "This is the ASTNode being evaluated"
	property name : "enclosingNode", type : ASTNode, doc : "This is the ASTNode enclosing the ASTNode being evaluated"
	
	// Now, extract all bindings from the wormhole and add them as contributions 
	for (binding in wormhole.bindings) {
		property name : binding, doc : "Binding created from pointcut"
	}
}

// Add the contributions for inside a "registerPointcut" call.  User-registered pointcuts are
// not fully fleshed out yet, so best not to use them yet.
(dsldFile & inClosure() & enclosingCallName("registerPointcut")).accept {
	property name : "currentScope", type : org.eclipse.jdt.groovy.search.VariableScope
	property name : "currenType", type : ClassNode
}