eclipse plugin: Add a Xtend post processor to set...

...the grammar's default values. So, we'll have empty strings instead
of null, when there is no value set.  Also made the
plus/relative/point be strings instead booleans.
This commit is contained in:
Timotei Dolean 2011-07-15 21:05:20 +00:00
parent df0bc04176
commit b75beee2c6
17 changed files with 141 additions and 107 deletions

View file

@ -25,10 +25,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtend.shared.ui.xtendBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.xtend.shared.ui.xtendXPandNature</nature>
</natures>
</projectDescription>

View file

@ -8,7 +8,8 @@
eType="#//WMLRootExpression" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLTag" eSuperTypes="#//WMLRootExpression">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="plus" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="plus" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EReference" name="Expressions" upperBound="-1"
eType="#//WMLExpression" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
@ -20,8 +21,10 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLKeyValue"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroCall" eSuperTypes="#//WMLKeyValue #//WMLRootExpression">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="point" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="relative" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="point" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="relative" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="params" unique="false"
upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="extraMacros" upperBound="-1"
@ -45,7 +48,8 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLRootExpression" eSuperTypes="#//WMLExpression"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLExpression" eSuperTypes="#//WMLValuedExpression">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLValuedExpression"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLTextdomain" eSuperTypes="#//WMLRootExpression"/>

View file

@ -23,7 +23,7 @@
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="["/>
<elements xsi:type="xtext:Assignment" cardinality="?" feature="plus" operator="?=">
<elements xsi:type="xtext:Assignment" cardinality="?" feature="plus" operator="=">
<terminal xsi:type="xtext:Keyword" value="+"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="name" operator="=">
@ -92,10 +92,10 @@
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="{"/>
<elements xsi:type="xtext:Assignment" cardinality="?" feature="point" operator="?=">
<elements xsi:type="xtext:Assignment" cardinality="?" feature="point" operator="=">
<terminal xsi:type="xtext:Keyword" value="./"/>
</elements>
<elements xsi:type="xtext:Assignment" cardinality="?" feature="relative" operator="?=">
<elements xsi:type="xtext:Assignment" cardinality="?" feature="relative" operator="=">
<terminal xsi:type="xtext:Keyword" value="~"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="name" operator="=">

View file

@ -109,11 +109,11 @@ protected class WMLRoot_ExpressionsAssignment extends AssignmentToken {
/************ begin Rule WMLTag ****************
*
* WMLTag:
* "[" plus?="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
* "[" plus="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
*
**/
// "[" plus?="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]"
// "[" plus="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]"
protected class WMLTag_Group extends GroupToken {
public WMLTag_Group(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -163,7 +163,7 @@ protected class WMLTag_LeftSquareBracketKeyword_0 extends KeywordToken {
}
// plus?="+"?
// plus="+"?
protected class WMLTag_PlusAssignment_1 extends AssignmentToken {
public WMLTag_PlusAssignment_1(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -187,7 +187,7 @@ protected class WMLTag_PlusAssignment_1 extends AssignmentToken {
public IEObjectConsumer tryConsume() {
if((value = eObjectConsumer.getConsumable("plus",false)) == null) return null;
IEObjectConsumer obj = eObjectConsumer.cloneAndConsume("plus");
if(Boolean.TRUE.equals(value)) { // org::eclipse::xtext::impl::KeywordImpl
if(keywordSerializer.isValid(obj.getEObject(), grammarAccess.getWMLTagAccess().getPlusPlusSignKeyword_1_0(), value, null)) {
type = AssignmentType.KEYWORD;
element = grammarAccess.getWMLTagAccess().getPlusPlusSignKeyword_1_0();
return obj;
@ -895,11 +895,11 @@ protected class WMLKeyValue_WMLArrayCallParserRuleCall_3 extends RuleCallToken {
/************ begin Rule WMLMacroCall ****************
*
* WMLMacroCall:
* "{" point?="./"? relative?="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
* "{" point="./"? relative="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
*
**/
// "{" point?="./"? relative?="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}"
// "{" point="./"? relative="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}"
protected class WMLMacroCall_Group extends GroupToken {
public WMLMacroCall_Group(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -949,7 +949,7 @@ protected class WMLMacroCall_LeftCurlyBracketKeyword_0 extends KeywordToken {
}
// point?="./"?
// point="./"?
protected class WMLMacroCall_PointAssignment_1 extends AssignmentToken {
public WMLMacroCall_PointAssignment_1(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -973,7 +973,7 @@ protected class WMLMacroCall_PointAssignment_1 extends AssignmentToken {
public IEObjectConsumer tryConsume() {
if((value = eObjectConsumer.getConsumable("point",false)) == null) return null;
IEObjectConsumer obj = eObjectConsumer.cloneAndConsume("point");
if(Boolean.TRUE.equals(value)) { // org::eclipse::xtext::impl::KeywordImpl
if(keywordSerializer.isValid(obj.getEObject(), grammarAccess.getWMLMacroCallAccess().getPointFullStopSolidusKeyword_1_0(), value, null)) {
type = AssignmentType.KEYWORD;
element = grammarAccess.getWMLMacroCallAccess().getPointFullStopSolidusKeyword_1_0();
return obj;
@ -983,7 +983,7 @@ protected class WMLMacroCall_PointAssignment_1 extends AssignmentToken {
}
// relative?="~"?
// relative="~"?
protected class WMLMacroCall_RelativeAssignment_2 extends AssignmentToken {
public WMLMacroCall_RelativeAssignment_2(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -1008,7 +1008,7 @@ protected class WMLMacroCall_RelativeAssignment_2 extends AssignmentToken {
public IEObjectConsumer tryConsume() {
if((value = eObjectConsumer.getConsumable("relative",false)) == null) return null;
IEObjectConsumer obj = eObjectConsumer.cloneAndConsume("relative");
if(Boolean.TRUE.equals(value)) { // org::eclipse::xtext::impl::KeywordImpl
if(keywordSerializer.isValid(obj.getEObject(), grammarAccess.getWMLMacroCallAccess().getRelativeTildeKeyword_2_0(), value, null)) {
type = AssignmentType.KEYWORD;
element = grammarAccess.getWMLMacroCallAccess().getRelativeTildeKeyword_2_0();
return obj;

View file

@ -154,7 +154,7 @@ ruleWMLTag returns [EObject current=null]
}
try {
set($current, "plus", true, "+", lastConsumedNode);
set($current, "plus", lv_plus_1_0, "+", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
@ -527,7 +527,7 @@ ruleWMLMacroCall returns [EObject current=null]
}
try {
set($current, "point", true, "./", lastConsumedNode);
set($current, "point", lv_point_1_0, "./", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
@ -548,7 +548,7 @@ ruleWMLMacroCall returns [EObject current=null]
}
try {
set($current, "relative", true, "~", lastConsumedNode);
set($current, "relative", lv_relative_2_0, "~", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}

View file

@ -288,7 +288,7 @@ public class InternalWMLParser extends AbstractInternalAntlrParser {
}
try {
set(current, "plus", true, "+", lastConsumedNode);
set(current, "plus", lv_plus_1_0, "+", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
@ -1152,7 +1152,7 @@ public class InternalWMLParser extends AbstractInternalAntlrParser {
}
try {
set(current, "point", true, "./", lastConsumedNode);
set(current, "point", lv_point_1_0, "./", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
@ -1192,7 +1192,7 @@ public class InternalWMLParser extends AbstractInternalAntlrParser {
}
try {
set(current, "relative", true, "~", lastConsumedNode);
set(current, "relative", lv_relative_2_0, "~", lastConsumedNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}

View file

@ -49,16 +49,16 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
private final Keyword cRightSquareBracketKeyword_7 = (Keyword)cGroup.eContents().get(7);
//WMLTag:
// "[" plus?="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
// "[" plus="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
public ParserRule getRule() { return rule; }
//"[" plus?="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]"
//"[" plus="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]"
public Group getGroup() { return cGroup; }
//"["
public Keyword getLeftSquareBracketKeyword_0() { return cLeftSquareBracketKeyword_0; }
//plus?="+"?
//plus="+"?
public Assignment getPlusAssignment_1() { return cPlusAssignment_1; }
//"+"
@ -218,22 +218,22 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
private final Keyword cRightCurlyBracketKeyword_5 = (Keyword)cGroup.eContents().get(5);
//WMLMacroCall:
// "{" point?="./"? relative?="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
// "{" point="./"? relative="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
public ParserRule getRule() { return rule; }
//"{" point?="./"? relative?="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}"
//"{" point="./"? relative="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}"
public Group getGroup() { return cGroup; }
//"{"
public Keyword getLeftCurlyBracketKeyword_0() { return cLeftCurlyBracketKeyword_0; }
//point?="./"?
//point="./"?
public Assignment getPointAssignment_1() { return cPointAssignment_1; }
//"./"
public Keyword getPointFullStopSolidusKeyword_1_0() { return cPointFullStopSolidusKeyword_1_0; }
//relative?="~"?
//relative="~"?
public Assignment getRelativeAssignment_2() { return cRelativeAssignment_2; }
//"~"
@ -672,7 +672,7 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
}
//WMLTag:
// "[" plus?="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
// "[" plus="+"? name=ID "]" Expressions+=WMLExpression* "[/" endName=ID "]";
public WMLTagElements getWMLTagAccess() {
return (pWMLTag != null) ? pWMLTag : (pWMLTag = new WMLTagElements());
}
@ -702,7 +702,7 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
}
//WMLMacroCall:
// "{" point?="./"? relative?="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
// "{" point="./"? relative="~"? name=ID (params+=WMLMacroParameter | extraMacros+=WMLMacroCall)* "}";
public WMLMacroCallElements getWMLMacroCallAccess() {
return (pWMLMacroCall != null) ? pWMLMacroCall : (pWMLMacroCall = new WMLMacroCallElements());
}

View file

@ -27,6 +27,7 @@ public interface WMLExpression extends WMLValuedExpression
{
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
@ -36,7 +37,7 @@ public interface WMLExpression extends WMLValuedExpression
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see org.wesnoth.wml.WmlPackage#getWMLExpression_Name()
* @model
* @model default=""
* @generated
*/
String getName();

View file

@ -16,8 +16,8 @@ import org.eclipse.emf.common.util.EList;
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.wesnoth.wml.WMLMacroCall#isPoint <em>Point</em>}</li>
* <li>{@link org.wesnoth.wml.WMLMacroCall#isRelative <em>Relative</em>}</li>
* <li>{@link org.wesnoth.wml.WMLMacroCall#getPoint <em>Point</em>}</li>
* <li>{@link org.wesnoth.wml.WMLMacroCall#getRelative <em>Relative</em>}</li>
* <li>{@link org.wesnoth.wml.WMLMacroCall#getParams <em>Params</em>}</li>
* <li>{@link org.wesnoth.wml.WMLMacroCall#getExtraMacros <em>Extra Macros</em>}</li>
* </ul>
@ -31,6 +31,7 @@ public interface WMLMacroCall extends WMLKeyValue, WMLRootExpression
{
/**
* Returns the value of the '<em><b>Point</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Point</em>' attribute isn't clear,
@ -38,25 +39,26 @@ public interface WMLMacroCall extends WMLKeyValue, WMLRootExpression
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Point</em>' attribute.
* @see #setPoint(boolean)
* @see #setPoint(String)
* @see org.wesnoth.wml.WmlPackage#getWMLMacroCall_Point()
* @model
* @model default=""
* @generated
*/
boolean isPoint();
String getPoint();
/**
* Sets the value of the '{@link org.wesnoth.wml.WMLMacroCall#isPoint <em>Point</em>}' attribute.
* Sets the value of the '{@link org.wesnoth.wml.WMLMacroCall#getPoint <em>Point</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Point</em>' attribute.
* @see #isPoint()
* @see #getPoint()
* @generated
*/
void setPoint(boolean value);
void setPoint(String value);
/**
* Returns the value of the '<em><b>Relative</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Relative</em>' attribute isn't clear,
@ -64,22 +66,22 @@ public interface WMLMacroCall extends WMLKeyValue, WMLRootExpression
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Relative</em>' attribute.
* @see #setRelative(boolean)
* @see #setRelative(String)
* @see org.wesnoth.wml.WmlPackage#getWMLMacroCall_Relative()
* @model
* @model default=""
* @generated
*/
boolean isRelative();
String getRelative();
/**
* Sets the value of the '{@link org.wesnoth.wml.WMLMacroCall#isRelative <em>Relative</em>}' attribute.
* Sets the value of the '{@link org.wesnoth.wml.WMLMacroCall#getRelative <em>Relative</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Relative</em>' attribute.
* @see #isRelative()
* @see #getRelative()
* @generated
*/
void setRelative(boolean value);
void setRelative(String value);
/**
* Returns the value of the '<em><b>Params</b></em>' attribute list.

View file

@ -16,7 +16,7 @@ import org.eclipse.emf.common.util.EList;
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.wesnoth.wml.WMLTag#isPlus <em>Plus</em>}</li>
* <li>{@link org.wesnoth.wml.WMLTag#getPlus <em>Plus</em>}</li>
* <li>{@link org.wesnoth.wml.WMLTag#getExpressions <em>Expressions</em>}</li>
* <li>{@link org.wesnoth.wml.WMLTag#getEndName <em>End Name</em>}</li>
* </ul>
@ -30,6 +30,7 @@ public interface WMLTag extends WMLRootExpression
{
/**
* Returns the value of the '<em><b>Plus</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Plus</em>' attribute isn't clear,
@ -37,22 +38,22 @@ public interface WMLTag extends WMLRootExpression
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Plus</em>' attribute.
* @see #setPlus(boolean)
* @see #setPlus(String)
* @see org.wesnoth.wml.WmlPackage#getWMLTag_Plus()
* @model
* @model default=""
* @generated
*/
boolean isPlus();
String getPlus();
/**
* Sets the value of the '{@link org.wesnoth.wml.WMLTag#isPlus <em>Plus</em>}' attribute.
* Sets the value of the '{@link org.wesnoth.wml.WMLTag#getPlus <em>Plus</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Plus</em>' attribute.
* @see #isPlus()
* @see #getPlus()
* @generated
*/
void setPlus(boolean value);
void setPlus(String value);
/**
* Returns the value of the '<em><b>Expressions</b></em>' containment reference list.

View file

@ -565,11 +565,11 @@ public interface WmlPackage extends EPackage
EClass getWMLTag();
/**
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLTag#isPlus <em>Plus</em>}'.
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLTag#getPlus <em>Plus</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Plus</em>'.
* @see org.wesnoth.wml.WMLTag#isPlus()
* @see org.wesnoth.wml.WMLTag#getPlus()
* @see #getWMLTag()
* @generated
*/
@ -650,22 +650,22 @@ public interface WmlPackage extends EPackage
EClass getWMLMacroCall();
/**
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLMacroCall#isPoint <em>Point</em>}'.
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLMacroCall#getPoint <em>Point</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Point</em>'.
* @see org.wesnoth.wml.WMLMacroCall#isPoint()
* @see org.wesnoth.wml.WMLMacroCall#getPoint()
* @see #getWMLMacroCall()
* @generated
*/
EAttribute getWMLMacroCall_Point();
/**
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLMacroCall#isRelative <em>Relative</em>}'.
* Returns the meta object for the attribute '{@link org.wesnoth.wml.WMLMacroCall#getRelative <em>Relative</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Relative</em>'.
* @see org.wesnoth.wml.WMLMacroCall#isRelative()
* @see org.wesnoth.wml.WMLMacroCall#getRelative()
* @see #getWMLMacroCall()
* @generated
*/

View file

@ -38,7 +38,7 @@ public class WMLExpressionImpl extends WMLValuedExpressionImpl implements WMLExp
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
protected static final String NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.

View file

@ -36,8 +36,8 @@ import org.wesnoth.wml.WmlPackage;
* The following features are implemented:
* <ul>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#getName <em>Name</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#isPoint <em>Point</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#isRelative <em>Relative</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#getPoint <em>Point</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#getRelative <em>Relative</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#getParams <em>Params</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLMacroCallImpl#getExtraMacros <em>Extra Macros</em>}</li>
* </ul>
@ -55,7 +55,7 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
protected static final String NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
@ -68,44 +68,44 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #isPoint() <em>Point</em>}' attribute.
* The default value of the '{@link #getPoint() <em>Point</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPoint()
* @see #getPoint()
* @generated
* @ordered
*/
protected static final boolean POINT_EDEFAULT = false;
protected static final String POINT_EDEFAULT = "";
/**
* The cached value of the '{@link #isPoint() <em>Point</em>}' attribute.
* The cached value of the '{@link #getPoint() <em>Point</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPoint()
* @see #getPoint()
* @generated
* @ordered
*/
protected boolean point = POINT_EDEFAULT;
protected String point = POINT_EDEFAULT;
/**
* The default value of the '{@link #isRelative() <em>Relative</em>}' attribute.
* The default value of the '{@link #getRelative() <em>Relative</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRelative()
* @see #getRelative()
* @generated
* @ordered
*/
protected static final boolean RELATIVE_EDEFAULT = false;
protected static final String RELATIVE_EDEFAULT = "";
/**
* The cached value of the '{@link #isRelative() <em>Relative</em>}' attribute.
* The cached value of the '{@link #getRelative() <em>Relative</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRelative()
* @see #getRelative()
* @generated
* @ordered
*/
protected boolean relative = RELATIVE_EDEFAULT;
protected String relative = RELATIVE_EDEFAULT;
/**
* The cached value of the '{@link #getParams() <em>Params</em>}' attribute list.
@ -176,7 +176,7 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
* <!-- end-user-doc -->
* @generated
*/
public boolean isPoint()
public String getPoint()
{
return point;
}
@ -186,9 +186,9 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
* <!-- end-user-doc -->
* @generated
*/
public void setPoint(boolean newPoint)
public void setPoint(String newPoint)
{
boolean oldPoint = point;
String oldPoint = point;
point = newPoint;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WmlPackage.WML_MACRO_CALL__POINT, oldPoint, point));
@ -199,7 +199,7 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
* <!-- end-user-doc -->
* @generated
*/
public boolean isRelative()
public String getRelative()
{
return relative;
}
@ -209,9 +209,9 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
* <!-- end-user-doc -->
* @generated
*/
public void setRelative(boolean newRelative)
public void setRelative(String newRelative)
{
boolean oldRelative = relative;
String oldRelative = relative;
relative = newRelative;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WmlPackage.WML_MACRO_CALL__RELATIVE, oldRelative, relative));
@ -274,9 +274,9 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
case WmlPackage.WML_MACRO_CALL__NAME:
return getName();
case WmlPackage.WML_MACRO_CALL__POINT:
return isPoint();
return getPoint();
case WmlPackage.WML_MACRO_CALL__RELATIVE:
return isRelative();
return getRelative();
case WmlPackage.WML_MACRO_CALL__PARAMS:
return getParams();
case WmlPackage.WML_MACRO_CALL__EXTRA_MACROS:
@ -300,10 +300,10 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
setName((String)newValue);
return;
case WmlPackage.WML_MACRO_CALL__POINT:
setPoint((Boolean)newValue);
setPoint((String)newValue);
return;
case WmlPackage.WML_MACRO_CALL__RELATIVE:
setRelative((Boolean)newValue);
setRelative((String)newValue);
return;
case WmlPackage.WML_MACRO_CALL__PARAMS:
getParams().clear();
@ -359,9 +359,9 @@ public class WMLMacroCallImpl extends WMLKeyValueImpl implements WMLMacroCall
case WmlPackage.WML_MACRO_CALL__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case WmlPackage.WML_MACRO_CALL__POINT:
return point != POINT_EDEFAULT;
return POINT_EDEFAULT == null ? point != null : !POINT_EDEFAULT.equals(point);
case WmlPackage.WML_MACRO_CALL__RELATIVE:
return relative != RELATIVE_EDEFAULT;
return RELATIVE_EDEFAULT == null ? relative != null : !RELATIVE_EDEFAULT.equals(relative);
case WmlPackage.WML_MACRO_CALL__PARAMS:
return params != null && !params.isEmpty();
case WmlPackage.WML_MACRO_CALL__EXTRA_MACROS:

View file

@ -32,7 +32,7 @@ import org.wesnoth.wml.WmlPackage;
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.wesnoth.wml.impl.WMLTagImpl#isPlus <em>Plus</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLTagImpl#getPlus <em>Plus</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLTagImpl#getExpressions <em>Expressions</em>}</li>
* <li>{@link org.wesnoth.wml.impl.WMLTagImpl#getEndName <em>End Name</em>}</li>
* </ul>
@ -43,24 +43,24 @@ import org.wesnoth.wml.WmlPackage;
public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
{
/**
* The default value of the '{@link #isPlus() <em>Plus</em>}' attribute.
* The default value of the '{@link #getPlus() <em>Plus</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPlus()
* @see #getPlus()
* @generated
* @ordered
*/
protected static final boolean PLUS_EDEFAULT = false;
protected static final String PLUS_EDEFAULT = "";
/**
* The cached value of the '{@link #isPlus() <em>Plus</em>}' attribute.
* The cached value of the '{@link #getPlus() <em>Plus</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPlus()
* @see #getPlus()
* @generated
* @ordered
*/
protected boolean plus = PLUS_EDEFAULT;
protected String plus = PLUS_EDEFAULT;
/**
* The cached value of the '{@link #getExpressions() <em>Expressions</em>}' containment reference list.
@ -118,7 +118,7 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
* <!-- end-user-doc -->
* @generated
*/
public boolean isPlus()
public String getPlus()
{
return plus;
}
@ -128,9 +128,9 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
* <!-- end-user-doc -->
* @generated
*/
public void setPlus(boolean newPlus)
public void setPlus(String newPlus)
{
boolean oldPlus = plus;
String oldPlus = plus;
plus = newPlus;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WmlPackage.WML_TAG__PLUS, oldPlus, plus));
@ -200,7 +200,7 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
switch (featureID)
{
case WmlPackage.WML_TAG__PLUS:
return isPlus();
return getPlus();
case WmlPackage.WML_TAG__EXPRESSIONS:
return getExpressions();
case WmlPackage.WML_TAG__END_NAME:
@ -221,7 +221,7 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
switch (featureID)
{
case WmlPackage.WML_TAG__PLUS:
setPlus((Boolean)newValue);
setPlus((String)newValue);
return;
case WmlPackage.WML_TAG__EXPRESSIONS:
getExpressions().clear();
@ -268,7 +268,7 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
switch (featureID)
{
case WmlPackage.WML_TAG__PLUS:
return plus != PLUS_EDEFAULT;
return PLUS_EDEFAULT == null ? plus != null : !PLUS_EDEFAULT.equals(plus);
case WmlPackage.WML_TAG__EXPRESSIONS:
return expressions != null && !expressions.isEmpty();
case WmlPackage.WML_TAG__END_NAME:

View file

@ -622,7 +622,7 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEReference(getWMLRoot_Expressions(), this.getWMLRootExpression(), null, "Expressions", null, 0, -1, WMLRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlTagEClass, WMLTag.class, "WMLTag", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLTag_Plus(), ecorePackage.getEBoolean(), "plus", null, 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag_Plus(), ecorePackage.getEString(), "plus", "", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLTag_Expressions(), this.getWMLExpression(), null, "Expressions", null, 0, -1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag_EndName(), ecorePackage.getEString(), "endName", null, 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@ -633,8 +633,8 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEClass(wmlKeyValueEClass, WMLKeyValue.class, "WMLKeyValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(wmlMacroCallEClass, WMLMacroCall.class, "WMLMacroCall", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLMacroCall_Point(), ecorePackage.getEBoolean(), "point", null, 0, 1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroCall_Relative(), ecorePackage.getEBoolean(), "relative", null, 0, 1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroCall_Point(), ecorePackage.getEString(), "point", "", 0, 1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroCall_Relative(), ecorePackage.getEString(), "relative", "", 0, 1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroCall_Params(), ecorePackage.getEString(), "params", null, 0, -1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLMacroCall_ExtraMacros(), this.getWMLMacroCall(), null, "extraMacros", null, 0, -1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@ -653,7 +653,7 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEClass(wmlRootExpressionEClass, WMLRootExpression.class, "WMLRootExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(wmlExpressionEClass, WMLExpression.class, "WMLExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLExpression_Name(), ecorePackage.getEString(), "name", null, 0, 1, WMLExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLExpression_Name(), ecorePackage.getEString(), "name", "", 0, 1, WMLExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlValuedExpressionEClass, WMLValuedExpression.class, "WMLValuedExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

View file

@ -11,7 +11,7 @@ WMLRoot:
( Expressions += WMLRootExpression )*;
WMLTag:
'[' (plus?='+')? name=ID ']'
'[' (plus='+')? name=ID ']'
( Expressions += WMLExpression )*
'[/' endName = ID ']'
;
@ -23,7 +23,7 @@ WMLKeyValue:
{WMLKeyValue} WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall;
WMLMacroCall:
'{' (point?='./')? (relative?='~')? name=ID
'{' (point='./')? (relative='~')? name=ID
( params += WMLMacroParameter
| extraMacros += WMLMacroCall
)*

View file

@ -0,0 +1,20 @@
process( xtext::GeneratedMetamodel this ):
process( ePackage );
process( ecore::EPackage this ):
eClassifiers.process();
process( ecore::EClassifier this ):
null;
process( ecore::EClass this ):
eStructuralFeatures.process();
process( ecore::EStructuralFeature this ):
null;
process( ecore::EAttribute this ):
if name == 'plus' then setDefaultValueLiteral( "" )
else if name == 'point' then setDefaultValueLiteral( "" )
else if name == 'relative' then setDefaultValueLiteral( "" )
else if name == 'name' then setDefaultValueLiteral( "" );