ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1351147 - in /ant/sandbox/antdsl: org.apache.ant.antdsl/src/org/apache/ant/antdsl/ org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/ test/
Date Sun, 17 Jun 2012 20:08:46 GMT
Author: hibou
Date: Sun Jun 17 20:08:46 2012
New Revision: 1351147

URL: http://svn.apache.org/viewvc?rev=1351147&view=rev
Log:
Set better argument syntax for the macro

Modified:
    ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSL.g
    ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
    ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
    ant/sandbox/antdsl/test/build.ant

Modified: ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSL.g
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSL.g?rev=1351147&r1=1351146&r2=1351147&view=diff
==============================================================================
--- ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSL.g (original)
+++ ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/AntDSL.g Sun Jun 17
20:08:46 2012
@@ -169,24 +169,25 @@ attributes returns [List atts = new Arra
     (',' att=attribute { atts.add(att); } )*;
 
 attribute returns [Object att]:
-      satt=simpleAttribute { att = satt; }
+      aatt=argAttribute { att = aatt; }
     | tatt=textAttribute { att = tatt; }
     | eatt=elementAttribute  { att = eatt; };
 
-simpleAttribute returns [Attribute att = new Attribute()]:
+argAttribute returns [Attribute att = new Attribute()]:
+    'arg'
     NAME { att.setName($NAME.text); }
     ('=' STRING { att.setDefault($STRING.text); } )?;
 
 textAttribute returns [Text text = new Text()]:
-    'text'
     ('optional' { text.setOptional(true); } )?
     ('trimmed' { text.setTrim(true); } )?
+    'text'
     NAME { text.setName($NAME.text); };
 
 elementAttribute returns [TemplateElement element = new TemplateElement()]:
-    'element'
     ('optional' { element.setOptional(true); } )?
     ('implicit' { element.setImplicit(true); } )?
+    'element'
     NAME { element.setName($NAME.text); };
 
 DOC:

Modified: ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext?rev=1351147&r1=1351146&r2=1351147&view=diff
==============================================================================
--- ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
(original)
+++ ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDSL.xtext
Sun Jun 17 20:08:46 2012
@@ -63,16 +63,16 @@ EAttributes:
     attributes+=EAttribute (',' attributes+=EAttribute)*;
 
 EAttribute:
-    ESimpleAttribute | ETextAttribute | EElementAttribute;
+    EArgAttribute | ETextAttribute | EElementAttribute;
 
-ESimpleAttribute:
-    name=NAME ('=' default=STRING)?;
+EArgAttribute:
+    'arg' name=NAME ('=' default=STRING)?;
 
 ETextAttribute:
-    'text' (optional ?= 'optional')? (trimmed ?= 'trimmed')? name=NAME;
+    (optional ?= 'optional')? (trimmed ?= 'trimmed')? 'text' name=NAME;
 
 EElementAttribute:
-    'element' (optional ?= 'optional')? (implicit ?= 'implicit')? name=NAME;
+    (optional ?= 'optional')? (implicit ?= 'implicit')? 'element' name=NAME;
 
 EExpression:
     STRING | PROPERTY;

Modified: ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java?rev=1351147&r1=1351146&r2=1351147&view=diff
==============================================================================
--- ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
(original)
+++ ant/sandbox/antdsl/org.apache.ant.antdsl/src/org/apache/ant/antdsl/xtext/AntDslXTextProjectHelper.java
Sun Jun 17 20:08:46 2012
@@ -11,6 +11,7 @@ import org.apache.ant.antdsl.AbstractAnt
 import org.apache.ant.antdsl.AntDslContext;
 import org.apache.ant.antdsl.IfTask;
 import org.apache.ant.antdsl.IfTask.ConditionnalSequential;
+import org.apache.ant.antdsl.xtext.antdsl.EArgAttribute;
 import org.apache.ant.antdsl.xtext.antdsl.EArgument;
 import org.apache.ant.antdsl.xtext.antdsl.EArguments;
 import org.apache.ant.antdsl.xtext.antdsl.EAttribute;
@@ -25,7 +26,6 @@ import org.apache.ant.antdsl.xtext.antds
 import org.apache.ant.antdsl.xtext.antdsl.ENamespace;
 import org.apache.ant.antdsl.xtext.antdsl.EProject;
 import org.apache.ant.antdsl.xtext.antdsl.EPropertyAssignment;
-import org.apache.ant.antdsl.xtext.antdsl.ESimpleAttribute;
 import org.apache.ant.antdsl.xtext.antdsl.ETarget;
 import org.apache.ant.antdsl.xtext.antdsl.ETargetList;
 import org.apache.ant.antdsl.xtext.antdsl.ETask;
@@ -121,11 +121,11 @@ public class AntDslXTextProjectHelper ex
         EAttributes eatts = emacro.getAttributes();
         if (eatts != null) {
             for (EAttribute eatt : eatts.getAttributes()) {
-                if (eatt instanceof ESimpleAttribute) {
-                    ESimpleAttribute esimpleatt = (ESimpleAttribute) eatt;
+                if (eatt instanceof EArgAttribute) {
+                    EArgAttribute eargatt = (EArgAttribute) eatt;
                     Attribute att = new Attribute();
-                    att.setName(esimpleatt.getName());
-                    att.setDefault(esimpleatt.getDefault());
+                    att.setName(eargatt.getName());
+                    att.setDefault(eargatt.getDefault());
                     macroDef.addConfiguredAttribute(att);
                 } else if (eatt instanceof ETextAttribute) {
                     ETextAttribute etextatt = (ETextAttribute) eatt;

Modified: ant/sandbox/antdsl/test/build.ant
URL: http://svn.apache.org/viewvc/ant/sandbox/antdsl/test/build.ant?rev=1351147&r1=1351146&r2=1351147&view=diff
==============================================================================
--- ant/sandbox/antdsl/test/build.ant (original)
+++ ant/sandbox/antdsl/test/build.ant Sun Jun 17 20:08:46 2012
@@ -6,11 +6,11 @@ default : build
 	echo(message="${foo}")
 }
 
-macrodef mymacro(t = "mymacro") {
+macrodef mymacro(arg t = "mymacro") {
 	echo(message = "@{t}")
 }
 
-macrodef mymacro2(dest, element implicit source) {
+macrodef mymacro2(arg dest, implicit element source) {
 	copy(todir = "@{dest}") {
 		source()
 	}



Mime
View raw message