Search in sources :

Example 21 with Model

use of org.eclipse.xtext.parsetree.reconstr.bug299395.Model in project xtext-core by eclipse.

the class Bug250313SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug250313Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug250313Package.CHILD1:
                sequence_Child1(context, (Child1) semanticObject);
                return;
            case Bug250313Package.CHILD2:
                sequence_Child2(context, (Child2) semanticObject);
                return;
            case Bug250313Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.valueconverter.bug250313.Model) Parameter(org.eclipse.xtext.Parameter) Child2(org.eclipse.xtext.valueconverter.bug250313.Child2) Child1(org.eclipse.xtext.valueconverter.bug250313.Child1) EPackage(org.eclipse.emf.ecore.EPackage)

Example 22 with Model

use of org.eclipse.xtext.parsetree.reconstr.bug299395.Model in project xtext-core by eclipse.

the class Bug302128TestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug302128Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug302128Package.ELEMENT:
                sequence_Element(context, (Element) semanticObject);
                return;
            case Bug302128Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Element(org.eclipse.xtext.parsetree.reconstr.bug302128.Element) Model(org.eclipse.xtext.parsetree.reconstr.bug302128.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 23 with Model

use of org.eclipse.xtext.parsetree.reconstr.bug299395.Model in project xtext-core by eclipse.

the class Bug305397SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug305397Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug305397Package.ELEMENT:
                sequence_Element(context, (Element) semanticObject);
                return;
            case Bug305397Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Element(org.eclipse.xtext.parsetree.impl.bug305397.Element) Model(org.eclipse.xtext.parsetree.impl.bug305397.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 24 with Model

use of org.eclipse.xtext.parsetree.reconstr.bug299395.Model in project xtext-core by eclipse.

the class Bug299395TestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Bug299395Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug299395Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case Bug299395Package.SUB_MODEL:
                sequence_SubModel(context, (SubModel) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) Model(org.eclipse.xtext.parsetree.reconstr.bug299395.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel)

Example 25 with Model

use of org.eclipse.xtext.parsetree.reconstr.bug299395.Model in project xtext-core by eclipse.

the class Bug250313Test method testIDConversion_01.

@Test
public void testIDConversion_01() throws Exception {
    Model model = (Model) getModel("1 str");
    assertEquals("str", model.getValue());
    assertEquals("org.eclipse.xtext.common.Terminals.ID", lexerRule);
    assertTrue(node instanceof ILeafNode);
    assertEquals("str", string);
    assertEquals(1, convertCallCount);
}
Also used : ILeafNode(org.eclipse.xtext.nodemodel.ILeafNode) Model(org.eclipse.xtext.valueconverter.bug250313.Model) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)41 Model (org.eclipse.xtext.valueconverter.bug250313.Model)30 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)16 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)11 Model (org.eclipse.xtext.parsetree.reconstr.bug299395.Model)9 SubModel (org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel)9 EPackage (org.eclipse.emf.ecore.EPackage)6 Action (org.eclipse.xtext.Action)6 Parameter (org.eclipse.xtext.Parameter)6 ParserRule (org.eclipse.xtext.ParserRule)6 Model (org.eclipse.xtext.linking.bug362902.Model)2 Model (org.eclipse.xtext.linking.lazy.bug311337.Model)2 Element (org.eclipse.xtext.parsetree.impl.bug305397.Element)2 Model (org.eclipse.xtext.parsetree.impl.bug305397.Model)2 Model (org.eclipse.xtext.parsetree.reconstr.bug302128.Model)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)1 Greeting (org.eclipse.xtext.linking.bug362902.Greeting)1 XtextLinkingDiagnostic (org.eclipse.xtext.linking.impl.XtextLinkingDiagnostic)1 Child (org.eclipse.xtext.linking.lazy.bug311337.Child)1