use of org.eclipse.xtext.parser.terminalrules.unicode.GString in project xtext-core by eclipse.
the class UnicodeTestLanguageSemanticSequencer 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 == UnicodePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case UnicodePackage.GSTRING:
sequence_GString(context, (GString) semanticObject);
return;
case UnicodePackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
case UnicodePackage.QUOTED_STRING:
sequence_QuotedString(context, (QuotedString) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.parser.terminalrules.unicode.GString in project xtext-core by eclipse.
the class UnicodeTest method testWrite.
@Test
public void testWrite() throws Exception {
XtextResource resource = getResource("", "test.mydsl");
Model model = UnicodeFactory.eINSTANCE.createModel();
resource.getContents().add(model);
GString s0 = UnicodeFactory.eINSTANCE.createGString();
s0.setName(UMLAUTS);
model.getStrings().add(s0);
QuotedString s1 = UnicodeFactory.eINSTANCE.createQuotedString();
s1.setName(UMLAUTS);
model.getStrings().add(s1);
QuotedString s2 = UnicodeFactory.eINSTANCE.createQuotedString();
s2.setName(QUOTED_UMLAUTS);
model.getStrings().add(s2);
QuotedString s3 = UnicodeFactory.eINSTANCE.createQuotedString();
s3.setName(MIXED_UMLAUTS);
model.getStrings().add(s3);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
resource.save(outputStream, null);
String textualModel = new String(outputStream.toByteArray(), getCharsetForTest());
assertEquals(doubleQuote(UMLAUTS + " \"" + UMLAUTS + "\" \"" + QUOTED_UMLAUTS + "\" \"" + MIXED_UMLAUTS + "\""), textualModel);
}
Aggregations