use of org.eclipse.xtext.serializer.ISerializationContext in project xtext-core by eclipse.
the class FormatterTest method serializeToTokenBuffer.
protected void serializeToTokenBuffer(String model, ITokenStream out) throws Exception {
EObject semanticObject = get(ParseHelper.class).parse(model);
ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
ISemanticSequencer semantic = get(ISemanticSequencer.class);
ISyntacticSequencer syntactic = get(ISyntacticSequencer.class);
IHiddenTokenSequencer hidden = get(IHiddenTokenSequencer.class);
TokenStreamSequenceAdapter tokenstream = new TokenStreamSequenceAdapter(out, getGrammarAccess().getGrammar(), errors);
semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
ISerializationContext context = new SerializationContext.RuleContext(null, (ParserRule) get(IGrammarAccess.class).getGrammar().getRules().get(0));
syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
hidden.init(context, semanticObject, tokenstream, errors);
tokenstream.init(context);
semantic.createSequence(context, semanticObject);
}
Aggregations