Search in sources :

Example 1 with Model

use of org.eclipse.xtext.lexer.backtrackingTestLanguage.Model in project xtext-core by eclipse.

the class BacktrackingLexerTestLanguageSemanticSequencer 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 == BacktrackingTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case BacktrackingTestLanguagePackage.AB:
                sequence_Ab(context, (Ab) semanticObject);
                return;
            case BacktrackingTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case BacktrackingTestLanguagePackage.XB:
                sequence_Xb(context, (Xb) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Ab(org.eclipse.xtext.lexer.backtrackingTestLanguage.Ab) Action(org.eclipse.xtext.Action) Model(org.eclipse.xtext.lexer.backtrackingTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) Xb(org.eclipse.xtext.lexer.backtrackingTestLanguage.Xb) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with Model

use of org.eclipse.xtext.lexer.backtrackingTestLanguage.Model in project xtext-core by eclipse.

the class Bug282355Test method testBug282355_04.

@Test
public void testBug282355_04() throws Exception {
    Resource resource = getResourceFromString("Abc Efg Ab Xb");
    assertTrue(resource.getErrors().isEmpty());
    Model model = (Model) resource.getContents().get(0);
    assertEquals(2, model.getEnums().size());
    assertEquals(1, model.getAbs().size());
    assertEquals(1, model.getXbs().size());
    assertEquals(0, model.getAs().size());
    assertEquals(0, model.getYs().size());
    assertEquals(0, model.getYcs().size());
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) Model(org.eclipse.xtext.lexer.backtrackingTestLanguage.Model) Test(org.junit.Test)

Example 3 with Model

use of org.eclipse.xtext.lexer.backtrackingTestLanguage.Model in project xtext-core by eclipse.

the class Bug282355Test method testBug282355_02.

@Test
public void testBug282355_02() throws Exception {
    Resource resource = getResourceFromString("Xb");
    assertTrue(resource.getErrors().isEmpty());
    Model model = (Model) resource.getContents().get(0);
    assertEquals(0, model.getEnums().size());
    assertEquals(0, model.getAbs().size());
    assertEquals(1, model.getXbs().size());
    assertEquals(0, model.getAs().size());
    assertEquals(0, model.getYs().size());
    assertEquals(0, model.getYcs().size());
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) Model(org.eclipse.xtext.lexer.backtrackingTestLanguage.Model) Test(org.junit.Test)

Example 4 with Model

use of org.eclipse.xtext.lexer.backtrackingTestLanguage.Model in project xtext-core by eclipse.

the class Bug282355Test method testBug282355_01.

@Test
public void testBug282355_01() throws Exception {
    Resource resource = getResourceFromString("Abc Efg Xb");
    assertTrue(resource.getErrors().isEmpty());
    Model model = (Model) resource.getContents().get(0);
    assertEquals(2, model.getEnums().size());
    assertEquals(0, model.getAbs().size());
    assertEquals(1, model.getXbs().size());
    assertEquals(0, model.getAs().size());
    assertEquals(0, model.getYs().size());
    assertEquals(0, model.getYcs().size());
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) Model(org.eclipse.xtext.lexer.backtrackingTestLanguage.Model) Test(org.junit.Test)

Example 5 with Model

use of org.eclipse.xtext.lexer.backtrackingTestLanguage.Model in project xtext-core by eclipse.

the class Bug282355Test method testBug282355_03.

@Test
public void testBug282355_03() throws Exception {
    Resource resource = getResourceFromString("Ab");
    assertTrue(resource.getErrors().isEmpty());
    Model model = (Model) resource.getContents().get(0);
    assertEquals(0, model.getEnums().size());
    assertEquals(1, model.getAbs().size());
    assertEquals(0, model.getXbs().size());
    assertEquals(0, model.getAs().size());
    assertEquals(0, model.getYs().size());
    assertEquals(0, model.getYcs().size());
}
Also used : Resource(org.eclipse.emf.ecore.resource.Resource) Model(org.eclipse.xtext.lexer.backtrackingTestLanguage.Model) Test(org.junit.Test)

Aggregations

Model (org.eclipse.xtext.lexer.backtrackingTestLanguage.Model)11 Resource (org.eclipse.emf.ecore.resource.Resource)10 Test (org.junit.Test)10 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 Ab (org.eclipse.xtext.lexer.backtrackingTestLanguage.Ab)1 Xb (org.eclipse.xtext.lexer.backtrackingTestLanguage.Xb)1