eclipse plugin: add support for WML arrays

This commit is contained in:
Timotei Dolean 2010-07-31 20:01:31 +00:00
parent 151e9fcfff
commit 6a07c31a63
32 changed files with 3531 additions and 1876 deletions

View file

@ -65,6 +65,9 @@ public class AbstractWMLProposalProvider extends AbstractJavaBasedContentProposa
public void completeWMLLuaCode_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
public void completeWMLArrayCall_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
public void completeWMLMacroDefine_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
}
@ -87,7 +90,7 @@ public class AbstractWMLProposalProvider extends AbstractJavaBasedContentProposa
public void complete_WMLKey(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_WMLKeyValueRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
public void complete_WMLKeyValue(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_WMLMacroCall(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
@ -96,6 +99,9 @@ public class AbstractWMLProposalProvider extends AbstractJavaBasedContentProposa
public void complete_WMLLuaCode(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_WMLArrayCall(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_WMLMacroDefine(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
@ -117,13 +123,13 @@ public class AbstractWMLProposalProvider extends AbstractJavaBasedContentProposa
public void complete_TEXTDOMAIN(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_SL_COMMENT(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
public void complete_STRING(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_ID(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_STRING(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
public void complete_EOL(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_WS(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
@ -132,4 +138,7 @@ public class AbstractWMLProposalProvider extends AbstractJavaBasedContentProposa
public void complete_ANY_OTHER(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
public void complete_SL_COMMENT(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// subclasses may override
}
}

View file

@ -39,10 +39,12 @@ public class WMLParser extends AbstractContentAssistParser {
{
put(grammarAccess.getWMLRootAccess().getAlternatives(), "rule__WMLRoot__Alternatives");
put(grammarAccess.getWMLTagAccess().getAlternatives_4(), "rule__WMLTag__Alternatives_4");
put(grammarAccess.getWMLKeyValueRuleAccess().getAlternatives(), "rule__WMLKeyValueRule__Alternatives");
put(grammarAccess.getWMLKeyAccess().getAlternatives_3(), "rule__WMLKey__Alternatives_3");
put(grammarAccess.getWMLKeyValueAccess().getAlternatives(), "rule__WMLKeyValue__Alternatives");
put(grammarAccess.getWMLValueAccess().getValueAlternatives_0(), "rule__WMLValue__ValueAlternatives_0");
put(grammarAccess.getWMLTagAccess().getGroup(), "rule__WMLTag__Group__0");
put(grammarAccess.getWMLKeyAccess().getGroup(), "rule__WMLKey__Group__0");
put(grammarAccess.getWMLArrayCallAccess().getGroup(), "rule__WMLArrayCall__Group__0");
put(grammarAccess.getWMLRootAccess().getTagsAssignment_0(), "rule__WMLRoot__TagsAssignment_0");
put(grammarAccess.getWMLRootAccess().getMacroCallsAssignment_1(), "rule__WMLRoot__MacroCallsAssignment_1");
put(grammarAccess.getWMLRootAccess().getMacroDefinesAssignment_2(), "rule__WMLRoot__MacroDefinesAssignment_2");
@ -59,6 +61,7 @@ public class WMLParser extends AbstractContentAssistParser {
put(grammarAccess.getWMLKeyAccess().getValueAssignment_2(), "rule__WMLKey__ValueAssignment_2");
put(grammarAccess.getWMLMacroCallAccess().getNameAssignment(), "rule__WMLMacroCall__NameAssignment");
put(grammarAccess.getWMLLuaCodeAccess().getValueAssignment(), "rule__WMLLuaCode__ValueAssignment");
put(grammarAccess.getWMLArrayCallAccess().getValueAssignment_1(), "rule__WMLArrayCall__ValueAssignment_1");
put(grammarAccess.getWMLMacroDefineAccess().getNameAssignment(), "rule__WMLMacroDefine__NameAssignment");
put(grammarAccess.getWMLTextdomainAccess().getNameAssignment(), "rule__WMLTextdomain__NameAssignment");
put(grammarAccess.getWMLValueAccess().getValueAssignment(), "rule__WMLValue__ValueAssignment");
@ -81,7 +84,7 @@ public class WMLParser extends AbstractContentAssistParser {
@Override
protected String[] getInitialHiddenTokens() {
return new String[] { "RULE_WS", "RULE_SL_COMMENT" };
return new String[] { "RULE_EOL", "RULE_WS", "RULE_SL_COMMENT" };
}
public WMLGrammarAccess getGrammarAccess() {

View file

@ -115,16 +115,23 @@ finally {
// Entry rule entryRuleWMLKey
entryRuleWMLKey
@init {
HiddenTokens myHiddenTokenState = ((XtextTokenStream)input).setHiddenTokens("RULE_WS");
}
:
{ before(grammarAccess.getWMLKeyRule()); }
ruleWMLKey
{ after(grammarAccess.getWMLKeyRule()); }
EOF
;
finally {
myHiddenTokenState.restore();
}
// Rule WMLKey
ruleWMLKey
@init {
HiddenTokens myHiddenTokenState = ((XtextTokenStream)input).setHiddenTokens("RULE_WS");
int stackSize = keepStackSize();
}
:
@ -137,29 +144,30 @@ ruleWMLKey
;
finally {
restoreStackSize(stackSize);
myHiddenTokenState.restore();
}
// Entry rule entryRuleWMLKeyValueRule
entryRuleWMLKeyValueRule
// Entry rule entryRuleWMLKeyValue
entryRuleWMLKeyValue
:
{ before(grammarAccess.getWMLKeyValueRuleRule()); }
ruleWMLKeyValueRule
{ after(grammarAccess.getWMLKeyValueRuleRule()); }
{ before(grammarAccess.getWMLKeyValueRule()); }
ruleWMLKeyValue
{ after(grammarAccess.getWMLKeyValueRule()); }
EOF
;
// Rule WMLKeyValueRule
ruleWMLKeyValueRule
// Rule WMLKeyValue
ruleWMLKeyValue
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLKeyValueRuleAccess().getAlternatives()); }
(rule__WMLKeyValueRule__Alternatives)
{ after(grammarAccess.getWMLKeyValueRuleAccess().getAlternatives()); }
{ before(grammarAccess.getWMLKeyValueAccess().getAlternatives()); }
(rule__WMLKeyValue__Alternatives)
{ after(grammarAccess.getWMLKeyValueAccess().getAlternatives()); }
)
;
@ -225,6 +233,34 @@ finally {
// Entry rule entryRuleWMLArrayCall
entryRuleWMLArrayCall
:
{ before(grammarAccess.getWMLArrayCallRule()); }
ruleWMLArrayCall
{ after(grammarAccess.getWMLArrayCallRule()); }
EOF
;
// Rule WMLArrayCall
ruleWMLArrayCall
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLArrayCallAccess().getGroup()); }
(rule__WMLArrayCall__Group__0)
{ after(grammarAccess.getWMLArrayCallAccess().getGroup()); }
)
;
finally {
restoreStackSize(stackSize);
}
// Entry rule entryRuleWMLMacroDefine
entryRuleWMLMacroDefine
:
@ -384,27 +420,55 @@ finally {
restoreStackSize(stackSize);
}
rule__WMLKeyValueRule__Alternatives
rule__WMLKey__Alternatives_3
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLKeyValueRuleAccess().getWMLValueParserRuleCall_0()); }
{ before(grammarAccess.getWMLKeyAccess().getEOLTerminalRuleCall_3_0()); }
RULE_EOL
{ after(grammarAccess.getWMLKeyAccess().getEOLTerminalRuleCall_3_0()); }
)
|(
{ before(grammarAccess.getWMLKeyAccess().getSL_COMMENTTerminalRuleCall_3_1()); }
RULE_SL_COMMENT
{ after(grammarAccess.getWMLKeyAccess().getSL_COMMENTTerminalRuleCall_3_1()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__WMLKeyValue__Alternatives
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLKeyValueAccess().getWMLValueParserRuleCall_0()); }
ruleWMLValue
{ after(grammarAccess.getWMLKeyValueRuleAccess().getWMLValueParserRuleCall_0()); }
{ after(grammarAccess.getWMLKeyValueAccess().getWMLValueParserRuleCall_0()); }
)
|(
{ before(grammarAccess.getWMLKeyValueRuleAccess().getWMLMacroCallParserRuleCall_1()); }
{ before(grammarAccess.getWMLKeyValueAccess().getWMLMacroCallParserRuleCall_1()); }
ruleWMLMacroCall
{ after(grammarAccess.getWMLKeyValueRuleAccess().getWMLMacroCallParserRuleCall_1()); }
{ after(grammarAccess.getWMLKeyValueAccess().getWMLMacroCallParserRuleCall_1()); }
)
|(
{ before(grammarAccess.getWMLKeyValueRuleAccess().getWMLLuaCodeParserRuleCall_2()); }
{ before(grammarAccess.getWMLKeyValueAccess().getWMLLuaCodeParserRuleCall_2()); }
ruleWMLLuaCode
{ after(grammarAccess.getWMLKeyValueRuleAccess().getWMLLuaCodeParserRuleCall_2()); }
{ after(grammarAccess.getWMLKeyValueAccess().getWMLLuaCodeParserRuleCall_2()); }
)
|(
{ before(grammarAccess.getWMLKeyValueAccess().getWMLArrayCallParserRuleCall_3()); }
ruleWMLArrayCall
{ after(grammarAccess.getWMLKeyValueAccess().getWMLArrayCallParserRuleCall_3()); }
)
;
@ -771,6 +835,7 @@ rule__WMLKey__Group__2
}
:
rule__WMLKey__Group__2__Impl
rule__WMLKey__Group__3
;
finally {
restoreStackSize(stackSize);
@ -800,6 +865,139 @@ finally {
}
rule__WMLKey__Group__3
@init {
int stackSize = keepStackSize();
}
:
rule__WMLKey__Group__3__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__WMLKey__Group__3__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLKeyAccess().getAlternatives_3()); }
(rule__WMLKey__Alternatives_3)
{ after(grammarAccess.getWMLKeyAccess().getAlternatives_3()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__0
@init {
int stackSize = keepStackSize();
}
:
rule__WMLArrayCall__Group__0__Impl
rule__WMLArrayCall__Group__1
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__0__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLArrayCallAccess().getLeftSquareBracketKeyword_0()); }
'['
{ after(grammarAccess.getWMLArrayCallAccess().getLeftSquareBracketKeyword_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__1
@init {
int stackSize = keepStackSize();
}
:
rule__WMLArrayCall__Group__1__Impl
rule__WMLArrayCall__Group__2
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__1__Impl
@init {
int stackSize = keepStackSize();
}
:
(
(
{ before(grammarAccess.getWMLArrayCallAccess().getValueAssignment_1()); }
(rule__WMLArrayCall__ValueAssignment_1)
{ after(grammarAccess.getWMLArrayCallAccess().getValueAssignment_1()); }
)
(
{ before(grammarAccess.getWMLArrayCallAccess().getValueAssignment_1()); }
(rule__WMLArrayCall__ValueAssignment_1)*
{ after(grammarAccess.getWMLArrayCallAccess().getValueAssignment_1()); }
)
)
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__2
@init {
int stackSize = keepStackSize();
}
:
rule__WMLArrayCall__Group__2__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__Group__2__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLArrayCallAccess().getRightSquareBracketKeyword_2()); }
']'
{ after(grammarAccess.getWMLArrayCallAccess().getRightSquareBracketKeyword_2()); }
)
;
finally {
restoreStackSize(stackSize);
}
@ -1016,8 +1214,8 @@ rule__WMLKey__ValueAssignment_2
}
:
(
{ before(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueRuleParserRuleCall_2_0()); }
ruleWMLKeyValueRule{ after(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueRuleParserRuleCall_2_0()); }
{ before(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueParserRuleCall_2_0()); }
ruleWMLKeyValue{ after(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueParserRuleCall_2_0()); }
)
;
@ -1055,6 +1253,21 @@ finally {
restoreStackSize(stackSize);
}
rule__WMLArrayCall__ValueAssignment_1
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getWMLArrayCallAccess().getValueWMLValueParserRuleCall_1_0()); }
ruleWMLValue{ after(grammarAccess.getWMLArrayCallAccess().getValueWMLValueParserRuleCall_1_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__WMLMacroDefine__NameAssignment
@init {
int stackSize = keepStackSize();
@ -1110,14 +1323,16 @@ RULE_DEFINE : '#define' ( options {greedy=false;} : . )*'#enddef';
RULE_TEXTDOMAIN : '#textdomain' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
RULE_EOL : ('\r'|'\n')+;
RULE_WS : (' '|'\t'|'\r'|'\n')+;
RULE_WS : (' '|'\t')+;
RULE_ANY_OTHER : .;
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;

View file

@ -1,14 +1,15 @@
RULE_LUA_CODE=8
RULE_ID=4
RULE_STRING=5
RULE_DEFINE=9
RULE_ANY_OTHER=6
RULE_TEXTDOMAIN=10
RULE_WS=12
RULE_SL_COMMENT=11
RULE_MACRO=7
'='=17
'[/'=16
'['=14
'+'=13
']'=15
RULE_LUA_CODE=10
RULE_ID=6
RULE_STRING=7
RULE_DEFINE=11
RULE_ANY_OTHER=8
RULE_EOL=4
RULE_TEXTDOMAIN=12
RULE_WS=13
RULE_SL_COMMENT=5
RULE_MACRO=9
'='=18
'[/'=17
'['=15
'+'=14
']'=16

View file

@ -7,37 +7,40 @@ package org.wesnoth.ui.contentassist.antlr.internal;
import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Lexer;
}
T13 : '+' ;
T14 : '[' ;
T15 : ']' ;
T16 : '[/' ;
T17 : '=' ;
T14 : '+' ;
T15 : '[' ;
T16 : ']' ;
T17 : '[/' ;
T18 : '=' ;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1105
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1318
RULE_LUA_CODE : '<<' ( options {greedy=false;} : . )*'>>';
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1107
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1320
RULE_MACRO : '{' ( options {greedy=false;} : . )*'}';
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1109
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1322
RULE_DEFINE : '#define' ( options {greedy=false;} : . )*'#enddef';
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1111
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1324
RULE_TEXTDOMAIN : '#textdomain' ~(('\n'|'\r'))* ('\r'? '\n')?;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1113
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1115
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1117
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1326
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1119
RULE_WS : (' '|'\t'|'\r'|'\n')+;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1328
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1121
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1330
RULE_EOL : ('\r'|'\n')+;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1332
RULE_WS : (' '|'\t')+;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1334
RULE_ANY_OTHER : .;
// $ANTLR src "../org.wesnoth.wml.ui/src-gen/org/wesnoth/ui/contentassist/antlr/internal/InternalWML.g" 1336
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;

View file

@ -31,22 +31,26 @@
<eClassifiers xsi:type="ecore:EClass" name="WMLKey">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="value" upperBound="-1"
eType="#//WMLKeyValueRule" containment="true"/>
eType="#//WMLKeyValue" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLKeyValueRule"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroCall" eSuperTypes="#//WMLKeyValueRule">
<eClassifiers xsi:type="ecore:EClass" name="WMLKeyValue"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroCall" eSuperTypes="#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLLuaCode" eSuperTypes="#//WMLKeyValueRule">
<eClassifiers xsi:type="ecore:EClass" name="WMLLuaCode" eSuperTypes="#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLArrayCall" eSuperTypes="#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EReference" name="value" upperBound="-1"
eType="#//WMLValue" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroDefine">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLTextdomain">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLValue" eSuperTypes="#//WMLKeyValueRule">
<eClassifiers xsi:type="ecore:EClass" name="WMLValue" eSuperTypes="#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>

View file

@ -28,13 +28,16 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute WML.ecore#//WMLKey/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference WML.ecore#//WMLKey/value"/>
</genClasses>
<genClasses ecoreClass="WML.ecore#//WMLKeyValueRule"/>
<genClasses ecoreClass="WML.ecore#//WMLKeyValue"/>
<genClasses ecoreClass="WML.ecore#//WMLMacroCall">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute WML.ecore#//WMLMacroCall/name"/>
</genClasses>
<genClasses ecoreClass="WML.ecore#//WMLLuaCode">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute WML.ecore#//WMLLuaCode/value"/>
</genClasses>
<genClasses ecoreClass="WML.ecore#//WMLArrayCall">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference WML.ecore#//WMLArrayCall/value"/>
</genClasses>
<genClasses ecoreClass="WML.ecore#//WMLMacroDefine">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute WML.ecore#//WMLMacroDefine/name"/>
</genClasses>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ASCII"?>
<xtext:Grammar xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:xtext="http://www.eclipse.org/2008/Xtext" name="org.wesnoth.WML" definesHiddenTokens="true" hiddenTokens="//@rules.16 //@rules.13">
<xtext:Grammar xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:xtext="http://www.eclipse.org/2008/Xtext" name="org.wesnoth.WML" definesHiddenTokens="true" hiddenTokens="//@rules.16 //@rules.17 //@rules.19">
<metamodelDeclarations xsi:type="xtext:GeneratedMetamodel" name="wML">
<ePackage href="http://www.wesnoth.org/WML#/"/>
</metamodelDeclarations>
@ -18,10 +18,10 @@
<terminal xsi:type="xtext:RuleCall" rule="//@rules.4"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="MacroDefines" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.6"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.7"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="Textdomains" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.7"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.8"/>
</elements>
</alternatives>
</rules>
@ -35,7 +35,7 @@
<terminal xsi:type="xtext:Keyword" value="+"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="name" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.14"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.15"/>
</elements>
<elements xsi:type="xtext:Keyword" value="]"/>
<elements xsi:type="xtext:Alternatives" cardinality="*">
@ -49,41 +49,46 @@
<terminal xsi:type="xtext:RuleCall" rule="//@rules.4"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="MacroDefines" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.6"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.7"/>
</elements>
<elements xsi:type="xtext:Assignment" feature="Textdomains" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.7"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.8"/>
</elements>
</elements>
<elements xsi:type="xtext:Keyword" value="[/"/>
<elements xsi:type="xtext:Assignment" feature="endName" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.14"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.15"/>
</elements>
<elements xsi:type="xtext:Keyword" value="]"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLKey">
<rules xsi:type="xtext:ParserRule" name="WMLKey" definesHiddenTokens="true" hiddenTokens="//@rules.17">
<type metamodel="//@metamodelDeclarations.0">
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLKey"/>
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Assignment" feature="name" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.14"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.15"/>
</elements>
<elements xsi:type="xtext:Keyword" value="="/>
<elements xsi:type="xtext:Assignment" cardinality="+" feature="value" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.3"/>
</elements>
<elements xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:RuleCall" rule="//@rules.16"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.19"/>
</elements>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLKeyValueRule">
<rules xsi:type="xtext:ParserRule" name="WMLKeyValue">
<type metamodel="//@metamodelDeclarations.0">
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLKeyValueRule"/>
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLKeyValue"/>
</type>
<alternatives xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:RuleCall" rule="//@rules.8"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.9"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.4"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.5"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.6"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLMacroCall">
@ -91,7 +96,7 @@
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLMacroCall"/>
</type>
<alternatives xsi:type="xtext:Assignment" feature="name" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.10"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.11"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLLuaCode">
@ -99,7 +104,19 @@
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLLuaCode"/>
</type>
<alternatives xsi:type="xtext:Assignment" feature="value" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.9"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.10"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLArrayCall">
<type metamodel="//@metamodelDeclarations.0">
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLArrayCall"/>
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="["/>
<elements xsi:type="xtext:Assignment" cardinality="+" feature="value" operator="+=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.9"/>
</elements>
<elements xsi:type="xtext:Keyword" value="]"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLMacroDefine">
@ -107,7 +124,7 @@
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLMacroDefine"/>
</type>
<alternatives xsi:type="xtext:Assignment" feature="name" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.11"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.12"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLTextdomain">
@ -115,7 +132,7 @@
<classifier xsi:type="ecore:EClass" href="http://www.wesnoth.org/WML#//WMLTextdomain"/>
</type>
<alternatives xsi:type="xtext:Assignment" feature="name" operator="=">
<terminal xsi:type="xtext:RuleCall" rule="//@rules.12"/>
<terminal xsi:type="xtext:RuleCall" rule="//@rules.13"/>
</alternatives>
</rules>
<rules xsi:type="xtext:ParserRule" name="WMLValue">
@ -124,9 +141,9 @@
</type>
<alternatives xsi:type="xtext:Assignment" feature="value" operator="=">
<terminal xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:RuleCall" rule="//@rules.14"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.15"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.17"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.14"/>
<elements xsi:type="xtext:RuleCall" rule="//@rules.18"/>
<elements xsi:type="xtext:Keyword" value="+"/>
</terminal>
</alternatives>
@ -182,45 +199,6 @@
</elements>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="SL_COMMENT">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="#"/>
<elements xsi:type="xtext:NegatedToken" cardinality="*">
<terminal xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
<elements xsi:type="xtext:Keyword" value="&#xD;"/>
</terminal>
</elements>
<elements xsi:type="xtext:Group" cardinality="?">
<elements xsi:type="xtext:Keyword" cardinality="?" value="&#xD;"/>
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
</elements>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="ID">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</type>
<alternatives xsi:type="xtext:Alternatives" cardinality="+">
<elements xsi:type="xtext:CharacterRange">
<left value="a"/>
<right value="z"/>
</elements>
<elements xsi:type="xtext:CharacterRange">
<left value="A"/>
<right value="Z"/>
</elements>
<elements xsi:type="xtext:CharacterRange">
<left value="0"/>
<right value="9"/>
</elements>
<elements xsi:type="xtext:Keyword" value="_"/>
<elements xsi:type="xtext:Keyword" value=","/>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="STRING">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
@ -251,6 +229,36 @@
<elements xsi:type="xtext:Keyword" value="&quot;"/>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="ID">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</type>
<alternatives xsi:type="xtext:Alternatives" cardinality="+">
<elements xsi:type="xtext:CharacterRange">
<left value="a"/>
<right value="z"/>
</elements>
<elements xsi:type="xtext:CharacterRange">
<left value="A"/>
<right value="Z"/>
</elements>
<elements xsi:type="xtext:CharacterRange">
<left value="0"/>
<right value="9"/>
</elements>
<elements xsi:type="xtext:Keyword" value="_"/>
<elements xsi:type="xtext:Keyword" value=","/>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="EOL">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</type>
<alternatives xsi:type="xtext:Alternatives" cardinality="+">
<elements xsi:type="xtext:Keyword" value="&#xD;"/>
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="WS">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
@ -258,8 +266,6 @@
<alternatives xsi:type="xtext:Alternatives" cardinality="+">
<elements xsi:type="xtext:Keyword" value=" "/>
<elements xsi:type="xtext:Keyword" value="&#x9;"/>
<elements xsi:type="xtext:Keyword" value="&#xD;"/>
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
</alternatives>
</rules>
<rules xsi:type="xtext:TerminalRule" name="ANY_OTHER">
@ -268,4 +274,22 @@
</type>
<alternatives xsi:type="xtext:Wildcard"/>
</rules>
<rules xsi:type="xtext:TerminalRule" name="SL_COMMENT">
<type metamodel="//@metamodelDeclarations.1">
<classifier xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</type>
<alternatives xsi:type="xtext:Group">
<elements xsi:type="xtext:Keyword" value="#"/>
<elements xsi:type="xtext:NegatedToken" cardinality="*">
<terminal xsi:type="xtext:Alternatives">
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
<elements xsi:type="xtext:Keyword" value="&#xD;"/>
</terminal>
</elements>
<elements xsi:type="xtext:Group" cardinality="?">
<elements xsi:type="xtext:Keyword" cardinality="?" value="&#xD;"/>
<elements xsi:type="xtext:Keyword" value="&#xA;"/>
</elements>
</alternatives>
</rules>
</xtext:Grammar>

View file

@ -34,12 +34,13 @@ protected class ThisRootNode extends RootToken {
case 0: return new WMLRoot_Alternatives(this, this, 0, inst);
case 1: return new WMLTag_Group(this, this, 1, inst);
case 2: return new WMLKey_Group(this, this, 2, inst);
case 3: return new WMLKeyValueRule_Alternatives(this, this, 3, inst);
case 3: return new WMLKeyValue_Alternatives(this, this, 3, inst);
case 4: return new WMLMacroCall_NameAssignment(this, this, 4, inst);
case 5: return new WMLLuaCode_ValueAssignment(this, this, 5, inst);
case 6: return new WMLMacroDefine_NameAssignment(this, this, 6, inst);
case 7: return new WMLTextdomain_NameAssignment(this, this, 7, inst);
case 8: return new WMLValue_ValueAssignment(this, this, 8, inst);
case 6: return new WMLArrayCall_Group(this, this, 6, inst);
case 7: return new WMLMacroDefine_NameAssignment(this, this, 7, inst);
case 8: return new WMLTextdomain_NameAssignment(this, this, 8, inst);
case 9: return new WMLValue_ValueAssignment(this, this, 9, inst);
default: return null;
}
}
@ -52,6 +53,7 @@ protected class ThisRootNode extends RootToken {
* //handles TODO:
* // - arrays [ ]
* // - preprocessor commands: #define, #enddef, etc
* // - fix: { { } }
* WMLRoot:
* (Tags+=WMLTag | MacroCalls+=WMLMacroCall | MacroDefines+=WMLMacroDefine | Textdomains+=WMLTextdomain)*;
*
@ -769,12 +771,12 @@ protected class WMLTag_RightSquareBracketKeyword_7 extends KeywordToken {
/************ begin Rule WMLKey ****************
*
* WMLKey:
* name=ID "=" value+=WMLKeyValueRule+;
* WMLKey hidden(WS):
* name=ID "=" value+=WMLKeyValue+ (EOL | SL_COMMENT);
*
**/
// name=ID "=" value+=WMLKeyValueRule+
// name=ID "=" value+=WMLKeyValue+ (EOL | SL_COMMENT)
protected class WMLKey_Group extends GroupToken {
public WMLKey_Group(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -789,7 +791,7 @@ protected class WMLKey_Group extends GroupToken {
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLKey_ValueAssignment_2(lastRuleCallOrigin, this, 0, inst);
case 0: return new WMLKey_Alternatives_3(lastRuleCallOrigin, this, 0, inst);
default: return null;
}
}
@ -858,7 +860,7 @@ protected class WMLKey_EqualsSignKeyword_1 extends KeywordToken {
}
// value+=WMLKeyValueRule+
// value+=WMLKeyValue+
protected class WMLKey_ValueAssignment_2 extends AssignmentToken {
public WMLKey_ValueAssignment_2(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
@ -873,7 +875,7 @@ protected class WMLKey_ValueAssignment_2 extends AssignmentToken {
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLKeyValueRule_Alternatives(this, this, 0, inst);
case 0: return new WMLKeyValue_Alternatives(this, this, 0, inst);
default: return null;
}
}
@ -884,9 +886,9 @@ protected class WMLKey_ValueAssignment_2 extends AssignmentToken {
IEObjectConsumer obj = eObjectConsumer.cloneAndConsume("value");
if(value instanceof EObject) { // org::eclipse::xtext::impl::RuleCallImpl
IEObjectConsumer param = createEObjectConsumer((EObject)value);
if(param.isInstanceOf(grammarAccess.getWMLKeyValueRuleRule().getType().getClassifier())) {
if(param.isInstanceOf(grammarAccess.getWMLKeyValueRule().getType().getClassifier())) {
type = AssignmentType.PARSER_RULE_CALL;
element = grammarAccess.getWMLKeyAccess().getValueWMLKeyValueRuleParserRuleCall_2_0();
element = grammarAccess.getWMLKeyAccess().getValueWMLKeyValueParserRuleCall_2_0();
consumed = obj;
return param;
}
@ -905,42 +907,89 @@ protected class WMLKey_ValueAssignment_2 extends AssignmentToken {
}
}
// EOL | SL_COMMENT
protected class WMLKey_Alternatives_3 extends AlternativesToken {
/************ end Rule WMLKey ****************/
/************ begin Rule WMLKeyValueRule ****************
*
* WMLKeyValueRule:
* WMLValue | WMLMacroCall | WMLLuaCode;
*
**/
// WMLValue | WMLMacroCall | WMLLuaCode
protected class WMLKeyValueRule_Alternatives extends AlternativesToken {
public WMLKeyValueRule_Alternatives(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
public WMLKey_Alternatives_3(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Alternatives getGrammarElement() {
return grammarAccess.getWMLKeyValueRuleAccess().getAlternatives();
return grammarAccess.getWMLKeyAccess().getAlternatives_3();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLKeyValueRule_WMLValueParserRuleCall_0(lastRuleCallOrigin, this, 0, inst);
case 1: return new WMLKeyValueRule_WMLMacroCallParserRuleCall_1(lastRuleCallOrigin, this, 1, inst);
case 2: return new WMLKeyValueRule_WMLLuaCodeParserRuleCall_2(lastRuleCallOrigin, this, 2, inst);
case 0: return new WMLKey_EOLTerminalRuleCall_3_0(lastRuleCallOrigin, this, 0, inst);
default: return null;
}
}
}
// EOL
protected class WMLKey_EOLTerminalRuleCall_3_0 extends UnassignedTextToken {
public WMLKey_EOLTerminalRuleCall_3_0(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public RuleCall getGrammarElement() {
return grammarAccess.getWMLKeyAccess().getEOLTerminalRuleCall_3_0();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLKey_ValueAssignment_2(lastRuleCallOrigin, this, 0, inst);
default: return null;
}
}
}
/************ end Rule WMLKey ****************/
/************ begin Rule WMLKeyValue ****************
*
* WMLKeyValue:
* WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall;
*
**/
// WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall
protected class WMLKeyValue_Alternatives extends AlternativesToken {
public WMLKeyValue_Alternatives(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Alternatives getGrammarElement() {
return grammarAccess.getWMLKeyValueAccess().getAlternatives();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLKeyValue_WMLValueParserRuleCall_0(lastRuleCallOrigin, this, 0, inst);
case 1: return new WMLKeyValue_WMLMacroCallParserRuleCall_1(lastRuleCallOrigin, this, 1, inst);
case 2: return new WMLKeyValue_WMLLuaCodeParserRuleCall_2(lastRuleCallOrigin, this, 2, inst);
case 3: return new WMLKeyValue_WMLArrayCallParserRuleCall_3(lastRuleCallOrigin, this, 3, inst);
default: return null;
}
}
@Override
public IEObjectConsumer tryConsume() {
if(getEObject().eClass() != grammarAccess.getWMLLuaCodeRule().getType().getClassifier() &&
if(getEObject().eClass() != grammarAccess.getWMLArrayCallRule().getType().getClassifier() &&
getEObject().eClass() != grammarAccess.getWMLLuaCodeRule().getType().getClassifier() &&
getEObject().eClass() != grammarAccess.getWMLMacroCallRule().getType().getClassifier() &&
getEObject().eClass() != grammarAccess.getWMLValueRule().getType().getClassifier())
return null;
@ -950,15 +999,15 @@ protected class WMLKeyValueRule_Alternatives extends AlternativesToken {
}
// WMLValue
protected class WMLKeyValueRule_WMLValueParserRuleCall_0 extends RuleCallToken {
protected class WMLKeyValue_WMLValueParserRuleCall_0 extends RuleCallToken {
public WMLKeyValueRule_WMLValueParserRuleCall_0(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
public WMLKeyValue_WMLValueParserRuleCall_0(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public RuleCall getGrammarElement() {
return grammarAccess.getWMLKeyValueRuleAccess().getWMLValueParserRuleCall_0();
return grammarAccess.getWMLKeyValueAccess().getWMLValueParserRuleCall_0();
}
@Override
@ -986,15 +1035,15 @@ protected class WMLKeyValueRule_WMLValueParserRuleCall_0 extends RuleCallToken {
}
// WMLMacroCall
protected class WMLKeyValueRule_WMLMacroCallParserRuleCall_1 extends RuleCallToken {
protected class WMLKeyValue_WMLMacroCallParserRuleCall_1 extends RuleCallToken {
public WMLKeyValueRule_WMLMacroCallParserRuleCall_1(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
public WMLKeyValue_WMLMacroCallParserRuleCall_1(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public RuleCall getGrammarElement() {
return grammarAccess.getWMLKeyValueRuleAccess().getWMLMacroCallParserRuleCall_1();
return grammarAccess.getWMLKeyValueAccess().getWMLMacroCallParserRuleCall_1();
}
@Override
@ -1022,15 +1071,15 @@ protected class WMLKeyValueRule_WMLMacroCallParserRuleCall_1 extends RuleCallTok
}
// WMLLuaCode
protected class WMLKeyValueRule_WMLLuaCodeParserRuleCall_2 extends RuleCallToken {
protected class WMLKeyValue_WMLLuaCodeParserRuleCall_2 extends RuleCallToken {
public WMLKeyValueRule_WMLLuaCodeParserRuleCall_2(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
public WMLKeyValue_WMLLuaCodeParserRuleCall_2(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public RuleCall getGrammarElement() {
return grammarAccess.getWMLKeyValueRuleAccess().getWMLLuaCodeParserRuleCall_2();
return grammarAccess.getWMLKeyValueAccess().getWMLLuaCodeParserRuleCall_2();
}
@Override
@ -1057,8 +1106,44 @@ protected class WMLKeyValueRule_WMLLuaCodeParserRuleCall_2 extends RuleCallToken
}
}
// WMLArrayCall
protected class WMLKeyValue_WMLArrayCallParserRuleCall_3 extends RuleCallToken {
public WMLKeyValue_WMLArrayCallParserRuleCall_3(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public RuleCall getGrammarElement() {
return grammarAccess.getWMLKeyValueAccess().getWMLArrayCallParserRuleCall_3();
}
/************ end Rule WMLKeyValueRule ****************/
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLArrayCall_Group(this, this, 0, inst);
default: return null;
}
}
@Override
public IEObjectConsumer tryConsume() {
if(getEObject().eClass() != grammarAccess.getWMLArrayCallRule().getType().getClassifier())
return null;
if(checkForRecursion(WMLArrayCall_Group.class, eObjectConsumer)) return null;
return eObjectConsumer;
}
@Override
public AbstractToken createFollowerAfterReturn(AbstractToken next, int actIndex, int index, IEObjectConsumer inst) {
switch(index) {
default: return lastRuleCallOrigin.createFollowerAfterReturn(next, actIndex , index, inst);
}
}
}
/************ end Rule WMLKeyValue ****************/
/************ begin Rule WMLMacroCall ****************
@ -1151,6 +1236,136 @@ protected class WMLLuaCode_ValueAssignment extends AssignmentToken {
/************ end Rule WMLLuaCode ****************/
/************ begin Rule WMLArrayCall ****************
*
* WMLArrayCall:
* "[" value+=WMLValue+ "]";
*
**/
// "[" value+=WMLValue+ "]"
protected class WMLArrayCall_Group extends GroupToken {
public WMLArrayCall_Group(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Group getGrammarElement() {
return grammarAccess.getWMLArrayCallAccess().getGroup();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLArrayCall_RightSquareBracketKeyword_2(lastRuleCallOrigin, this, 0, inst);
default: return null;
}
}
@Override
public IEObjectConsumer tryConsume() {
if(getEObject().eClass() != grammarAccess.getWMLArrayCallRule().getType().getClassifier())
return null;
return eObjectConsumer;
}
}
// "["
protected class WMLArrayCall_LeftSquareBracketKeyword_0 extends KeywordToken {
public WMLArrayCall_LeftSquareBracketKeyword_0(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Keyword getGrammarElement() {
return grammarAccess.getWMLArrayCallAccess().getLeftSquareBracketKeyword_0();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
default: return lastRuleCallOrigin.createFollowerAfterReturn(this, index, index, inst);
}
}
}
// value+=WMLValue+
protected class WMLArrayCall_ValueAssignment_1 extends AssignmentToken {
public WMLArrayCall_ValueAssignment_1(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Assignment getGrammarElement() {
return grammarAccess.getWMLArrayCallAccess().getValueAssignment_1();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLValue_ValueAssignment(this, this, 0, inst);
default: return null;
}
}
@Override
public IEObjectConsumer tryConsume() {
if((value = eObjectConsumer.getConsumable("value",true)) == null) return null;
IEObjectConsumer obj = eObjectConsumer.cloneAndConsume("value");
if(value instanceof EObject) { // org::eclipse::xtext::impl::RuleCallImpl
IEObjectConsumer param = createEObjectConsumer((EObject)value);
if(param.isInstanceOf(grammarAccess.getWMLValueRule().getType().getClassifier())) {
type = AssignmentType.PARSER_RULE_CALL;
element = grammarAccess.getWMLArrayCallAccess().getValueWMLValueParserRuleCall_1_0();
consumed = obj;
return param;
}
}
return null;
}
@Override
public AbstractToken createFollowerAfterReturn(AbstractToken next, int actIndex, int index, IEObjectConsumer inst) {
if(value == inst.getEObject() && !inst.isConsumed()) return null;
switch(index) {
case 0: return new WMLArrayCall_ValueAssignment_1(lastRuleCallOrigin, next, actIndex, consumed);
case 1: return new WMLArrayCall_LeftSquareBracketKeyword_0(lastRuleCallOrigin, next, actIndex, consumed);
default: return null;
}
}
}
// "]"
protected class WMLArrayCall_RightSquareBracketKeyword_2 extends KeywordToken {
public WMLArrayCall_RightSquareBracketKeyword_2(AbstractToken lastRuleCallOrigin, AbstractToken next, int transitionIndex, IEObjectConsumer eObjectConsumer) {
super(lastRuleCallOrigin, next, transitionIndex, eObjectConsumer);
}
@Override
public Keyword getGrammarElement() {
return grammarAccess.getWMLArrayCallAccess().getRightSquareBracketKeyword_2();
}
@Override
public AbstractToken createFollower(int index, IEObjectConsumer inst) {
switch(index) {
case 0: return new WMLArrayCall_ValueAssignment_1(lastRuleCallOrigin, this, 0, inst);
default: return null;
}
}
}
/************ end Rule WMLArrayCall ****************/
/************ begin Rule WMLMacroDefine ****************
*
* WMLMacroDefine:

View file

@ -22,7 +22,7 @@ public class WMLParser extends org.eclipse.xtext.parser.antlr.AbstractAntlrParse
protected IParseResult parse(String ruleName, CharStream in) {
TokenSource tokenSource = createLexer(in);
XtextTokenStream tokenStream = createTokenStream(tokenSource);
tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_SL_COMMENT");
tokenStream.setInitialHiddenTokens("RULE_EOL", "RULE_WS", "RULE_SL_COMMENT");
org.wesnoth.parser.antlr.internal.InternalWMLParser parser = createParser(tokenStream);
parser.setTokenTypeMap(getTokenDefProvider().getTokenDefMap());
parser.setSyntaxErrorProvider(getSyntaxErrorProvider());

View file

@ -429,16 +429,23 @@ ruleWMLTag returns [EObject current=null]
// Entry rule entryRuleWMLKey
entryRuleWMLKey returns [EObject current=null]
@init {
HiddenTokens myHiddenTokenState = ((XtextTokenStream)input).setHiddenTokens("RULE_WS");
}
:
{ currentNode = createCompositeNode(grammarAccess.getWMLKeyRule(), currentNode); }
iv_ruleWMLKey=ruleWMLKey
{ $current=$iv_ruleWMLKey.current; }
EOF
;
finally {
myHiddenTokenState.restore();
}
// Rule WMLKey
ruleWMLKey returns [EObject current=null]
@init { EObject temp=null; setCurrentLookahead(); resetLookahead();
HiddenTokens myHiddenTokenState = ((XtextTokenStream)input).setHiddenTokens("RULE_WS");
}
@after { resetLookahead();
lastConsumedNode = currentNode;
@ -474,9 +481,9 @@ ruleWMLKey returns [EObject current=null]
(
(
{
currentNode=createCompositeNode(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueRuleParserRuleCall_2_0(), currentNode);
currentNode=createCompositeNode(grammarAccess.getWMLKeyAccess().getValueWMLKeyValueParserRuleCall_2_0(), currentNode);
}
lv_value_2_0=ruleWMLKeyValueRule {
lv_value_2_0=ruleWMLKeyValue {
if ($current==null) {
$current = factory.create(grammarAccess.getWMLKeyRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), $current);
@ -486,7 +493,7 @@ ruleWMLKey returns [EObject current=null]
$current,
"value",
lv_value_2_0,
"WMLKeyValueRule",
"WMLKeyValue",
currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
@ -495,24 +502,36 @@ ruleWMLKey returns [EObject current=null]
}
)
)+)
)+(RULE_EOL
{
createLeafNode(grammarAccess.getWMLKeyAccess().getEOLTerminalRuleCall_3_0(), null);
}
|RULE_SL_COMMENT
{
createLeafNode(grammarAccess.getWMLKeyAccess().getSL_COMMENTTerminalRuleCall_3_1(), null);
}
))
;
finally {
myHiddenTokenState.restore();
}
// Entry rule entryRuleWMLKeyValueRule
entryRuleWMLKeyValueRule returns [EObject current=null]
// Entry rule entryRuleWMLKeyValue
entryRuleWMLKeyValue returns [EObject current=null]
:
{ currentNode = createCompositeNode(grammarAccess.getWMLKeyValueRuleRule(), currentNode); }
iv_ruleWMLKeyValueRule=ruleWMLKeyValueRule
{ $current=$iv_ruleWMLKeyValueRule.current; }
{ currentNode = createCompositeNode(grammarAccess.getWMLKeyValueRule(), currentNode); }
iv_ruleWMLKeyValue=ruleWMLKeyValue
{ $current=$iv_ruleWMLKeyValue.current; }
EOF
;
// Rule WMLKeyValueRule
ruleWMLKeyValueRule returns [EObject current=null]
// Rule WMLKeyValue
ruleWMLKeyValue returns [EObject current=null]
@init { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
@ -520,7 +539,7 @@ ruleWMLKeyValueRule returns [EObject current=null]
}:
(
{
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueRuleAccess().getWMLValueParserRuleCall_0(), currentNode);
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueAccess().getWMLValueParserRuleCall_0(), currentNode);
}
this_WMLValue_0=ruleWMLValue
{
@ -530,7 +549,7 @@ ruleWMLKeyValueRule returns [EObject current=null]
|
{
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueRuleAccess().getWMLMacroCallParserRuleCall_1(), currentNode);
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueAccess().getWMLMacroCallParserRuleCall_1(), currentNode);
}
this_WMLMacroCall_1=ruleWMLMacroCall
{
@ -540,13 +559,23 @@ ruleWMLKeyValueRule returns [EObject current=null]
|
{
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueRuleAccess().getWMLLuaCodeParserRuleCall_2(), currentNode);
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueAccess().getWMLLuaCodeParserRuleCall_2(), currentNode);
}
this_WMLLuaCode_2=ruleWMLLuaCode
{
$current = $this_WMLLuaCode_2.current;
currentNode = currentNode.getParent();
}
|
{
currentNode=createCompositeNode(grammarAccess.getWMLKeyValueAccess().getWMLArrayCallParserRuleCall_3(), currentNode);
}
this_WMLArrayCall_3=ruleWMLArrayCall
{
$current = $this_WMLArrayCall_3.current;
currentNode = currentNode.getParent();
}
)
;
@ -648,6 +677,61 @@ ruleWMLLuaCode returns [EObject current=null]
// Entry rule entryRuleWMLArrayCall
entryRuleWMLArrayCall returns [EObject current=null]
:
{ currentNode = createCompositeNode(grammarAccess.getWMLArrayCallRule(), currentNode); }
iv_ruleWMLArrayCall=ruleWMLArrayCall
{ $current=$iv_ruleWMLArrayCall.current; }
EOF
;
// Rule WMLArrayCall
ruleWMLArrayCall returns [EObject current=null]
@init { EObject temp=null; setCurrentLookahead(); resetLookahead();
}
@after { resetLookahead();
lastConsumedNode = currentNode;
}:
( '['
{
createLeafNode(grammarAccess.getWMLArrayCallAccess().getLeftSquareBracketKeyword_0(), null);
}
(
(
{
currentNode=createCompositeNode(grammarAccess.getWMLArrayCallAccess().getValueWMLValueParserRuleCall_1_0(), currentNode);
}
lv_value_1_0=ruleWMLValue {
if ($current==null) {
$current = factory.create(grammarAccess.getWMLArrayCallRule().getType().getClassifier());
associateNodeWithAstElement(currentNode.getParent(), $current);
}
try {
add(
$current,
"value",
lv_value_1_0,
"WMLValue",
currentNode);
} catch (ValueConverterException vce) {
handleValueConverterException(vce);
}
currentNode = currentNode.getParent();
}
)
)+ ']'
{
createLeafNode(grammarAccess.getWMLArrayCallAccess().getRightSquareBracketKeyword_2(), null);
}
)
;
// Entry rule entryRuleWMLMacroDefine
entryRuleWMLMacroDefine returns [EObject current=null]
:
@ -860,14 +944,16 @@ RULE_DEFINE : '#define' ( options {greedy=false;} : . )*'#enddef';
RULE_TEXTDOMAIN : '#textdomain' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
RULE_EOL : ('\r'|'\n')+;
RULE_WS : (' '|'\t'|'\r'|'\n')+;
RULE_WS : (' '|'\t')+;
RULE_ANY_OTHER : .;
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;

View file

@ -1,14 +1,15 @@
RULE_LUA_CODE=6
RULE_LUA_CODE=8
RULE_ID=4
RULE_STRING=9
RULE_DEFINE=7
RULE_ANY_OTHER=10
RULE_TEXTDOMAIN=8
RULE_WS=12
RULE_SL_COMMENT=11
RULE_MACRO=5
'='=17
'[/'=16
'['=13
'+'=14
']'=15
RULE_STRING=11
RULE_DEFINE=9
RULE_ANY_OTHER=12
RULE_EOL=5
RULE_TEXTDOMAIN=10
RULE_WS=13
RULE_SL_COMMENT=6
RULE_MACRO=7
'='=18
'[/'=17
'['=14
'+'=15
']'=16

View file

@ -12,54 +12,37 @@ import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalWMLLexer extends Lexer {
public static final int RULE_LUA_CODE=6;
public static final int RULE_LUA_CODE=8;
public static final int RULE_ID=4;
public static final int RULE_STRING=9;
public static final int RULE_DEFINE=7;
public static final int RULE_ANY_OTHER=10;
public static final int RULE_TEXTDOMAIN=8;
public static final int T13=13;
public static final int T14=14;
public static final int T15=15;
public static final int RULE_WS=12;
public static final int Tokens=18;
public static final int T16=16;
public static final int RULE_SL_COMMENT=11;
public static final int RULE_ANY_OTHER=12;
public static final int RULE_EOL=5;
public static final int RULE_TEXTDOMAIN=10;
public static final int EOF=-1;
public static final int RULE_SL_COMMENT=6;
public static final int Tokens=19;
public static final int RULE_MACRO=7;
public static final int RULE_STRING=11;
public static final int RULE_DEFINE=9;
public static final int T14=14;
public static final int RULE_WS=13;
public static final int T15=15;
public static final int T16=16;
public static final int T17=17;
public static final int RULE_MACRO=5;
public static final int T18=18;
public InternalWMLLexer() {;}
public InternalWMLLexer(CharStream input) {
super(input);
}
public String getGrammarFileName() { return "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g"; }
// $ANTLR start T13
public final void mT13() throws RecognitionException {
try {
int _type = T13;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:10:5: ( '[' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:10:7: '['
{
match('[');
}
this.type = _type;
}
finally {
}
}
// $ANTLR end T13
// $ANTLR start T14
public final void mT14() throws RecognitionException {
try {
int _type = T14;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:11:5: ( '+' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:11:7: '+'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:10:5: ( '[' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:10:7: '['
{
match('+');
match('[');
}
@ -74,10 +57,10 @@ public class InternalWMLLexer extends Lexer {
public final void mT15() throws RecognitionException {
try {
int _type = T15;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:12:5: ( ']' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:12:7: ']'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:11:5: ( '+' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:11:7: '+'
{
match(']');
match('+');
}
@ -92,11 +75,10 @@ public class InternalWMLLexer extends Lexer {
public final void mT16() throws RecognitionException {
try {
int _type = T16;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:13:5: ( '[/' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:13:7: '[/'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:12:5: ( ']' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:12:7: ']'
{
match("[/");
match(']');
}
@ -111,6 +93,25 @@ public class InternalWMLLexer extends Lexer {
public final void mT17() throws RecognitionException {
try {
int _type = T17;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:13:5: ( '[/' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:13:7: '[/'
{
match("[/");
}
this.type = _type;
}
finally {
}
}
// $ANTLR end T17
// $ANTLR start T18
public final void mT18() throws RecognitionException {
try {
int _type = T18;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:14:5: ( '=' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:14:7: '='
{
@ -123,18 +124,18 @@ public class InternalWMLLexer extends Lexer {
finally {
}
}
// $ANTLR end T17
// $ANTLR end T18
// $ANTLR start RULE_LUA_CODE
public final void mRULE_LUA_CODE() throws RecognitionException {
try {
int _type = RULE_LUA_CODE;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:855:15: ( '<<' ( options {greedy=false; } : . )* '>>' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:855:17: '<<' ( options {greedy=false; } : . )* '>>'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:939:15: ( '<<' ( options {greedy=false; } : . )* '>>' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:939:17: '<<' ( options {greedy=false; } : . )* '>>'
{
match("<<");
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:855:22: ( options {greedy=false; } : . )*
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:939:22: ( options {greedy=false; } : . )*
loop1:
do {
int alt1=2;
@ -159,7 +160,7 @@ public class InternalWMLLexer extends Lexer {
switch (alt1) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:855:50: .
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:939:50: .
{
matchAny();
@ -187,11 +188,11 @@ public class InternalWMLLexer extends Lexer {
public final void mRULE_MACRO() throws RecognitionException {
try {
int _type = RULE_MACRO;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:857:12: ( '{' ( options {greedy=false; } : . )* '}' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:857:14: '{' ( options {greedy=false; } : . )* '}'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:941:12: ( '{' ( options {greedy=false; } : . )* '}' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:941:14: '{' ( options {greedy=false; } : . )* '}'
{
match('{');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:857:18: ( options {greedy=false; } : . )*
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:941:18: ( options {greedy=false; } : . )*
loop2:
do {
int alt2=2;
@ -207,7 +208,7 @@ public class InternalWMLLexer extends Lexer {
switch (alt2) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:857:46: .
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:941:46: .
{
matchAny();
@ -234,12 +235,12 @@ public class InternalWMLLexer extends Lexer {
public final void mRULE_DEFINE() throws RecognitionException {
try {
int _type = RULE_DEFINE;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:859:13: ( '#define' ( options {greedy=false; } : . )* '#enddef' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:859:15: '#define' ( options {greedy=false; } : . )* '#enddef'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:943:13: ( '#define' ( options {greedy=false; } : . )* '#enddef' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:943:15: '#define' ( options {greedy=false; } : . )* '#enddef'
{
match("#define");
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:859:25: ( options {greedy=false; } : . )*
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:943:25: ( options {greedy=false; } : . )*
loop3:
do {
int alt3=2;
@ -309,7 +310,7 @@ public class InternalWMLLexer extends Lexer {
switch (alt3) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:859:53: .
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:943:53: .
{
matchAny();
@ -337,12 +338,12 @@ public class InternalWMLLexer extends Lexer {
public final void mRULE_TEXTDOMAIN() throws RecognitionException {
try {
int _type = RULE_TEXTDOMAIN;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:17: ( '#textdomain' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:19: '#textdomain' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:17: ( '#textdomain' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:19: '#textdomain' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("#textdomain");
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:33: (~ ( ( '\\n' | '\\r' ) ) )*
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:33: (~ ( ( '\\n' | '\\r' ) ) )*
loop4:
do {
int alt4=2;
@ -355,7 +356,7 @@ public class InternalWMLLexer extends Lexer {
switch (alt4) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:33: ~ ( ( '\\n' | '\\r' ) )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:33: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) {
input.consume();
@ -376,7 +377,7 @@ public class InternalWMLLexer extends Lexer {
}
} while (true);
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:49: ( ( '\\r' )? '\\n' )?
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:49: ( ( '\\r' )? '\\n' )?
int alt6=2;
int LA6_0 = input.LA(1);
@ -385,9 +386,9 @@ public class InternalWMLLexer extends Lexer {
}
switch (alt6) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:50: ( '\\r' )? '\\n'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:50: ( '\\r' )? '\\n'
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:50: ( '\\r' )?
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:50: ( '\\r' )?
int alt5=2;
int LA5_0 = input.LA(1);
@ -396,7 +397,7 @@ public class InternalWMLLexer extends Lexer {
}
switch (alt5) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:861:50: '\\r'
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:945:50: '\\r'
{
match('\r');
@ -422,30 +423,50 @@ public class InternalWMLLexer extends Lexer {
}
// $ANTLR end RULE_TEXTDOMAIN
// $ANTLR start RULE_SL_COMMENT
public final void mRULE_SL_COMMENT() throws RecognitionException {
// $ANTLR start RULE_STRING
public final void mRULE_STRING() throws RecognitionException {
try {
int _type = RULE_SL_COMMENT;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:17: ( '#' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:19: '#' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
int _type = RULE_STRING;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:947:13: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:947:15: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('#');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:23: (~ ( ( '\\n' | '\\r' ) ) )*
match('\"');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:947:19: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )*
loop7:
do {
int alt7=2;
int alt7=3;
int LA7_0 = input.LA(1);
if ( ((LA7_0>='\u0000' && LA7_0<='\t')||(LA7_0>='\u000B' && LA7_0<='\f')||(LA7_0>='\u000E' && LA7_0<='\uFFFE')) ) {
if ( (LA7_0=='\\') ) {
alt7=1;
}
else if ( ((LA7_0>='\u0000' && LA7_0<='!')||(LA7_0>='#' && LA7_0<='[')||(LA7_0>=']' && LA7_0<='\uFFFE')) ) {
alt7=2;
}
switch (alt7) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:23: ~ ( ( '\\n' | '\\r' ) )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:947:20: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) {
match('\\');
if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
input.consume();
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
recover(mse); throw mse;
}
}
break;
case 2 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:947:61: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
input.consume();
}
@ -464,42 +485,63 @@ public class InternalWMLLexer extends Lexer {
}
} while (true);
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:39: ( ( '\\r' )? '\\n' )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='\n'||LA9_0=='\r') ) {
alt9=1;
}
switch (alt9) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:40: ( '\\r' )? '\\n'
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:40: ( '\\r' )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0=='\r') ) {
alt8=1;
}
switch (alt8) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:863:40: '\\r'
{
match('\r');
}
break;
}
match('\n');
}
break;
match('\"');
}
this.type = _type;
}
finally {
}
}
// $ANTLR end RULE_STRING
// $ANTLR start RULE_ID
public final void mRULE_ID() throws RecognitionException {
try {
int _type = RULE_ID;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:949:9: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+ )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:949:11: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:949:11: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+
int cnt8=0;
loop8:
do {
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==','||(LA8_0>='0' && LA8_0<='9')||(LA8_0>='A' && LA8_0<='Z')||LA8_0=='_'||(LA8_0>='a' && LA8_0<='z')) ) {
alt8=1;
}
switch (alt8) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:
{
if ( input.LA(1)==','||(input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
input.consume();
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
recover(mse); throw mse;
}
}
break;
default :
if ( cnt8 >= 1 ) break loop8;
EarlyExitException eee =
new EarlyExitException(8, input);
throw eee;
}
cnt8++;
} while (true);
}
@ -508,23 +550,79 @@ public class InternalWMLLexer extends Lexer {
finally {
}
}
// $ANTLR end RULE_SL_COMMENT
// $ANTLR end RULE_ID
// $ANTLR start RULE_ID
public final void mRULE_ID() throws RecognitionException {
// $ANTLR start RULE_EOL
public final void mRULE_EOL() throws RecognitionException {
try {
int _type = RULE_ID;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:865:9: ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+ )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:865:11: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+
int _type = RULE_EOL;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:951:10: ( ( '\\r' | '\\n' )+ )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:951:12: ( '\\r' | '\\n' )+
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:865:11: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | ',' )+
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:951:12: ( '\\r' | '\\n' )+
int cnt9=0;
loop9:
do {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='\n'||LA9_0=='\r') ) {
alt9=1;
}
switch (alt9) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:
{
if ( input.LA(1)=='\n'||input.LA(1)=='\r' ) {
input.consume();
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
recover(mse); throw mse;
}
}
break;
default :
if ( cnt9 >= 1 ) break loop9;
EarlyExitException eee =
new EarlyExitException(9, input);
throw eee;
}
cnt9++;
} while (true);
}
this.type = _type;
}
finally {
}
}
// $ANTLR end RULE_EOL
// $ANTLR start RULE_WS
public final void mRULE_WS() throws RecognitionException {
try {
int _type = RULE_WS;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:953:9: ( ( ' ' | '\\t' )+ )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:953:11: ( ' ' | '\\t' )+
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:953:11: ( ' ' | '\\t' )+
int cnt10=0;
loop10:
do {
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0==','||(LA10_0>='0' && LA10_0<='9')||(LA10_0>='A' && LA10_0<='Z')||LA10_0=='_'||(LA10_0>='a' && LA10_0<='z')) ) {
if ( (LA10_0=='\t'||LA10_0==' ') ) {
alt10=1;
}
@ -533,7 +631,7 @@ public class InternalWMLLexer extends Lexer {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:
{
if ( input.LA(1)==','||(input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
if ( input.LA(1)=='\t'||input.LA(1)==' ' ) {
input.consume();
}
@ -564,52 +662,50 @@ public class InternalWMLLexer extends Lexer {
finally {
}
}
// $ANTLR end RULE_ID
// $ANTLR end RULE_WS
// $ANTLR start RULE_STRING
public final void mRULE_STRING() throws RecognitionException {
// $ANTLR start RULE_ANY_OTHER
public final void mRULE_ANY_OTHER() throws RecognitionException {
try {
int _type = RULE_STRING;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:867:13: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:867:15: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
int _type = RULE_ANY_OTHER;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:955:16: ( . )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:955:18: .
{
match('\"');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:867:19: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' ) | ~ ( ( '\\\\' | '\"' ) ) )*
matchAny();
}
this.type = _type;
}
finally {
}
}
// $ANTLR end RULE_ANY_OTHER
// $ANTLR start RULE_SL_COMMENT
public final void mRULE_SL_COMMENT() throws RecognitionException {
try {
int _type = RULE_SL_COMMENT;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:17: ( '#' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:19: '#' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match('#');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:23: (~ ( ( '\\n' | '\\r' ) ) )*
loop11:
do {
int alt11=3;
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0=='\\') ) {
if ( ((LA11_0>='\u0000' && LA11_0<='\t')||(LA11_0>='\u000B' && LA11_0<='\f')||(LA11_0>='\u000E' && LA11_0<='\uFFFE')) ) {
alt11=1;
}
else if ( ((LA11_0>='\u0000' && LA11_0<='!')||(LA11_0>='#' && LA11_0<='[')||(LA11_0>=']' && LA11_0<='\uFFFE')) ) {
alt11=2;
}
switch (alt11) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:867:20: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\\'' | '\\\\' )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:23: ~ ( ( '\\n' | '\\r' ) )
{
match('\\');
if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) {
input.consume();
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
recover(mse); throw mse;
}
}
break;
case 2 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:867:61: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) {
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) {
input.consume();
}
@ -628,63 +724,42 @@ public class InternalWMLLexer extends Lexer {
}
} while (true);
match('\"');
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:39: ( ( '\\r' )? '\\n' )?
int alt13=2;
int LA13_0 = input.LA(1);
if ( (LA13_0=='\n'||LA13_0=='\r') ) {
alt13=1;
}
switch (alt13) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:40: ( '\\r' )? '\\n'
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:40: ( '\\r' )?
int alt12=2;
int LA12_0 = input.LA(1);
if ( (LA12_0=='\r') ) {
alt12=1;
}
switch (alt12) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:957:40: '\\r'
{
match('\r');
}
break;
}
match('\n');
}
break;
}
this.type = _type;
}
finally {
}
}
// $ANTLR end RULE_STRING
// $ANTLR start RULE_WS
public final void mRULE_WS() throws RecognitionException {
try {
int _type = RULE_WS;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:869:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:869:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:869:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt12=0;
loop12:
do {
int alt12=2;
int LA12_0 = input.LA(1);
if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) {
alt12=1;
}
switch (alt12) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:
{
if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
input.consume();
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
recover(mse); throw mse;
}
}
break;
default :
if ( cnt12 >= 1 ) break loop12;
EarlyExitException eee =
new EarlyExitException(12, input);
throw eee;
}
cnt12++;
} while (true);
}
@ -693,64 +768,46 @@ public class InternalWMLLexer extends Lexer {
finally {
}
}
// $ANTLR end RULE_WS
// $ANTLR start RULE_ANY_OTHER
public final void mRULE_ANY_OTHER() throws RecognitionException {
try {
int _type = RULE_ANY_OTHER;
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:871:16: ( . )
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:871:18: .
{
matchAny();
}
this.type = _type;
}
finally {
}
}
// $ANTLR end RULE_ANY_OTHER
// $ANTLR end RULE_SL_COMMENT
public void mTokens() throws RecognitionException {
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:8: ( T13 | T14 | T15 | T16 | T17 | RULE_LUA_CODE | RULE_MACRO | RULE_DEFINE | RULE_TEXTDOMAIN | RULE_SL_COMMENT | RULE_ID | RULE_STRING | RULE_WS | RULE_ANY_OTHER )
int alt13=14;
alt13 = dfa13.predict(input);
switch (alt13) {
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:8: ( T14 | T15 | T16 | T17 | T18 | RULE_LUA_CODE | RULE_MACRO | RULE_DEFINE | RULE_TEXTDOMAIN | RULE_STRING | RULE_ID | RULE_EOL | RULE_WS | RULE_ANY_OTHER | RULE_SL_COMMENT )
int alt14=15;
alt14 = dfa14.predict(input);
switch (alt14) {
case 1 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:10: T13
{
mT13();
}
break;
case 2 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:14: T14
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:10: T14
{
mT14();
}
break;
case 3 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:18: T15
case 2 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:14: T15
{
mT15();
}
break;
case 4 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:22: T16
case 3 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:18: T16
{
mT16();
}
break;
case 5 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:26: T17
case 4 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:22: T17
{
mT17();
}
break;
case 5 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:26: T18
{
mT18();
}
break;
case 6 :
@ -782,38 +839,45 @@ public class InternalWMLLexer extends Lexer {
}
break;
case 10 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:83: RULE_SL_COMMENT
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:83: RULE_STRING
{
mRULE_SL_COMMENT();
mRULE_STRING();
}
break;
case 11 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:99: RULE_ID
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:95: RULE_ID
{
mRULE_ID();
}
break;
case 12 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:107: RULE_STRING
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:103: RULE_EOL
{
mRULE_STRING();
mRULE_EOL();
}
break;
case 13 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:119: RULE_WS
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:112: RULE_WS
{
mRULE_WS();
}
break;
case 14 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:127: RULE_ANY_OTHER
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:120: RULE_ANY_OTHER
{
mRULE_ANY_OTHER();
}
break;
case 15 :
// ../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g:1:135: RULE_SL_COMMENT
{
mRULE_SL_COMMENT();
}
break;
@ -822,39 +886,38 @@ public class InternalWMLLexer extends Lexer {
}
protected DFA13 dfa13 = new DFA13(this);
static final String DFA13_eotS =
"\1\uffff\1\15\3\uffff\2\13\1\25\1\uffff\1\13\11\uffff\2\25\4\uffff"+
"\12\25\1\uffff\4\25\1\uffff\5\25\1\63\1\25\1\63\3\uffff\1\25\1\50";
static final String DFA13_eofS =
"\66\uffff";
static final String DFA13_minS =
"\1\0\1\57\3\uffff\1\74\1\0\1\144\1\uffff\1\0\11\uffff\2\145\4\uffff"+
"\1\146\1\170\1\151\1\164\1\156\1\144\1\145\1\157\1\0\1\155\4\0\1"+
"\141\1\uffff\1\0\1\151\1\0\1\156\4\0\1\12\2\uffff\2\0";
static final String DFA13_maxS =
"\1\ufffe\1\57\3\uffff\1\74\1\ufffe\1\164\1\uffff\1\ufffe\11\uffff"+
"\2\145\4\uffff\1\146\1\170\1\151\1\164\1\156\1\144\1\145\1\157\1"+
"\ufffe\1\155\4\ufffe\1\141\1\uffff\1\ufffe\1\151\1\ufffe\1\156\4"+
"\ufffe\1\12\2\uffff\2\ufffe";
static final String DFA13_acceptS =
"\2\uffff\1\2\1\3\1\5\3\uffff\1\13\1\uffff\1\15\1\16\1\4\1\1\1\2"+
"\1\3\1\5\1\6\1\7\2\uffff\1\12\1\13\1\14\1\15\17\uffff\1\10\11\uffff"+
protected DFA14 dfa14 = new DFA14(this);
static final String DFA14_eotS =
"\1\uffff\1\16\3\uffff\4\14\13\uffff\2\26\5\uffff\13\26\1\uffff\4"+
"\26\1\uffff\4\26\1\65\1\26\1\65\3\uffff\1\26\1\53";
static final String DFA14_eofS =
"\70\uffff";
static final String DFA14_minS =
"\1\0\1\57\3\uffff\1\74\3\0\13\uffff\2\145\5\uffff\1\146\1\170\1"+
"\151\1\164\1\156\1\144\1\145\1\157\1\0\1\155\4\0\1\141\1\0\1\uffff"+
"\1\151\1\0\1\156\4\0\1\12\2\uffff\2\0";
static final String DFA14_maxS =
"\1\ufffe\1\57\3\uffff\1\74\3\ufffe\13\uffff\2\145\5\uffff\1\146"+
"\1\170\1\151\1\164\1\156\1\144\1\145\1\157\1\ufffe\1\155\4\ufffe"+
"\1\141\1\ufffe\1\uffff\1\151\1\ufffe\1\156\4\ufffe\1\12\2\uffff"+
"\2\ufffe";
static final String DFA14_acceptS =
"\2\uffff\1\2\1\3\1\5\4\uffff\1\13\1\14\1\15\1\16\1\4\1\1\1\2\1\3"+
"\1\5\1\6\1\7\2\uffff\1\17\1\12\1\13\1\14\1\15\20\uffff\1\10\10\uffff"+
"\2\11\2\uffff";
static final String DFA13_specialS =
"\66\uffff}>";
static final String[] DFA13_transitionS = {
"\11\13\2\12\2\13\1\12\22\13\1\12\1\13\1\11\1\7\7\13\1\2\1\10"+
"\3\13\12\10\2\13\1\5\1\4\3\13\32\10\1\1\1\13\1\3\1\13\1\10\1"+
"\13\32\10\1\6\uff83\13",
"\1\14",
static final String DFA14_specialS =
"\70\uffff}>";
static final String[] DFA14_transitionS = {
"\11\14\1\13\1\12\2\14\1\12\22\14\1\13\1\14\1\10\1\7\7\14\1\2"+
"\1\11\3\14\12\11\2\14\1\5\1\4\3\14\32\11\1\1\1\14\1\3\1\14\1"+
"\11\1\14\32\11\1\6\uff83\14",
"\1\15",
"",
"",
"",
"\1\21",
"\uffff\22",
"\1\23\17\uffff\1\24",
"",
"\1\22",
"\uffff\23",
"\144\26\1\24\17\26\1\25\uff8a\26",
"\uffff\27",
"",
"",
@ -865,74 +928,77 @@ public class InternalWMLLexer extends Lexer {
"",
"",
"",
"\1\31",
"\1\32",
"",
"",
"",
"",
"\1\33",
"\1\34",
"",
"",
"",
"",
"",
"\1\35",
"\1\36",
"\1\37",
"\1\40",
"\1\41",
"\1\42",
"\12\46\1\44\2\46\1\43\25\46\1\45\uffdb\46",
"\1\47",
"\12\50\1\44\ufff4\50",
"\uffff\50",
"\12\46\1\44\2\46\1\43\25\46\1\45\101\46\1\51\uff99\46",
"\12\46\1\44\2\46\1\43\25\46\1\45\uffdb\46",
"\1\52",
"",
"\12\46\1\44\2\46\1\43\25\46\1\45\112\46\1\53\uff90\46",
"\1\43",
"\1\44",
"\12\50\1\47\2\50\1\46\25\50\1\45\uffdb\50",
"\1\51",
"\12\50\1\47\2\50\1\46\25\50\1\45\101\50\1\52\uff99\50",
"\12\53\1\47\ufff4\53",
"\uffff\53",
"\12\50\1\47\2\50\1\46\25\50\1\45\uffdb\50",
"\1\54",
"\12\46\1\44\2\46\1\43\25\46\1\45\100\46\1\55\uff9a\46",
"\12\50\1\47\2\50\1\46\25\50\1\45\112\50\1\55\uff90\50",
"",
"\1\56",
"\12\46\1\44\2\46\1\43\25\46\1\45\100\46\1\57\uff9a\46",
"\12\60\1\62\2\60\1\61\ufff1\60",
"\12\46\1\44\2\46\1\43\25\46\1\45\101\46\1\64\uff99\46",
"\12\60\1\62\2\60\1\61\ufff1\60",
"\1\62",
"\12\50\1\47\2\50\1\46\25\50\1\45\100\50\1\57\uff9a\50",
"\1\60",
"\12\50\1\47\2\50\1\46\25\50\1\45\100\50\1\61\uff9a\50",
"\12\62\1\64\2\62\1\63\ufff1\62",
"\12\50\1\47\2\50\1\46\25\50\1\45\101\50\1\66\uff99\50",
"\12\62\1\64\2\62\1\63\ufff1\62",
"\1\64",
"",
"",
"\12\46\1\44\2\46\1\43\25\46\1\45\102\46\1\65\uff98\46",
"\12\46\1\44\2\46\1\43\25\46\1\45\uffdb\46"
"\12\50\1\47\2\50\1\46\25\50\1\45\102\50\1\67\uff98\50",
"\12\50\1\47\2\50\1\46\25\50\1\45\uffdb\50"
};
static final short[] DFA13_eot = DFA.unpackEncodedString(DFA13_eotS);
static final short[] DFA13_eof = DFA.unpackEncodedString(DFA13_eofS);
static final char[] DFA13_min = DFA.unpackEncodedStringToUnsignedChars(DFA13_minS);
static final char[] DFA13_max = DFA.unpackEncodedStringToUnsignedChars(DFA13_maxS);
static final short[] DFA13_accept = DFA.unpackEncodedString(DFA13_acceptS);
static final short[] DFA13_special = DFA.unpackEncodedString(DFA13_specialS);
static final short[][] DFA13_transition;
static final short[] DFA14_eot = DFA.unpackEncodedString(DFA14_eotS);
static final short[] DFA14_eof = DFA.unpackEncodedString(DFA14_eofS);
static final char[] DFA14_min = DFA.unpackEncodedStringToUnsignedChars(DFA14_minS);
static final char[] DFA14_max = DFA.unpackEncodedStringToUnsignedChars(DFA14_maxS);
static final short[] DFA14_accept = DFA.unpackEncodedString(DFA14_acceptS);
static final short[] DFA14_special = DFA.unpackEncodedString(DFA14_specialS);
static final short[][] DFA14_transition;
static {
int numStates = DFA13_transitionS.length;
DFA13_transition = new short[numStates][];
int numStates = DFA14_transitionS.length;
DFA14_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
DFA13_transition[i] = DFA.unpackEncodedString(DFA13_transitionS[i]);
DFA14_transition[i] = DFA.unpackEncodedString(DFA14_transitionS[i]);
}
}
class DFA13 extends DFA {
class DFA14 extends DFA {
public DFA13(BaseRecognizer recognizer) {
public DFA14(BaseRecognizer recognizer) {
this.recognizer = recognizer;
this.decisionNumber = 13;
this.eot = DFA13_eot;
this.eof = DFA13_eof;
this.min = DFA13_min;
this.max = DFA13_max;
this.accept = DFA13_accept;
this.special = DFA13_special;
this.transition = DFA13_transition;
this.decisionNumber = 14;
this.eot = DFA14_eot;
this.eof = DFA14_eof;
this.min = DFA14_min;
this.max = DFA14_max;
this.accept = DFA14_accept;
this.special = DFA14_special;
this.transition = DFA14_transition;
}
public String getDescription() {
return "1:1: Tokens : ( T13 | T14 | T15 | T16 | T17 | RULE_LUA_CODE | RULE_MACRO | RULE_DEFINE | RULE_TEXTDOMAIN | RULE_SL_COMMENT | RULE_ID | RULE_STRING | RULE_WS | RULE_ANY_OTHER );";
return "1:1: Tokens : ( T14 | T15 | T16 | T17 | T18 | RULE_LUA_CODE | RULE_MACRO | RULE_DEFINE | RULE_TEXTDOMAIN | RULE_STRING | RULE_ID | RULE_EOL | RULE_WS | RULE_ANY_OTHER | RULE_SL_COMMENT );";
}
}

View file

@ -7,37 +7,40 @@ package org.wesnoth.parser.antlr.internal;
import org.eclipse.xtext.parser.antlr.Lexer;
}
T13 : '[' ;
T14 : '+' ;
T15 : ']' ;
T16 : '[/' ;
T17 : '=' ;
T14 : '[' ;
T15 : '+' ;
T16 : ']' ;
T17 : '[/' ;
T18 : '=' ;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 855
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 939
RULE_LUA_CODE : '<<' ( options {greedy=false;} : . )*'>>';
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 857
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 941
RULE_MACRO : '{' ( options {greedy=false;} : . )*'}';
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 859
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 943
RULE_DEFINE : '#define' ( options {greedy=false;} : . )*'#enddef';
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 861
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 945
RULE_TEXTDOMAIN : '#textdomain' ~(('\n'|'\r'))* ('\r'? '\n')?;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 863
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 865
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 867
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 947
RULE_STRING : '"' ('\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')|~(('\\'|'"')))* '"';
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 869
RULE_WS : (' '|'\t'|'\r'|'\n')+;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 949
RULE_ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 871
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 951
RULE_EOL : ('\r'|'\n')+;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 953
RULE_WS : (' '|'\t')+;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 955
RULE_ANY_OTHER : .;
// $ANTLR src "../org.wesnoth.wml/src-gen/org/wesnoth/parser/antlr/internal/InternalWML.g" 957
RULE_SL_COMMENT : '#' ~(('\n'|'\r'))* ('\r'? '\n')?;

View file

@ -32,6 +32,7 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
////handles TODO:
//// - arrays [ ]
//// - preprocessor commands: #define, #enddef, etc
//// - fix: { { } }
//WMLRoot:
// (Tags+=WMLTag | MacroCalls+=WMLMacroCall | MacroDefines+=WMLMacroDefine | Textdomains+=WMLTextdomain)*;
public ParserRule getRule() { return rule; }
@ -172,13 +173,16 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
private final RuleCall cNameIDTerminalRuleCall_0_0 = (RuleCall)cNameAssignment_0.eContents().get(0);
private final Keyword cEqualsSignKeyword_1 = (Keyword)cGroup.eContents().get(1);
private final Assignment cValueAssignment_2 = (Assignment)cGroup.eContents().get(2);
private final RuleCall cValueWMLKeyValueRuleParserRuleCall_2_0 = (RuleCall)cValueAssignment_2.eContents().get(0);
private final RuleCall cValueWMLKeyValueParserRuleCall_2_0 = (RuleCall)cValueAssignment_2.eContents().get(0);
private final Alternatives cAlternatives_3 = (Alternatives)cGroup.eContents().get(3);
private final RuleCall cEOLTerminalRuleCall_3_0 = (RuleCall)cAlternatives_3.eContents().get(0);
private final RuleCall cSL_COMMENTTerminalRuleCall_3_1 = (RuleCall)cAlternatives_3.eContents().get(1);
//WMLKey:
// name=ID "=" value+=WMLKeyValueRule+;
//WMLKey hidden(WS):
// name=ID "=" value+=WMLKeyValue+ (EOL | SL_COMMENT);
public ParserRule getRule() { return rule; }
//name=ID "=" value+=WMLKeyValueRule+
//name=ID "=" value+=WMLKeyValue+ (EOL | SL_COMMENT)
public Group getGroup() { return cGroup; }
//name=ID
@ -190,25 +194,35 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
//"="
public Keyword getEqualsSignKeyword_1() { return cEqualsSignKeyword_1; }
//value+=WMLKeyValueRule+
//value+=WMLKeyValue+
public Assignment getValueAssignment_2() { return cValueAssignment_2; }
//WMLKeyValueRule
public RuleCall getValueWMLKeyValueRuleParserRuleCall_2_0() { return cValueWMLKeyValueRuleParserRuleCall_2_0; }
//WMLKeyValue
public RuleCall getValueWMLKeyValueParserRuleCall_2_0() { return cValueWMLKeyValueParserRuleCall_2_0; }
//EOL | SL_COMMENT
public Alternatives getAlternatives_3() { return cAlternatives_3; }
//EOL
public RuleCall getEOLTerminalRuleCall_3_0() { return cEOLTerminalRuleCall_3_0; }
//SL_COMMENT
public RuleCall getSL_COMMENTTerminalRuleCall_3_1() { return cSL_COMMENTTerminalRuleCall_3_1; }
}
public class WMLKeyValueRuleElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WMLKeyValueRule");
public class WMLKeyValueElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WMLKeyValue");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall cWMLValueParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall cWMLMacroCallParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1);
private final RuleCall cWMLLuaCodeParserRuleCall_2 = (RuleCall)cAlternatives.eContents().get(2);
private final RuleCall cWMLArrayCallParserRuleCall_3 = (RuleCall)cAlternatives.eContents().get(3);
//WMLKeyValueRule:
// WMLValue | WMLMacroCall | WMLLuaCode;
//WMLKeyValue:
// WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall;
public ParserRule getRule() { return rule; }
//WMLValue | WMLMacroCall | WMLLuaCode
//WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall
public Alternatives getAlternatives() { return cAlternatives; }
//WMLValue
@ -219,6 +233,9 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
//WMLLuaCode
public RuleCall getWMLLuaCodeParserRuleCall_2() { return cWMLLuaCodeParserRuleCall_2; }
//WMLArrayCall
public RuleCall getWMLArrayCallParserRuleCall_3() { return cWMLArrayCallParserRuleCall_3; }
}
public class WMLMacroCallElements extends AbstractParserRuleElementFinder {
@ -253,6 +270,34 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
public RuleCall getValueLUA_CODETerminalRuleCall_0() { return cValueLUA_CODETerminalRuleCall_0; }
}
public class WMLArrayCallElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WMLArrayCall");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword cLeftSquareBracketKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final Assignment cValueAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final RuleCall cValueWMLValueParserRuleCall_1_0 = (RuleCall)cValueAssignment_1.eContents().get(0);
private final Keyword cRightSquareBracketKeyword_2 = (Keyword)cGroup.eContents().get(2);
//WMLArrayCall:
// "[" value+=WMLValue+ "]";
public ParserRule getRule() { return rule; }
//"[" value+=WMLValue+ "]"
public Group getGroup() { return cGroup; }
//"["
public Keyword getLeftSquareBracketKeyword_0() { return cLeftSquareBracketKeyword_0; }
//value+=WMLValue+
public Assignment getValueAssignment_1() { return cValueAssignment_1; }
//WMLValue
public RuleCall getValueWMLValueParserRuleCall_1_0() { return cValueWMLValueParserRuleCall_1_0; }
//"]"
public Keyword getRightSquareBracketKeyword_2() { return cRightSquareBracketKeyword_2; }
}
public class WMLMacroDefineElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WMLMacroDefine");
private final Assignment cNameAssignment = (Assignment)rule.eContents().get(1);
@ -328,9 +373,10 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
private WMLRootElements pWMLRoot;
private WMLTagElements pWMLTag;
private WMLKeyElements pWMLKey;
private WMLKeyValueRuleElements pWMLKeyValueRule;
private WMLKeyValueElements pWMLKeyValue;
private WMLMacroCallElements pWMLMacroCall;
private WMLLuaCodeElements pWMLLuaCode;
private WMLArrayCallElements pWMLArrayCall;
private WMLMacroDefineElements pWMLMacroDefine;
private WMLTextdomainElements pWMLTextdomain;
private WMLValueElements pWMLValue;
@ -338,11 +384,12 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
private TerminalRule tMACRO;
private TerminalRule tDEFINE;
private TerminalRule tTEXTDOMAIN;
private TerminalRule tSL_COMMENT;
private TerminalRule tID;
private TerminalRule tSTRING;
private TerminalRule tID;
private TerminalRule tEOL;
private TerminalRule tWS;
private TerminalRule tANY_OTHER;
private TerminalRule tSL_COMMENT;
private final GrammarProvider grammarProvider;
@ -361,6 +408,7 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
////handles TODO:
//// - arrays [ ]
//// - preprocessor commands: #define, #enddef, etc
//// - fix: { { } }
//WMLRoot:
// (Tags+=WMLTag | MacroCalls+=WMLMacroCall | MacroDefines+=WMLMacroDefine | Textdomains+=WMLTextdomain)*;
public WMLRootElements getWMLRootAccess() {
@ -382,8 +430,8 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
return getWMLTagAccess().getRule();
}
//WMLKey:
// name=ID "=" value+=WMLKeyValueRule+;
//WMLKey hidden(WS):
// name=ID "=" value+=WMLKeyValue+ (EOL | SL_COMMENT);
public WMLKeyElements getWMLKeyAccess() {
return (pWMLKey != null) ? pWMLKey : (pWMLKey = new WMLKeyElements());
}
@ -392,14 +440,14 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
return getWMLKeyAccess().getRule();
}
//WMLKeyValueRule:
// WMLValue | WMLMacroCall | WMLLuaCode;
public WMLKeyValueRuleElements getWMLKeyValueRuleAccess() {
return (pWMLKeyValueRule != null) ? pWMLKeyValueRule : (pWMLKeyValueRule = new WMLKeyValueRuleElements());
//WMLKeyValue:
// WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall;
public WMLKeyValueElements getWMLKeyValueAccess() {
return (pWMLKeyValue != null) ? pWMLKeyValue : (pWMLKeyValue = new WMLKeyValueElements());
}
public ParserRule getWMLKeyValueRuleRule() {
return getWMLKeyValueRuleAccess().getRule();
public ParserRule getWMLKeyValueRule() {
return getWMLKeyValueAccess().getRule();
}
//WMLMacroCall:
@ -422,6 +470,16 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
return getWMLLuaCodeAccess().getRule();
}
//WMLArrayCall:
// "[" value+=WMLValue+ "]";
public WMLArrayCallElements getWMLArrayCallAccess() {
return (pWMLArrayCall != null) ? pWMLArrayCall : (pWMLArrayCall = new WMLArrayCallElements());
}
public ParserRule getWMLArrayCallRule() {
return getWMLArrayCallAccess().getRule();
}
//WMLMacroDefine:
// name=DEFINE;
public WMLMacroDefineElements getWMLMacroDefineAccess() {
@ -485,10 +543,10 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
return (tTEXTDOMAIN != null) ? tTEXTDOMAIN : (tTEXTDOMAIN = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "TEXTDOMAIN"));
}
//terminal SL_COMMENT:
// "#" !("\n" | "\r")* ("\r"? "\n")?;
public TerminalRule getSL_COMMENTRule() {
return (tSL_COMMENT != null) ? tSL_COMMENT : (tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
//terminal STRING:
// "\"" ("\\" ("b" | "t" | "n" | "f" | "r" | "\"" | "\'" | "\\") | !("\\" | "\""))* "\"";
public TerminalRule getSTRINGRule() {
return (tSTRING != null) ? tSTRING : (tSTRING = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
}
//terminal ID:
@ -497,14 +555,14 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
return (tID != null) ? tID : (tID = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
}
//terminal STRING:
// "\"" ("\\" ("b" | "t" | "n" | "f" | "r" | "\"" | "\'" | "\\") | !("\\" | "\""))* "\"";
public TerminalRule getSTRINGRule() {
return (tSTRING != null) ? tSTRING : (tSTRING = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
//terminal EOL:
// ("\r" | "\n")+;
public TerminalRule getEOLRule() {
return (tEOL != null) ? tEOL : (tEOL = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "EOL"));
}
//terminal WS:
// (" " | "\t" | "\r" | "\n")+;
// (" " | "\t")+;
public TerminalRule getWSRule() {
return (tWS != null) ? tWS : (tWS = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
}
@ -514,4 +572,10 @@ public class WMLGrammarAccess extends AbstractGrammarElementFinder {
public TerminalRule getANY_OTHERRule() {
return (tANY_OTHER != null) ? tANY_OTHER : (tANY_OTHER = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
}
//terminal SL_COMMENT:
// "#" !("\n" | "\r")* ("\r"? "\n")?;
public TerminalRule getSL_COMMENTRule() {
return (tSL_COMMENT != null) ? tSL_COMMENT : (tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
}
}

View file

@ -54,13 +54,13 @@ public interface WMLFactory extends EFactory
WMLKey createWMLKey();
/**
* Returns a new object of class '<em>Key Value Rule</em>'.
* Returns a new object of class '<em>Key Value</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Key Value Rule</em>'.
* @return a new object of class '<em>Key Value</em>'.
* @generated
*/
WMLKeyValueRule createWMLKeyValueRule();
WMLKeyValue createWMLKeyValue();
/**
* Returns a new object of class '<em>Macro Call</em>'.
@ -80,6 +80,15 @@ public interface WMLFactory extends EFactory
*/
WMLLuaCode createWMLLuaCode();
/**
* Returns a new object of class '<em>Array Call</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Array Call</em>'.
* @generated
*/
WMLArrayCall createWMLArrayCall();
/**
* Returns a new object of class '<em>Macro Define</em>'.
* <!-- begin-user-doc -->

View file

@ -57,7 +57,7 @@ public interface WMLKey extends EObject
/**
* Returns the value of the '<em><b>Value</b></em>' containment reference list.
* The list contents are of type {@link org.wesnoth.wML.WMLKeyValueRule}.
* The list contents are of type {@link org.wesnoth.wML.WMLKeyValue}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Value</em>' containment reference list isn't clear,
@ -69,6 +69,6 @@ public interface WMLKey extends EObject
* @model containment="true"
* @generated
*/
EList<WMLKeyValueRule> getValue();
EList<WMLKeyValue> getValue();
} // WMLKey

View file

@ -1,23 +0,0 @@
/**
* <copyright>
* </copyright>
*
*/
package org.wesnoth.wML;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Key Value Rule</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.wesnoth.wML.WMLPackage#getWMLKeyValueRule()
* @model
* @generated
*/
public interface WMLKeyValueRule extends EObject
{
} // WMLKeyValueRule

View file

@ -23,7 +23,7 @@ package org.wesnoth.wML;
* @model
* @generated
*/
public interface WMLLuaCode extends WMLKeyValueRule
public interface WMLLuaCode extends WMLKeyValue
{
/**
* Returns the value of the '<em><b>Value</b></em>' attribute.

View file

@ -244,23 +244,23 @@ public interface WMLPackage extends EPackage
int WML_KEY_FEATURE_COUNT = 2;
/**
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLKeyValueRuleImpl <em>Key Value Rule</em>}' class.
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLKeyValueImpl <em>Key Value</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.wesnoth.wML.impl.WMLKeyValueRuleImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLKeyValueRule()
* @see org.wesnoth.wML.impl.WMLKeyValueImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLKeyValue()
* @generated
*/
int WML_KEY_VALUE_RULE = 3;
int WML_KEY_VALUE = 3;
/**
* The number of structural features of the '<em>Key Value Rule</em>' class.
* The number of structural features of the '<em>Key Value</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int WML_KEY_VALUE_RULE_FEATURE_COUNT = 0;
int WML_KEY_VALUE_FEATURE_COUNT = 0;
/**
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLMacroCallImpl <em>Macro Call</em>}' class.
@ -279,7 +279,7 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_MACRO_CALL__NAME = WML_KEY_VALUE_RULE_FEATURE_COUNT + 0;
int WML_MACRO_CALL__NAME = WML_KEY_VALUE_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Macro Call</em>' class.
@ -288,7 +288,7 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_MACRO_CALL_FEATURE_COUNT = WML_KEY_VALUE_RULE_FEATURE_COUNT + 1;
int WML_MACRO_CALL_FEATURE_COUNT = WML_KEY_VALUE_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLLuaCodeImpl <em>Lua Code</em>}' class.
@ -307,7 +307,7 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_LUA_CODE__VALUE = WML_KEY_VALUE_RULE_FEATURE_COUNT + 0;
int WML_LUA_CODE__VALUE = WML_KEY_VALUE_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Lua Code</em>' class.
@ -316,7 +316,35 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_LUA_CODE_FEATURE_COUNT = WML_KEY_VALUE_RULE_FEATURE_COUNT + 1;
int WML_LUA_CODE_FEATURE_COUNT = WML_KEY_VALUE_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLArrayCallImpl <em>Array Call</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.wesnoth.wML.impl.WMLArrayCallImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLArrayCall()
* @generated
*/
int WML_ARRAY_CALL = 6;
/**
* The feature id for the '<em><b>Value</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int WML_ARRAY_CALL__VALUE = WML_KEY_VALUE_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Array Call</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int WML_ARRAY_CALL_FEATURE_COUNT = WML_KEY_VALUE_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link org.wesnoth.wML.impl.WMLMacroDefineImpl <em>Macro Define</em>}' class.
@ -326,7 +354,7 @@ public interface WMLPackage extends EPackage
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLMacroDefine()
* @generated
*/
int WML_MACRO_DEFINE = 6;
int WML_MACRO_DEFINE = 7;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@ -354,7 +382,7 @@ public interface WMLPackage extends EPackage
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLTextdomain()
* @generated
*/
int WML_TEXTDOMAIN = 7;
int WML_TEXTDOMAIN = 8;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@ -382,7 +410,7 @@ public interface WMLPackage extends EPackage
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLValue()
* @generated
*/
int WML_VALUE = 8;
int WML_VALUE = 9;
/**
* The feature id for the '<em><b>Value</b></em>' attribute.
@ -391,7 +419,7 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_VALUE__VALUE = WML_KEY_VALUE_RULE_FEATURE_COUNT + 0;
int WML_VALUE__VALUE = WML_KEY_VALUE_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Value</em>' class.
@ -400,7 +428,7 @@ public interface WMLPackage extends EPackage
* @generated
* @ordered
*/
int WML_VALUE_FEATURE_COUNT = WML_KEY_VALUE_RULE_FEATURE_COUNT + 1;
int WML_VALUE_FEATURE_COUNT = WML_KEY_VALUE_FEATURE_COUNT + 1;
/**
@ -588,14 +616,14 @@ public interface WMLPackage extends EPackage
EReference getWMLKey_Value();
/**
* Returns the meta object for class '{@link org.wesnoth.wML.WMLKeyValueRule <em>Key Value Rule</em>}'.
* Returns the meta object for class '{@link org.wesnoth.wML.WMLKeyValue <em>Key Value</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Key Value Rule</em>'.
* @see org.wesnoth.wML.WMLKeyValueRule
* @return the meta object for class '<em>Key Value</em>'.
* @see org.wesnoth.wML.WMLKeyValue
* @generated
*/
EClass getWMLKeyValueRule();
EClass getWMLKeyValue();
/**
* Returns the meta object for class '{@link org.wesnoth.wML.WMLMacroCall <em>Macro Call</em>}'.
@ -639,6 +667,27 @@ public interface WMLPackage extends EPackage
*/
EAttribute getWMLLuaCode_Value();
/**
* Returns the meta object for class '{@link org.wesnoth.wML.WMLArrayCall <em>Array Call</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Array Call</em>'.
* @see org.wesnoth.wML.WMLArrayCall
* @generated
*/
EClass getWMLArrayCall();
/**
* Returns the meta object for the containment reference list '{@link org.wesnoth.wML.WMLArrayCall#getValue <em>Value</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Value</em>'.
* @see org.wesnoth.wML.WMLArrayCall#getValue()
* @see #getWMLArrayCall()
* @generated
*/
EReference getWMLArrayCall_Value();
/**
* Returns the meta object for class '{@link org.wesnoth.wML.WMLMacroDefine <em>Macro Define</em>}'.
* <!-- begin-user-doc -->
@ -868,14 +917,14 @@ public interface WMLPackage extends EPackage
EReference WML_KEY__VALUE = eINSTANCE.getWMLKey_Value();
/**
* The meta object literal for the '{@link org.wesnoth.wML.impl.WMLKeyValueRuleImpl <em>Key Value Rule</em>}' class.
* The meta object literal for the '{@link org.wesnoth.wML.impl.WMLKeyValueImpl <em>Key Value</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.wesnoth.wML.impl.WMLKeyValueRuleImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLKeyValueRule()
* @see org.wesnoth.wML.impl.WMLKeyValueImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLKeyValue()
* @generated
*/
EClass WML_KEY_VALUE_RULE = eINSTANCE.getWMLKeyValueRule();
EClass WML_KEY_VALUE = eINSTANCE.getWMLKeyValue();
/**
* The meta object literal for the '{@link org.wesnoth.wML.impl.WMLMacroCallImpl <em>Macro Call</em>}' class.
@ -913,6 +962,24 @@ public interface WMLPackage extends EPackage
*/
EAttribute WML_LUA_CODE__VALUE = eINSTANCE.getWMLLuaCode_Value();
/**
* The meta object literal for the '{@link org.wesnoth.wML.impl.WMLArrayCallImpl <em>Array Call</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.wesnoth.wML.impl.WMLArrayCallImpl
* @see org.wesnoth.wML.impl.WMLPackageImpl#getWMLArrayCall()
* @generated
*/
EClass WML_ARRAY_CALL = eINSTANCE.getWMLArrayCall();
/**
* The meta object literal for the '<em><b>Value</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference WML_ARRAY_CALL__VALUE = eINSTANCE.getWMLArrayCall_Value();
/**
* The meta object literal for the '{@link org.wesnoth.wML.impl.WMLMacroDefineImpl <em>Macro Define</em>}' class.
* <!-- begin-user-doc -->

View file

@ -71,9 +71,10 @@ public class WMLFactoryImpl extends EFactoryImpl implements WMLFactory
case WMLPackage.WML_ROOT: return createWMLRoot();
case WMLPackage.WML_TAG: return createWMLTag();
case WMLPackage.WML_KEY: return createWMLKey();
case WMLPackage.WML_KEY_VALUE_RULE: return createWMLKeyValueRule();
case WMLPackage.WML_KEY_VALUE: return createWMLKeyValue();
case WMLPackage.WML_MACRO_CALL: return createWMLMacroCall();
case WMLPackage.WML_LUA_CODE: return createWMLLuaCode();
case WMLPackage.WML_ARRAY_CALL: return createWMLArrayCall();
case WMLPackage.WML_MACRO_DEFINE: return createWMLMacroDefine();
case WMLPackage.WML_TEXTDOMAIN: return createWMLTextdomain();
case WMLPackage.WML_VALUE: return createWMLValue();
@ -120,10 +121,10 @@ public class WMLFactoryImpl extends EFactoryImpl implements WMLFactory
* <!-- end-user-doc -->
* @generated
*/
public WMLKeyValueRule createWMLKeyValueRule()
public WMLKeyValue createWMLKeyValue()
{
WMLKeyValueRuleImpl wmlKeyValueRule = new WMLKeyValueRuleImpl();
return wmlKeyValueRule;
WMLKeyValueImpl wmlKeyValue = new WMLKeyValueImpl();
return wmlKeyValue;
}
/**
@ -148,6 +149,17 @@ public class WMLFactoryImpl extends EFactoryImpl implements WMLFactory
return wmlLuaCode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public WMLArrayCall createWMLArrayCall()
{
WMLArrayCallImpl wmlArrayCall = new WMLArrayCallImpl();
return wmlArrayCall;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->

View file

@ -23,7 +23,7 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.wesnoth.wML.WMLKey;
import org.wesnoth.wML.WMLKeyValueRule;
import org.wesnoth.wML.WMLKeyValue;
import org.wesnoth.wML.WMLPackage;
/**
@ -70,7 +70,7 @@ public class WMLKeyImpl extends MinimalEObjectImpl.Container implements WMLKey
* @generated
* @ordered
*/
protected EList<WMLKeyValueRule> value;
protected EList<WMLKeyValue> value;
/**
* <!-- begin-user-doc -->
@ -121,11 +121,11 @@ public class WMLKeyImpl extends MinimalEObjectImpl.Container implements WMLKey
* <!-- end-user-doc -->
* @generated
*/
public EList<WMLKeyValueRule> getValue()
public EList<WMLKeyValue> getValue()
{
if (value == null)
{
value = new EObjectContainmentEList<WMLKeyValueRule>(WMLKeyValueRule.class, this, WMLPackage.WML_KEY__VALUE);
value = new EObjectContainmentEList<WMLKeyValue>(WMLKeyValue.class, this, WMLPackage.WML_KEY__VALUE);
}
return value;
}
@ -180,7 +180,7 @@ public class WMLKeyImpl extends MinimalEObjectImpl.Container implements WMLKey
return;
case WMLPackage.WML_KEY__VALUE:
getValue().clear();
getValue().addAll((Collection<? extends WMLKeyValueRule>)newValue);
getValue().addAll((Collection<? extends WMLKeyValue>)newValue);
return;
}
super.eSet(featureID, newValue);

View file

@ -1,48 +0,0 @@
/**
* <copyright>
* </copyright>
*
*/
package org.wesnoth.wML.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.wesnoth.wML.WMLKeyValueRule;
import org.wesnoth.wML.WMLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Key Value Rule</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class WMLKeyValueRuleImpl extends MinimalEObjectImpl.Container implements WMLKeyValueRule
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected WMLKeyValueRuleImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return WMLPackage.Literals.WML_KEY_VALUE_RULE;
}
} //WMLKeyValueRuleImpl

View file

@ -28,7 +28,7 @@ import org.wesnoth.wML.WMLPackage;
*
* @generated
*/
public class WMLLuaCodeImpl extends WMLKeyValueRuleImpl implements WMLLuaCode
public class WMLLuaCodeImpl extends WMLKeyValueImpl implements WMLLuaCode
{
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.

View file

@ -13,9 +13,10 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.wesnoth.wML.WMLArrayCall;
import org.wesnoth.wML.WMLFactory;
import org.wesnoth.wML.WMLKey;
import org.wesnoth.wML.WMLKeyValueRule;
import org.wesnoth.wML.WMLKeyValue;
import org.wesnoth.wML.WMLLuaCode;
import org.wesnoth.wML.WMLMacroCall;
import org.wesnoth.wML.WMLMacroDefine;
@ -59,7 +60,7 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
* <!-- end-user-doc -->
* @generated
*/
private EClass wmlKeyValueRuleEClass = null;
private EClass wmlKeyValueEClass = null;
/**
* <!-- begin-user-doc -->
@ -75,6 +76,13 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
*/
private EClass wmlLuaCodeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass wmlArrayCallEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -334,9 +342,9 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
* <!-- end-user-doc -->
* @generated
*/
public EClass getWMLKeyValueRule()
public EClass getWMLKeyValue()
{
return wmlKeyValueRuleEClass;
return wmlKeyValueEClass;
}
/**
@ -379,6 +387,26 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
return (EAttribute)wmlLuaCodeEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getWMLArrayCall()
{
return wmlArrayCallEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getWMLArrayCall_Value()
{
return (EReference)wmlArrayCallEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -489,7 +517,7 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
createEAttribute(wmlKeyEClass, WML_KEY__NAME);
createEReference(wmlKeyEClass, WML_KEY__VALUE);
wmlKeyValueRuleEClass = createEClass(WML_KEY_VALUE_RULE);
wmlKeyValueEClass = createEClass(WML_KEY_VALUE);
wmlMacroCallEClass = createEClass(WML_MACRO_CALL);
createEAttribute(wmlMacroCallEClass, WML_MACRO_CALL__NAME);
@ -497,6 +525,9 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
wmlLuaCodeEClass = createEClass(WML_LUA_CODE);
createEAttribute(wmlLuaCodeEClass, WML_LUA_CODE__VALUE);
wmlArrayCallEClass = createEClass(WML_ARRAY_CALL);
createEReference(wmlArrayCallEClass, WML_ARRAY_CALL__VALUE);
wmlMacroDefineEClass = createEClass(WML_MACRO_DEFINE);
createEAttribute(wmlMacroDefineEClass, WML_MACRO_DEFINE__NAME);
@ -536,9 +567,10 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
// Set bounds for type parameters
// Add supertypes to classes
wmlMacroCallEClass.getESuperTypes().add(this.getWMLKeyValueRule());
wmlLuaCodeEClass.getESuperTypes().add(this.getWMLKeyValueRule());
wmlValueEClass.getESuperTypes().add(this.getWMLKeyValueRule());
wmlMacroCallEClass.getESuperTypes().add(this.getWMLKeyValue());
wmlLuaCodeEClass.getESuperTypes().add(this.getWMLKeyValue());
wmlArrayCallEClass.getESuperTypes().add(this.getWMLKeyValue());
wmlValueEClass.getESuperTypes().add(this.getWMLKeyValue());
// Initialize classes and features; add operations and parameters
initEClass(wmlRootEClass, WMLRoot.class, "WMLRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@ -559,9 +591,9 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
initEClass(wmlKeyEClass, WMLKey.class, "WMLKey", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLKey_Name(), ecorePackage.getEString(), "name", null, 0, 1, WMLKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLKey_Value(), this.getWMLKeyValueRule(), null, "value", null, 0, -1, WMLKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLKey_Value(), this.getWMLKeyValue(), null, "value", null, 0, -1, WMLKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlKeyValueRuleEClass, WMLKeyValueRule.class, "WMLKeyValueRule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
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_Name(), ecorePackage.getEString(), "name", null, 0, 1, WMLMacroCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@ -569,6 +601,9 @@ public class WMLPackageImpl extends EPackageImpl implements WMLPackage
initEClass(wmlLuaCodeEClass, WMLLuaCode.class, "WMLLuaCode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLLuaCode_Value(), ecorePackage.getEString(), "value", null, 0, 1, WMLLuaCode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlArrayCallEClass, WMLArrayCall.class, "WMLArrayCall", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getWMLArrayCall_Value(), this.getWMLValue(), null, "value", null, 0, -1, WMLArrayCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlMacroDefineEClass, WMLMacroDefine.class, "WMLMacroDefine", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLMacroDefine_Name(), ecorePackage.getEString(), "name", null, 0, 1, WMLMacroDefine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

View file

@ -94,9 +94,9 @@ public class WMLAdapterFactory extends AdapterFactoryImpl
return createWMLKeyAdapter();
}
@Override
public Adapter caseWMLKeyValueRule(WMLKeyValueRule object)
public Adapter caseWMLKeyValue(WMLKeyValue object)
{
return createWMLKeyValueRuleAdapter();
return createWMLKeyValueAdapter();
}
@Override
public Adapter caseWMLMacroCall(WMLMacroCall object)
@ -109,6 +109,11 @@ public class WMLAdapterFactory extends AdapterFactoryImpl
return createWMLLuaCodeAdapter();
}
@Override
public Adapter caseWMLArrayCall(WMLArrayCall object)
{
return createWMLArrayCallAdapter();
}
@Override
public Adapter caseWMLMacroDefine(WMLMacroDefine object)
{
return createWMLMacroDefineAdapter();
@ -191,16 +196,16 @@ public class WMLAdapterFactory extends AdapterFactoryImpl
}
/**
* Creates a new adapter for an object of class '{@link org.wesnoth.wML.WMLKeyValueRule <em>Key Value Rule</em>}'.
* Creates a new adapter for an object of class '{@link org.wesnoth.wML.WMLKeyValue <em>Key Value</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.wesnoth.wML.WMLKeyValueRule
* @see org.wesnoth.wML.WMLKeyValue
* @generated
*/
public Adapter createWMLKeyValueRuleAdapter()
public Adapter createWMLKeyValueAdapter()
{
return null;
}
@ -235,6 +240,21 @@ public class WMLAdapterFactory extends AdapterFactoryImpl
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.wesnoth.wML.WMLArrayCall <em>Array Call</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.wesnoth.wML.WMLArrayCall
* @generated
*/
public Adapter createWMLArrayCallAdapter()
{
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.wesnoth.wML.WMLMacroDefine <em>Macro Define</em>}'.
* <!-- begin-user-doc -->

View file

@ -117,10 +117,10 @@ public class WMLSwitch<T>
if (result == null) result = defaultCase(theEObject);
return result;
}
case WMLPackage.WML_KEY_VALUE_RULE:
case WMLPackage.WML_KEY_VALUE:
{
WMLKeyValueRule wmlKeyValueRule = (WMLKeyValueRule)theEObject;
T result = caseWMLKeyValueRule(wmlKeyValueRule);
WMLKeyValue wmlKeyValue = (WMLKeyValue)theEObject;
T result = caseWMLKeyValue(wmlKeyValue);
if (result == null) result = defaultCase(theEObject);
return result;
}
@ -128,7 +128,7 @@ public class WMLSwitch<T>
{
WMLMacroCall wmlMacroCall = (WMLMacroCall)theEObject;
T result = caseWMLMacroCall(wmlMacroCall);
if (result == null) result = caseWMLKeyValueRule(wmlMacroCall);
if (result == null) result = caseWMLKeyValue(wmlMacroCall);
if (result == null) result = defaultCase(theEObject);
return result;
}
@ -136,7 +136,15 @@ public class WMLSwitch<T>
{
WMLLuaCode wmlLuaCode = (WMLLuaCode)theEObject;
T result = caseWMLLuaCode(wmlLuaCode);
if (result == null) result = caseWMLKeyValueRule(wmlLuaCode);
if (result == null) result = caseWMLKeyValue(wmlLuaCode);
if (result == null) result = defaultCase(theEObject);
return result;
}
case WMLPackage.WML_ARRAY_CALL:
{
WMLArrayCall wmlArrayCall = (WMLArrayCall)theEObject;
T result = caseWMLArrayCall(wmlArrayCall);
if (result == null) result = caseWMLKeyValue(wmlArrayCall);
if (result == null) result = defaultCase(theEObject);
return result;
}
@ -158,7 +166,7 @@ public class WMLSwitch<T>
{
WMLValue wmlValue = (WMLValue)theEObject;
T result = caseWMLValue(wmlValue);
if (result == null) result = caseWMLKeyValueRule(wmlValue);
if (result == null) result = caseWMLKeyValue(wmlValue);
if (result == null) result = defaultCase(theEObject);
return result;
}
@ -215,17 +223,17 @@ public class WMLSwitch<T>
}
/**
* Returns the result of interpreting the object as an instance of '<em>Key Value Rule</em>'.
* Returns the result of interpreting the object as an instance of '<em>Key Value</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Key Value Rule</em>'.
* @return the result of interpreting the object as an instance of '<em>Key Value</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWMLKeyValueRule(WMLKeyValueRule object)
public T caseWMLKeyValue(WMLKeyValue object)
{
return null;
}
@ -262,6 +270,22 @@ public class WMLSwitch<T>
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Array Call</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Array Call</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseWMLArrayCall(WMLArrayCall object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Macro Define</em>'.
* <!-- begin-user-doc -->

View file

@ -2,13 +2,12 @@
* @author Timotei Dolean
*/
//grammar org.wesnoth.WML with org.eclipse.xtext.common.Terminals
grammar org.wesnoth.WML hidden(WS, SL_COMMENT)
grammar org.wesnoth.WML hidden(EOL, WS, SL_COMMENT)
generate wML "http://www.wesnoth.org/WML"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
//TODO: add cross-reference for variables
//handles TODO:
// - arrays [ ]
// - preprocessor commands: #define, #enddef, etc
// - fix: { { } }
@ -31,19 +30,19 @@ WMLTag:
'[/' endName = ID ']'
;
WMLKey:
(name = ID) '='
value += WMLKeyValueRule+;
WMLKey hidden(WS):
(name = ID) '=' value += WMLKeyValue+ (EOL|SL_COMMENT);
WMLKeyValueRule:
WMLValue | WMLMacroCall | WMLLuaCode;
WMLKeyValue:
WMLValue | WMLMacroCall | WMLLuaCode | WMLArrayCall;
WMLMacroCall:
name = MACRO;
WMLLuaCode:
value = LUA_CODE;
WMLArrayCall:
'[' value += WMLValue+ ']' ;
WMLMacroDefine:
name = DEFINE;
// ( Tags += WMLTag
@ -65,8 +64,9 @@ terminal MACRO : '{' -> '}';
terminal DEFINE : '#define' -> '#enddef';//!('\n'|'\r')* ('\r'? '\n')?;
//terminal ENDDEF : '#enddef' !('\n'|'\r')* ('\r'? '\n')?;
terminal TEXTDOMAIN : '#textdomain' !('\n'|'\r')* ('\r'? '\n')?;
terminal SL_COMMENT : '#' !('\n'|'\r')* ('\r'? '\n')?;
terminal ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
terminal STRING : '"' ( '\\' ('b'|'t'|'n'|'f'|'r'|'"'|"'"|'\\') | !('\\'|'"') )* '"';
terminal WS : (' '|'\t'|'\r'|'\n')+;
terminal ID : ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|',')+;
terminal EOL : ('\r'|'\n')+;
terminal WS : (' '|'\t')+;
terminal ANY_OTHER : .;
terminal SL_COMMENT : '#' !('\n'|'\r')* ('\r'? '\n')?;

View file

@ -8,9 +8,15 @@
*******************************************************************************/
package org.wesnoth;
import org.eclipse.xtext.parser.antlr.Lexer;
/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
*/
public class WMLRuntimeModule extends org.wesnoth.AbstractWMLRuntimeModule {
@Override
public Class<? extends Lexer> bindLexer()
{
return WMLLexer.class;
}
}