Search in sources :

Example 1 with Model

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

the class Bug410560Test method testParsingWithIndent_02.

@Test
public void testParsingWithIndent_02() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("({tworequired a b})");
        _builder.newLine();
        EObject _model = this.getModel(_builder.toString());
        final Model model = ((Model) _model);
        Assert.assertNotNull(model);
        Assert.assertNotNull(model.getTest());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Model(org.eclipse.xtext.parsetree.reconstr.serializationerror.Model) Test(org.junit.Test)

Example 2 with Model

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

the class Bug410560Test method testPartialParsingRemoveNestedIndent.

@Test
public void testPartialParsingRemoveNestedIndent() {
    try {
        final String modelAsString = "({{ tworequired a b }})";
        EObject _model = this.getModel(modelAsString);
        final Model model = ((Model) _model);
        Resource _eResource = model.eResource();
        final XtextResource res = ((XtextResource) _eResource);
        res.update(modelAsString.indexOf("t"), "tworequired a b".length(), " ");
        Assert.assertSame(model, IterableExtensions.<EObject>head(res.getContents()));
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Model(org.eclipse.xtext.parsetree.reconstr.serializationerror.Model) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) XtextResource(org.eclipse.xtext.resource.XtextResource) Test(org.junit.Test)

Example 3 with Model

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

the class Bug410560Test method testParsingWithIndent_01.

@Test
public void testParsingWithIndent_01() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("{tworequired a b}");
        _builder.newLine();
        EObject _model = this.getModel(_builder.toString());
        final Model model = ((Model) _model);
        Assert.assertNotNull(model);
        Assert.assertNotNull(model.getTest());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Model(org.eclipse.xtext.parsetree.reconstr.serializationerror.Model) Test(org.junit.Test)

Example 4 with Model

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

the class Bug410560Test method testParsingWithoutIndent_02.

@Test
public void testParsingWithoutIndent_02() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("({})");
        _builder.newLine();
        EObject _model = this.getModel(_builder.toString());
        final Model model = ((Model) _model);
        Assert.assertNotNull(model);
        Assert.assertNull(model.getTest());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Model(org.eclipse.xtext.parsetree.reconstr.serializationerror.Model) Test(org.junit.Test)

Example 5 with Model

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

the class SerializationErrorTestLanguageSemanticSequencer 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 == SerializationerrorPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case SerializationerrorPackage.INDENT:
                sequence_Indent(context, (Indent) semanticObject);
                return;
            case SerializationerrorPackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case SerializationerrorPackage.TWO_OPTIONS:
                sequence_TwoOptions(context, (TwoOptions) semanticObject);
                return;
            case SerializationerrorPackage.TWO_REQUIRED:
                sequence_TwoRequired(context, (TwoRequired) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Indent(org.eclipse.xtext.parsetree.reconstr.serializationerror.Indent) Model(org.eclipse.xtext.parsetree.reconstr.serializationerror.Model) TwoOptions(org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoOptions) Parameter(org.eclipse.xtext.Parameter) TwoRequired(org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoRequired) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

Model (org.eclipse.xtext.parsetree.reconstr.serializationerror.Model)8 EObject (org.eclipse.emf.ecore.EObject)7 Test (org.junit.Test)7 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 Resource (org.eclipse.emf.ecore.resource.Resource)3 XtextResource (org.eclipse.xtext.resource.XtextResource)3 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 Indent (org.eclipse.xtext.parsetree.reconstr.serializationerror.Indent)1 TwoOptions (org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoOptions)1 TwoRequired (org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoRequired)1