added java actions to ecore model and grammar

This commit is contained in:
overflowerror 2021-11-19 14:42:04 +01:00
parent e2737eed25
commit f2e581d026
25 changed files with 5156 additions and 4276 deletions

View file

@ -28,6 +28,7 @@ import org.eclipse.xtext.EnumRule;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.JavaAction;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
@ -1399,6 +1400,8 @@ public class AntlrContentAssistGrammarGenerator extends AbstractAntlrGrammarWith
return _ebnf2((Assignment)it, options, supportActions);
} else if (it instanceof EnumLiteralDeclaration) {
return _ebnf2((EnumLiteralDeclaration)it, options, supportActions);
} else if (it instanceof JavaAction) {
return _ebnf2((JavaAction)it, options, supportActions);
} else if (it instanceof Keyword) {
return _ebnf2((Keyword)it, options, supportActions);
} else if (it instanceof RuleCall) {

View file

@ -182,6 +182,7 @@ public class XtextParser extends AbstractContentAssistParser {
builder.put(grammarAccess.getUnorderedGroupAccess().getElementsAssignment_1_1_1(), "rule__UnorderedGroup__ElementsAssignment_1_1_1");
builder.put(grammarAccess.getGroupAccess().getElementsAssignment_1_1(), "rule__Group__ElementsAssignment_1_1");
builder.put(grammarAccess.getGatedSemanticPredicateAccess().getCodeAssignment_0(), "rule__GatedSemanticPredicate__CodeAssignment_0");
builder.put(grammarAccess.getJavaActionAccess().getCodeAssignment(), "rule__JavaAction__CodeAssignment");
builder.put(grammarAccess.getJavaCodeAccess().getSourceAssignment(), "rule__JavaCode__SourceAssignment");
builder.put(grammarAccess.getAbstractTokenWithCardinalityAccess().getCardinalityAssignment_1(), "rule__AbstractTokenWithCardinality__CardinalityAssignment_1");
builder.put(grammarAccess.getActionAccess().getTypeAssignment_1(), "rule__Action__TypeAssignment_1");

View file

@ -491,6 +491,31 @@ finally {
restoreStackSize(stackSize);
}
// Entry rule entryRuleJavaAction
entryRuleJavaAction
:
{ before(grammarAccess.getJavaActionRule()); }
ruleJavaAction
{ after(grammarAccess.getJavaActionRule()); }
EOF
;
// Rule JavaAction
ruleJavaAction
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getJavaActionAccess().getCodeAssignment()); }
(rule__JavaAction__CodeAssignment)
{ after(grammarAccess.getJavaActionAccess().getCodeAssignment()); }
)
;
finally {
restoreStackSize(stackSize);
}
// Entry rule entryRuleJavaCode
entryRuleJavaCode
:
@ -1670,9 +1695,15 @@ rule__AbstractToken__Alternatives
)
|
(
{ before(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_2()); }
{ before(grammarAccess.getAbstractTokenAccess().getJavaActionParserRuleCall_2()); }
ruleJavaAction
{ after(grammarAccess.getAbstractTokenAccess().getJavaActionParserRuleCall_2()); }
)
|
(
{ before(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_3()); }
ruleSemanticPredicate
{ after(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_2()); }
{ after(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_3()); }
)
;
finally {
@ -9157,6 +9188,21 @@ finally {
restoreStackSize(stackSize);
}
rule__JavaAction__CodeAssignment
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getJavaActionAccess().getCodeJavaCodeParserRuleCall_0()); }
ruleJavaCode
{ after(grammarAccess.getJavaActionAccess().getCodeJavaCodeParserRuleCall_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__JavaCode__SourceAssignment
@init {
int stackSize = keepStackSize();

View file

@ -922,12 +922,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_JAVACODESTRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10068:21: ( '$$' ( options {greedy=false; } : . )* '$$' )
// InternalXtext.g:10068:23: '$$' ( options {greedy=false; } : . )* '$$'
// InternalXtext.g:10114:21: ( '$$' ( options {greedy=false; } : . )* '$$' )
// InternalXtext.g:10114:23: '$$' ( options {greedy=false; } : . )* '$$'
{
match("$$");
// InternalXtext.g:10068:28: ( options {greedy=false; } : . )*
// InternalXtext.g:10114:28: ( options {greedy=false; } : . )*
loop1:
do {
int alt1=2;
@ -952,7 +952,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt1) {
case 1 :
// InternalXtext.g:10068:56: .
// InternalXtext.g:10114:56: .
{
matchAny();
@ -982,10 +982,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10070:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalXtext.g:10070:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalXtext.g:10116:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalXtext.g:10116:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// InternalXtext.g:10070:11: ( '^' )?
// InternalXtext.g:10116:11: ( '^' )?
int alt2=2;
int LA2_0 = input.LA(1);
@ -994,7 +994,7 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt2) {
case 1 :
// InternalXtext.g:10070:11: '^'
// InternalXtext.g:10116:11: '^'
{
match('^');
@ -1012,7 +1012,7 @@ public class InternalXtextLexer extends Lexer {
recover(mse);
throw mse;}
// InternalXtext.g:10070:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalXtext.g:10116:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
loop3:
do {
int alt3=2;
@ -1061,10 +1061,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10072:10: ( ( '0' .. '9' )+ )
// InternalXtext.g:10072:12: ( '0' .. '9' )+
// InternalXtext.g:10118:10: ( ( '0' .. '9' )+ )
// InternalXtext.g:10118:12: ( '0' .. '9' )+
{
// InternalXtext.g:10072:12: ( '0' .. '9' )+
// InternalXtext.g:10118:12: ( '0' .. '9' )+
int cnt4=0;
loop4:
do {
@ -1078,7 +1078,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt4) {
case 1 :
// InternalXtext.g:10072:13: '0' .. '9'
// InternalXtext.g:10118:13: '0' .. '9'
{
matchRange('0','9');
@ -1110,10 +1110,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10074:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalXtext.g:10074:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalXtext.g:10120:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalXtext.g:10120:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// InternalXtext.g:10074:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalXtext.g:10120:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt7=2;
int LA7_0 = input.LA(1);
@ -1131,10 +1131,10 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt7) {
case 1 :
// InternalXtext.g:10074:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
// InternalXtext.g:10120:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// InternalXtext.g:10074:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
// InternalXtext.g:10120:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
loop5:
do {
int alt5=3;
@ -1150,7 +1150,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt5) {
case 1 :
// InternalXtext.g:10074:21: '\\\\' .
// InternalXtext.g:10120:21: '\\\\' .
{
match('\\');
matchAny();
@ -1158,7 +1158,7 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:10074:28: ~ ( ( '\\\\' | '\"' ) )
// InternalXtext.g:10120:28: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -1183,10 +1183,10 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:10074:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
// InternalXtext.g:10120:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// InternalXtext.g:10074:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
// InternalXtext.g:10120:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
loop6:
do {
int alt6=3;
@ -1202,7 +1202,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt6) {
case 1 :
// InternalXtext.g:10074:54: '\\\\' .
// InternalXtext.g:10120:54: '\\\\' .
{
match('\\');
matchAny();
@ -1210,7 +1210,7 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:10074:61: ~ ( ( '\\\\' | '\\'' ) )
// InternalXtext.g:10120:61: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -1253,12 +1253,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10076:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalXtext.g:10076:19: '/*' ( options {greedy=false; } : . )* '*/'
// InternalXtext.g:10122:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalXtext.g:10122:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// InternalXtext.g:10076:24: ( options {greedy=false; } : . )*
// InternalXtext.g:10122:24: ( options {greedy=false; } : . )*
loop8:
do {
int alt8=2;
@ -1283,7 +1283,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt8) {
case 1 :
// InternalXtext.g:10076:52: .
// InternalXtext.g:10122:52: .
{
matchAny();
@ -1313,12 +1313,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10078:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:10078:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// InternalXtext.g:10124:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:10124:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalXtext.g:10078:24: (~ ( ( '\\n' | '\\r' ) ) )*
// InternalXtext.g:10124:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop9:
do {
int alt9=2;
@ -1331,7 +1331,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt9) {
case 1 :
// InternalXtext.g:10078:24: ~ ( ( '\\n' | '\\r' ) )
// InternalXtext.g:10124:24: ~ ( ( '\\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)<='\uFFFF') ) {
input.consume();
@ -1351,7 +1351,7 @@ public class InternalXtextLexer extends Lexer {
}
} while (true);
// InternalXtext.g:10078:40: ( ( '\\r' )? '\\n' )?
// InternalXtext.g:10124:40: ( ( '\\r' )? '\\n' )?
int alt11=2;
int LA11_0 = input.LA(1);
@ -1360,9 +1360,9 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt11) {
case 1 :
// InternalXtext.g:10078:41: ( '\\r' )? '\\n'
// InternalXtext.g:10124:41: ( '\\r' )? '\\n'
{
// InternalXtext.g:10078:41: ( '\\r' )?
// InternalXtext.g:10124:41: ( '\\r' )?
int alt10=2;
int LA10_0 = input.LA(1);
@ -1371,7 +1371,7 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt10) {
case 1 :
// InternalXtext.g:10078:41: '\\r'
// InternalXtext.g:10124:41: '\\r'
{
match('\r');
@ -1403,10 +1403,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10080:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalXtext.g:10080:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalXtext.g:10126:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalXtext.g:10126:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// InternalXtext.g:10080:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalXtext.g:10126:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt12=0;
loop12:
do {
@ -1460,8 +1460,8 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:10082:16: ( . )
// InternalXtext.g:10082:18: .
// InternalXtext.g:10128:16: ( . )
// InternalXtext.g:10128:18: .
{
matchAny();

View file

@ -2,9 +2,6 @@
*/
package org.eclipse.xtext;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Group</b></em>'.

View file

@ -0,0 +1,45 @@
/**
*/
package org.eclipse.xtext;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Java Action</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.JavaAction#getCode <em>Code</em>}</li>
* </ul>
*
* @see org.eclipse.xtext.XtextPackage#getJavaAction()
* @model
* @generated
*/
public interface JavaAction extends AbstractElement {
/**
* Returns the value of the '<em><b>Code</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Code</em>' containment reference.
* @see #setCode(JavaCode)
* @see org.eclipse.xtext.XtextPackage#getJavaAction_Code()
* @model containment="true"
* @generated
*/
JavaCode getCode();
/**
* Sets the value of the '{@link org.eclipse.xtext.JavaAction#getCode <em>Code</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Code</em>' containment reference.
* @see #getCode()
* @generated
*/
void setCode(JavaCode value);
} // JavaAction

View file

@ -372,6 +372,15 @@ public interface XtextFactory extends EFactory {
*/
JavaCode createJavaCode();
/**
* Returns a new object of class '<em>Java Action</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Java Action</em>'.
* @generated
*/
JavaAction createJavaAction();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->

View file

@ -2071,6 +2071,61 @@ public interface XtextPackage extends EPackage {
*/
int JAVA_CODE_FEATURE_COUNT = 1;
/**
* The meta object id for the '{@link org.eclipse.xtext.impl.JavaActionImpl <em>Java Action</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.impl.JavaActionImpl
* @see org.eclipse.xtext.impl.XtextPackageImpl#getJavaAction()
* @generated
*/
int JAVA_ACTION = 39;
/**
* The feature id for the '<em><b>Cardinality</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int JAVA_ACTION__CARDINALITY = ABSTRACT_ELEMENT__CARDINALITY;
/**
* The feature id for the '<em><b>Predicated</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int JAVA_ACTION__PREDICATED = ABSTRACT_ELEMENT__PREDICATED;
/**
* The feature id for the '<em><b>First Set Predicated</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int JAVA_ACTION__FIRST_SET_PREDICATED = ABSTRACT_ELEMENT__FIRST_SET_PREDICATED;
/**
* The feature id for the '<em><b>Code</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int JAVA_ACTION__CODE = ABSTRACT_ELEMENT_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Java Action</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int JAVA_ACTION_FEATURE_COUNT = ABSTRACT_ELEMENT_FEATURE_COUNT + 1;
/**
* Returns the meta object for class '{@link org.eclipse.xtext.Grammar <em>Grammar</em>}'.
* <!-- begin-user-doc -->
@ -3091,6 +3146,27 @@ public interface XtextPackage extends EPackage {
*/
EAttribute getJavaCode_Source();
/**
* Returns the meta object for class '{@link org.eclipse.xtext.JavaAction <em>Java Action</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Java Action</em>'.
* @see org.eclipse.xtext.JavaAction
* @generated
*/
EClass getJavaAction();
/**
* Returns the meta object for the containment reference '{@link org.eclipse.xtext.JavaAction#getCode <em>Code</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Code</em>'.
* @see org.eclipse.xtext.JavaAction#getCode()
* @see #getJavaAction()
* @generated
*/
EReference getJavaAction_Code();
/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
@ -3968,6 +4044,24 @@ public interface XtextPackage extends EPackage {
*/
EAttribute JAVA_CODE__SOURCE = eINSTANCE.getJavaCode_Source();
/**
* The meta object literal for the '{@link org.eclipse.xtext.impl.JavaActionImpl <em>Java Action</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.xtext.impl.JavaActionImpl
* @see org.eclipse.xtext.impl.XtextPackageImpl#getJavaAction()
* @generated
*/
EClass JAVA_ACTION = eINSTANCE.getJavaAction();
/**
* The meta object literal for the '<em><b>Code</b></em>' containment reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference JAVA_ACTION__CODE = eINSTANCE.getJavaAction_Code();
}
} //XtextPackage

View file

@ -2,16 +2,10 @@
*/
package org.eclipse.xtext.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.xtext.Condition;
import org.eclipse.xtext.Parameter;
import org.eclipse.xtext.XtextPackage;
/**

View file

@ -2,21 +2,15 @@
*/
package org.eclipse.xtext.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.xtext.Condition;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.Parameter;
import org.eclipse.xtext.XtextPackage;
/**

View file

@ -0,0 +1,177 @@
/**
*/
package org.eclipse.xtext.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.xtext.JavaAction;
import org.eclipse.xtext.JavaCode;
import org.eclipse.xtext.XtextPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Java Action</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.impl.JavaActionImpl#getCode <em>Code</em>}</li>
* </ul>
*
* @generated
*/
public class JavaActionImpl extends AbstractElementImpl implements JavaAction {
/**
* The cached value of the '{@link #getCode() <em>Code</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCode()
* @generated
* @ordered
*/
protected JavaCode code;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected JavaActionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return XtextPackage.Literals.JAVA_ACTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public JavaCode getCode() {
return code;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCode(JavaCode newCode, NotificationChain msgs) {
JavaCode oldCode = code;
code = newCode;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.JAVA_ACTION__CODE, oldCode, newCode);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setCode(JavaCode newCode) {
if (newCode != code) {
NotificationChain msgs = null;
if (code != null)
msgs = ((InternalEObject)code).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.JAVA_ACTION__CODE, null, msgs);
if (newCode != null)
msgs = ((InternalEObject)newCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.JAVA_ACTION__CODE, null, msgs);
msgs = basicSetCode(newCode, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.JAVA_ACTION__CODE, newCode, newCode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XtextPackage.JAVA_ACTION__CODE:
return basicSetCode(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case XtextPackage.JAVA_ACTION__CODE:
return getCode();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XtextPackage.JAVA_ACTION__CODE:
setCode((JavaCode)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XtextPackage.JAVA_ACTION__CODE:
setCode((JavaCode)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XtextPackage.JAVA_ACTION__CODE:
return code != null;
}
return super.eIsSet(featureID);
}
} //JavaActionImpl

View file

@ -94,6 +94,7 @@ public class XtextFactoryImpl extends EFactoryImpl implements XtextFactory {
case XtextPackage.ANNOTATION: return createAnnotation();
case XtextPackage.GATED_SEMANTIC_PREDICATE: return createGatedSemanticPredicate();
case XtextPackage.JAVA_CODE: return createJavaCode();
case XtextPackage.JAVA_ACTION: return createJavaAction();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@ -519,6 +520,17 @@ public class XtextFactoryImpl extends EFactoryImpl implements XtextFactory {
return javaCode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public JavaAction createJavaAction() {
JavaActionImpl javaAction = new JavaActionImpl();
return javaAction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->

View file

@ -32,6 +32,7 @@ import org.eclipse.xtext.GatedSemanticPredicate;
import org.eclipse.xtext.GeneratedMetamodel;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.JavaAction;
import org.eclipse.xtext.JavaCode;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.LiteralCondition;
@ -331,6 +332,13 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
*/
private EClass javaCodeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass javaActionEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
@ -1346,6 +1354,26 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
return (EAttribute)javaCodeEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EClass getJavaAction() {
return javaActionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EReference getJavaAction_Code() {
return (EReference)javaActionEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@ -1507,6 +1535,9 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
javaCodeEClass = createEClass(JAVA_CODE);
createEAttribute(javaCodeEClass, JAVA_CODE__SOURCE);
javaActionEClass = createEClass(JAVA_ACTION);
createEReference(javaActionEClass, JAVA_ACTION__CODE);
}
/**
@ -1569,6 +1600,7 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
literalConditionEClass.getESuperTypes().add(this.getCondition());
abstractSemanticPredicateEClass.getESuperTypes().add(this.getAbstractElement());
gatedSemanticPredicateEClass.getESuperTypes().add(this.getAbstractSemanticPredicate());
javaActionEClass.getESuperTypes().add(this.getAbstractElement());
// Initialize classes and features; add operations and parameters
initEClass(grammarEClass, Grammar.class, "Grammar", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@ -1704,6 +1736,9 @@ public class XtextPackageImpl extends EPackageImpl implements XtextPackage {
initEClass(javaCodeEClass, JavaCode.class, "JavaCode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getJavaCode_Source(), theEcorePackage.getEString(), "source", "source", 0, 1, JavaCode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(javaActionEClass, JavaAction.class, "JavaAction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getJavaAction_Code(), this.getJavaCode(), null, "code", null, 0, 1, JavaAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
}

View file

@ -224,6 +224,10 @@ public class XtextAdapterFactory extends AdapterFactoryImpl {
return createJavaCodeAdapter();
}
@Override
public Adapter caseJavaAction(JavaAction object) {
return createJavaActionAdapter();
}
@Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
@ -798,6 +802,20 @@ public class XtextAdapterFactory extends AdapterFactoryImpl {
return null;
}
/**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.JavaAction <em>Java Action</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.eclipse.xtext.JavaAction
* @generated
*/
public Adapter createJavaActionAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->

View file

@ -338,6 +338,13 @@ public class XtextSwitch<T> extends Switch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
case XtextPackage.JAVA_ACTION: {
JavaAction javaAction = (JavaAction)theEObject;
T result = caseJavaAction(javaAction);
if (result == null) result = caseAbstractElement(javaAction);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
@ -936,6 +943,21 @@ public class XtextSwitch<T> extends Switch<T> {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Java Action</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>Java Action</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseJavaAction(JavaAction object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->

View file

@ -149,4 +149,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="source" eType="ecore:EDataType ../../../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
defaultValueLiteral="source"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="JavaAction" eSuperTypes="#//AbstractElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="code" eType="#//JavaCode"
containment="true"/>
</eClassifiers>
</ecore:EPackage>

View file

@ -130,5 +130,8 @@
<genClasses ecoreClass="Xtext.ecore#//JavaCode">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Xtext.ecore#//JavaCode/source"/>
</genClasses>
<genClasses ecoreClass="Xtext.ecore#//JavaAction">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Xtext.ecore#//JavaAction/code"/>
</genClasses>
</genPackages>
</genmodel:GenModel>

View file

@ -1265,11 +1265,20 @@ ruleAbstractToken returns [EObject current=null]
}
|
{
newCompositeNode(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_2());
newCompositeNode(grammarAccess.getAbstractTokenAccess().getJavaActionParserRuleCall_2());
}
this_SemanticPredicate_2=ruleSemanticPredicate
this_JavaAction_2=ruleJavaAction
{
$current = $this_SemanticPredicate_2.current;
$current = $this_JavaAction_2.current;
afterParserOrEnumRuleCall();
}
|
{
newCompositeNode(grammarAccess.getAbstractTokenAccess().getSemanticPredicateParserRuleCall_3());
}
this_SemanticPredicate_3=ruleSemanticPredicate
{
$current = $this_SemanticPredicate_3.current;
afterParserOrEnumRuleCall();
}
)
@ -1342,6 +1351,42 @@ ruleGatedSemanticPredicate returns [EObject current=null]
)
;
// Entry rule entryRuleJavaAction
entryRuleJavaAction returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getJavaActionRule()); }
iv_ruleJavaAction=ruleJavaAction
{ $current=$iv_ruleJavaAction.current; }
EOF;
// Rule JavaAction
ruleJavaAction returns [EObject current=null]
@init {
enterRule();
}
@after {
leaveRule();
}:
(
(
{
newCompositeNode(grammarAccess.getJavaActionAccess().getCodeJavaCodeParserRuleCall_0());
}
lv_code_0_0=ruleJavaCode
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getJavaActionRule());
}
set(
$current,
"code",
lv_code_0_0,
"org.eclipse.xtext.Xtext.JavaCode");
afterParserOrEnumRuleCall();
}
)
)
;
// Entry rule entryRuleJavaCode
entryRuleJavaCode returns [EObject current=null]:
{ newCompositeNode(grammarAccess.getJavaCodeRule()); }

View file

@ -922,12 +922,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_JAVACODESTRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3867:21: ( '$$' ( options {greedy=false; } : . )* '$$' )
// InternalXtext.g:3867:23: '$$' ( options {greedy=false; } : . )* '$$'
// InternalXtext.g:3912:21: ( '$$' ( options {greedy=false; } : . )* '$$' )
// InternalXtext.g:3912:23: '$$' ( options {greedy=false; } : . )* '$$'
{
match("$$");
// InternalXtext.g:3867:28: ( options {greedy=false; } : . )*
// InternalXtext.g:3912:28: ( options {greedy=false; } : . )*
loop1:
do {
int alt1=2;
@ -952,7 +952,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt1) {
case 1 :
// InternalXtext.g:3867:56: .
// InternalXtext.g:3912:56: .
{
matchAny();
@ -982,10 +982,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ID;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3869:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalXtext.g:3869:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalXtext.g:3914:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* )
// InternalXtext.g:3914:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
{
// InternalXtext.g:3869:11: ( '^' )?
// InternalXtext.g:3914:11: ( '^' )?
int alt2=2;
int LA2_0 = input.LA(1);
@ -994,7 +994,7 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt2) {
case 1 :
// InternalXtext.g:3869:11: '^'
// InternalXtext.g:3914:11: '^'
{
match('^');
@ -1012,7 +1012,7 @@ public class InternalXtextLexer extends Lexer {
recover(mse);
throw mse;}
// InternalXtext.g:3869:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
// InternalXtext.g:3914:40: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )*
loop3:
do {
int alt3=2;
@ -1061,10 +1061,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_INT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3871:10: ( ( '0' .. '9' )+ )
// InternalXtext.g:3871:12: ( '0' .. '9' )+
// InternalXtext.g:3916:10: ( ( '0' .. '9' )+ )
// InternalXtext.g:3916:12: ( '0' .. '9' )+
{
// InternalXtext.g:3871:12: ( '0' .. '9' )+
// InternalXtext.g:3916:12: ( '0' .. '9' )+
int cnt4=0;
loop4:
do {
@ -1078,7 +1078,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt4) {
case 1 :
// InternalXtext.g:3871:13: '0' .. '9'
// InternalXtext.g:3916:13: '0' .. '9'
{
matchRange('0','9');
@ -1110,10 +1110,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_STRING;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3873:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalXtext.g:3873:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalXtext.g:3918:13: ( ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' ) )
// InternalXtext.g:3918:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
{
// InternalXtext.g:3873:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
// InternalXtext.g:3918:15: ( '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"' | '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\'' )
int alt7=2;
int LA7_0 = input.LA(1);
@ -1131,10 +1131,10 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt7) {
case 1 :
// InternalXtext.g:3873:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
// InternalXtext.g:3918:16: '\"' ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )* '\"'
{
match('\"');
// InternalXtext.g:3873:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
// InternalXtext.g:3918:20: ( '\\\\' . | ~ ( ( '\\\\' | '\"' ) ) )*
loop5:
do {
int alt5=3;
@ -1150,7 +1150,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt5) {
case 1 :
// InternalXtext.g:3873:21: '\\\\' .
// InternalXtext.g:3918:21: '\\\\' .
{
match('\\');
matchAny();
@ -1158,7 +1158,7 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:3873:28: ~ ( ( '\\\\' | '\"' ) )
// InternalXtext.g:3918:28: ~ ( ( '\\\\' | '\"' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -1183,10 +1183,10 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:3873:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
// InternalXtext.g:3918:48: '\\'' ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )* '\\''
{
match('\'');
// InternalXtext.g:3873:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
// InternalXtext.g:3918:53: ( '\\\\' . | ~ ( ( '\\\\' | '\\'' ) ) )*
loop6:
do {
int alt6=3;
@ -1202,7 +1202,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt6) {
case 1 :
// InternalXtext.g:3873:54: '\\\\' .
// InternalXtext.g:3918:54: '\\\\' .
{
match('\\');
matchAny();
@ -1210,7 +1210,7 @@ public class InternalXtextLexer extends Lexer {
}
break;
case 2 :
// InternalXtext.g:3873:61: ~ ( ( '\\\\' | '\\'' ) )
// InternalXtext.g:3918:61: ~ ( ( '\\\\' | '\\'' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
input.consume();
@ -1253,12 +1253,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ML_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3875:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalXtext.g:3875:19: '/*' ( options {greedy=false; } : . )* '*/'
// InternalXtext.g:3920:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
// InternalXtext.g:3920:19: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
// InternalXtext.g:3875:24: ( options {greedy=false; } : . )*
// InternalXtext.g:3920:24: ( options {greedy=false; } : . )*
loop8:
do {
int alt8=2;
@ -1283,7 +1283,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt8) {
case 1 :
// InternalXtext.g:3875:52: .
// InternalXtext.g:3920:52: .
{
matchAny();
@ -1313,12 +1313,12 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3877:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:3877:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
// InternalXtext.g:3922:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:3922:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalXtext.g:3877:24: (~ ( ( '\\n' | '\\r' ) ) )*
// InternalXtext.g:3922:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop9:
do {
int alt9=2;
@ -1331,7 +1331,7 @@ public class InternalXtextLexer extends Lexer {
switch (alt9) {
case 1 :
// InternalXtext.g:3877:24: ~ ( ( '\\n' | '\\r' ) )
// InternalXtext.g:3922:24: ~ ( ( '\\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)<='\uFFFF') ) {
input.consume();
@ -1351,7 +1351,7 @@ public class InternalXtextLexer extends Lexer {
}
} while (true);
// InternalXtext.g:3877:40: ( ( '\\r' )? '\\n' )?
// InternalXtext.g:3922:40: ( ( '\\r' )? '\\n' )?
int alt11=2;
int LA11_0 = input.LA(1);
@ -1360,9 +1360,9 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt11) {
case 1 :
// InternalXtext.g:3877:41: ( '\\r' )? '\\n'
// InternalXtext.g:3922:41: ( '\\r' )? '\\n'
{
// InternalXtext.g:3877:41: ( '\\r' )?
// InternalXtext.g:3922:41: ( '\\r' )?
int alt10=2;
int LA10_0 = input.LA(1);
@ -1371,7 +1371,7 @@ public class InternalXtextLexer extends Lexer {
}
switch (alt10) {
case 1 :
// InternalXtext.g:3877:41: '\\r'
// InternalXtext.g:3922:41: '\\r'
{
match('\r');
@ -1403,10 +1403,10 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_WS;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3879:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalXtext.g:3879:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalXtext.g:3924:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
// InternalXtext.g:3924:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
{
// InternalXtext.g:3879:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
// InternalXtext.g:3924:11: ( ' ' | '\\t' | '\\r' | '\\n' )+
int cnt12=0;
loop12:
do {
@ -1460,8 +1460,8 @@ public class InternalXtextLexer extends Lexer {
try {
int _type = RULE_ANY_OTHER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:3881:16: ( . )
// InternalXtext.g:3881:18: .
// InternalXtext.g:3926:16: ( . )
// InternalXtext.g:3926:18: .
{
matchAny();

View file

@ -22,6 +22,7 @@ import org.eclipse.xtext.GatedSemanticPredicate;
import org.eclipse.xtext.GeneratedMetamodel;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.Group;
import org.eclipse.xtext.JavaAction;
import org.eclipse.xtext.JavaCode;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.LiteralCondition;
@ -242,6 +243,26 @@ public class XtextSemanticSequencer extends AbstractDelegatingSemanticSequencer
return;
}
else break;
case XtextPackage.JAVA_ACTION:
if (rule == grammarAccess.getAlternativesRule()
|| action == grammarAccess.getAlternativesAccess().getAlternativesElementsAction_1_0()
|| rule == grammarAccess.getConditionalBranchRule()
|| rule == grammarAccess.getUnorderedGroupRule()
|| action == grammarAccess.getUnorderedGroupAccess().getUnorderedGroupElementsAction_1_0()
|| rule == grammarAccess.getGroupRule()
|| action == grammarAccess.getGroupAccess().getGroupElementsAction_1_0()
|| rule == grammarAccess.getAbstractTokenRule()
|| rule == grammarAccess.getAbstractTokenWithCardinalityRule()
|| rule == grammarAccess.getAbstractTerminalRule()
|| rule == grammarAccess.getParenthesizedElementRule()) {
sequence_AbstractTokenWithCardinality_JavaAction(context, (JavaAction) semanticObject);
return;
}
else if (rule == grammarAccess.getJavaActionRule()) {
sequence_JavaAction(context, (JavaAction) semanticObject);
return;
}
else break;
case XtextPackage.JAVA_CODE:
sequence_JavaCode(context, (JavaCode) semanticObject);
return;
@ -537,6 +558,28 @@ public class XtextSemanticSequencer extends AbstractDelegatingSemanticSequencer
}
/**
* Contexts:
* Alternatives returns JavaAction
* Alternatives.Alternatives_1_0 returns JavaAction
* ConditionalBranch returns JavaAction
* UnorderedGroup returns JavaAction
* UnorderedGroup.UnorderedGroup_1_0 returns JavaAction
* Group returns JavaAction
* Group.Group_1_0 returns JavaAction
* AbstractToken returns JavaAction
* AbstractTokenWithCardinality returns JavaAction
* AbstractTerminal returns JavaAction
* ParenthesizedElement returns JavaAction
*
* Constraint:
* (code=JavaCode (cardinality='?' | cardinality='*' | cardinality='+')*)
*/
protected void sequence_AbstractTokenWithCardinality_JavaAction(ISerializationContext context, JavaAction semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Contexts:
* Alternatives returns Keyword
@ -894,6 +937,24 @@ public class XtextSemanticSequencer extends AbstractDelegatingSemanticSequencer
}
/**
* Contexts:
* JavaAction returns JavaAction
*
* Constraint:
* code=JavaCode
*/
protected void sequence_JavaAction(ISerializationContext context, JavaAction semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.JAVA_ACTION__CODE) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.JAVA_ACTION__CODE));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getJavaActionAccess().getCodeJavaCodeParserRuleCall_0(), semanticObject.getCode());
feeder.finish();
}
/**
* Contexts:
* JavaCode returns JavaCode

View file

@ -809,13 +809,14 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall cAbstractTokenWithCardinalityParserRuleCall_0 = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall cActionParserRuleCall_1 = (RuleCall)cAlternatives.eContents().get(1);
private final RuleCall cSemanticPredicateParserRuleCall_2 = (RuleCall)cAlternatives.eContents().get(2);
private final RuleCall cJavaActionParserRuleCall_2 = (RuleCall)cAlternatives.eContents().get(2);
private final RuleCall cSemanticPredicateParserRuleCall_3 = (RuleCall)cAlternatives.eContents().get(3);
//AbstractToken AbstractElement:
// AbstractTokenWithCardinality | Action | SemanticPredicate;
// AbstractTokenWithCardinality | Action | JavaAction | SemanticPredicate;
@Override public ParserRule getRule() { return rule; }
//AbstractTokenWithCardinality | Action | SemanticPredicate
//AbstractTokenWithCardinality | Action | JavaAction | SemanticPredicate
public Alternatives getAlternatives() { return cAlternatives; }
//AbstractTokenWithCardinality
@ -824,8 +825,11 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
//Action
public RuleCall getActionParserRuleCall_1() { return cActionParserRuleCall_1; }
//JavaAction
public RuleCall getJavaActionParserRuleCall_2() { return cJavaActionParserRuleCall_2; }
//SemanticPredicate
public RuleCall getSemanticPredicateParserRuleCall_2() { return cSemanticPredicateParserRuleCall_2; }
public RuleCall getSemanticPredicateParserRuleCall_3() { return cSemanticPredicateParserRuleCall_3; }
}
public class SemanticPredicateElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.Xtext.SemanticPredicate");
@ -861,6 +865,21 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
//'?=>'
public Keyword getQuestionMarkEqualsSignGreaterThanSignKeyword_1() { return cQuestionMarkEqualsSignGreaterThanSignKeyword_1; }
}
public class JavaActionElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.Xtext.JavaAction");
private final Assignment cCodeAssignment = (Assignment)rule.eContents().get(1);
private final RuleCall cCodeJavaCodeParserRuleCall_0 = (RuleCall)cCodeAssignment.eContents().get(0);
//JavaAction:
// code=JavaCode;
@Override public ParserRule getRule() { return rule; }
//code=JavaCode
public Assignment getCodeAssignment() { return cCodeAssignment; }
//JavaCode
public RuleCall getCodeJavaCodeParserRuleCall_0() { return cCodeJavaCodeParserRuleCall_0; }
}
public class JavaCodeElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.Xtext.JavaCode");
private final Assignment cSourceAssignment = (Assignment)rule.eContents().get(1);
@ -2380,6 +2399,7 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
private final AbstractTokenElements pAbstractToken;
private final SemanticPredicateElements pSemanticPredicate;
private final GatedSemanticPredicateElements pGatedSemanticPredicate;
private final JavaActionElements pJavaAction;
private final JavaCodeElements pJavaCode;
private final TerminalRule tJAVACODESTRING;
private final AbstractTokenWithCardinalityElements pAbstractTokenWithCardinality;
@ -2451,6 +2471,7 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
this.pAbstractToken = new AbstractTokenElements();
this.pSemanticPredicate = new SemanticPredicateElements();
this.pGatedSemanticPredicate = new GatedSemanticPredicateElements();
this.pJavaAction = new JavaActionElements();
this.pJavaCode = new JavaCodeElements();
this.tJAVACODESTRING = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.Xtext.JAVACODESTRING");
this.pAbstractTokenWithCardinality = new AbstractTokenWithCardinalityElements();
@ -2690,7 +2711,7 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
}
//AbstractToken AbstractElement:
// AbstractTokenWithCardinality | Action | SemanticPredicate;
// AbstractTokenWithCardinality | Action | JavaAction | SemanticPredicate;
public AbstractTokenElements getAbstractTokenAccess() {
return pAbstractToken;
}
@ -2719,6 +2740,16 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
return getGatedSemanticPredicateAccess().getRule();
}
//JavaAction:
// code=JavaCode;
public JavaActionElements getJavaActionAccess() {
return pJavaAction;
}
public ParserRule getJavaActionRule() {
return getJavaActionAccess().getRule();
}
//JavaCode:
// source=JAVACODESTRING;
public JavaCodeElements getJavaCodeAccess() {

View file

@ -87,6 +87,7 @@ Group returns AbstractElement:
AbstractToken returns AbstractElement:
AbstractTokenWithCardinality |
Action |
JavaAction |
SemanticPredicate
;
@ -98,6 +99,10 @@ GatedSemanticPredicate returns GatedSemanticPredicate:
code=JavaCode '?=>'
;
JavaAction returns JavaAction:
code=JavaCode
;
JavaCode returns JavaCode:
source=JAVACODESTRING
;