Search in sources :

Example 1 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug362902SemanticSequencer 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 == Bug362902Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug362902Package.GREETING:
                sequence_Greeting(context, (Greeting) semanticObject);
                return;
            case Bug362902Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Greeting(org.eclipse.xtext.linking.bug362902.Greeting) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.linking.bug362902.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug311337TestLanguageSemanticSequencer 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 == Bug311337Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Bug311337Package.CHILD:
                sequence_Child(context, (Child) semanticObject);
                return;
            case Bug311337Package.DEFINITION:
                sequence_Definition(context, (Definition) semanticObject);
                return;
            case Bug311337Package.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case Bug311337Package.NESTED_REF:
                sequence_Reference(context, (NestedRef) semanticObject);
                return;
            case Bug311337Package.REFERENCE:
                sequence_Reference(context, (Reference) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) NestedRef(org.eclipse.xtext.linking.lazy.bug311337.NestedRef) Action(org.eclipse.xtext.Action) Reference(org.eclipse.xtext.linking.lazy.bug311337.Reference) Definition(org.eclipse.xtext.linking.lazy.bug311337.Definition) Model(org.eclipse.xtext.linking.lazy.bug311337.Model) Parameter(org.eclipse.xtext.Parameter) Child(org.eclipse.xtext.linking.lazy.bug311337.Child) EPackage(org.eclipse.emf.ecore.EPackage)

Example 3 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug250313Test method testDatatypeConversion_01.

@Test
public void testDatatypeConversion_01() throws Exception {
    Model model = (Model) getModel("1 foo - bar");
    assertEquals("str", model.getValue());
    assertEquals("org.eclipse.xtext.valueconverter.Bug250313.Datatype", lexerRule);
    assertTrue(node instanceof ICompositeNode);
    assertEquals(6, Iterables.size(((ICompositeNode) node).getChildren()));
    assertEquals("foo - bar", string);
    assertEquals(1, convertCallCount);
}
Also used : Model(org.eclipse.xtext.valueconverter.bug250313.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 4 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug250313Test method testNestedDatatypeConversion_03.

@Test
public void testNestedDatatypeConversion_03() throws Exception {
    Model model = (Model) getModel("zonk + foo - bar");
    assertEquals("str", model.getValue());
    assertEquals("org.eclipse.xtext.valueconverter.Bug250313.NestedDatatype", lexerRule);
    assertTrue(node instanceof ICompositeNode);
    assertEquals(4, Iterables.size(((ICompositeNode) node).getChildren()));
    assertEquals("zonk + foo - bar", string);
    assertEquals(1, convertCallCount);
}
Also used : Model(org.eclipse.xtext.valueconverter.bug250313.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 5 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug250313Test method testDatatypeConversion_04.

@Test
public void testDatatypeConversion_04() throws Exception {
    Model model = (Model) getModel("1+ foo - bar");
    assertEquals("[str]", model.getMultiValue().toString());
    assertEquals("org.eclipse.xtext.valueconverter.Bug250313.Datatype", lexerRule);
    assertTrue(node instanceof ICompositeNode);
    assertEquals(6, Iterables.size(((ICompositeNode) node).getChildren()));
    assertEquals("foo - bar", string);
    assertEquals(1, convertCallCount);
}
Also used : Model(org.eclipse.xtext.valueconverter.bug250313.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) 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