Java Code Examples for org.eclipse.xtext.serializer.sequencer.ISemanticSequencer

The following examples show how to use org.eclipse.xtext.serializer.sequencer.ISemanticSequencer. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void testSequence(String stringModel) throws Exception {
	EObject model = getModel(stringModel);
	ISerializationContext context = nmSequencer.findContexts(model, true, null).iterator().next();
	DebugSequenceAcceptor actual = new NoEnterNodesDebugSequenceAcceptor(false);
	ISemanticSequencer semanticSequencer = semanticSequencerProvider.get();
	ISyntacticSequencer syntacticSequencer = syntacticSequencerProvider.get();
	IHiddenTokenSequencer hiddenTokenSequencer = hiddenTokenSequencerProvider.get();
	semanticSequencer
			.init((ISemanticSequenceAcceptor) syntacticSequencer, ISerializationDiagnostic.STDERR_ACCEPTOR);
	syntacticSequencer.init(context, model, (ISyntacticSequenceAcceptor) hiddenTokenSequencer,
			ISerializationDiagnostic.STDERR_ACCEPTOR);
	hiddenTokenSequencer.init(context, model, actual, ISerializationDiagnostic.STDERR_ACCEPTOR);
	semanticSequencer.createSequence(context, model);
	//		System.out.println(actual);
	//		System.out.println(NodeModelUtils.compactDump(NodeModelUtils.findActualNodeFor(model), true));
	assertEquals(Joiner.on("\n").join(getNodeSequence(model)), Joiner.on("\n").join(actual.getColumn(4)));
}
 
Example 2
private EObject testSequence(String stringModel) throws Exception {
	DebugSequenceAcceptor genericActual = new DebugSequenceAcceptor();
	DebugSequenceAcceptor generatedActual = new DebugSequenceAcceptor();
	DebugSequenceAcceptor expected = new DebugSequenceAcceptor();

	ISemanticSequencer generatedSequencer = generatedSequencerProvider.get();
	ISemanticSequencer genericSequencer = getGenericSemanticSequencer();

	assertTrue(generatedSequencer instanceof SequencerTestLanguageSemanticSequencer);

	generatedSequencer.init(generatedActual, ISerializationDiagnostic.STDERR_ACCEPTOR);
	genericSequencer.init(genericActual, ISerializationDiagnostic.STDERR_ACCEPTOR);
	nmSequencer.init(expected, ISerializationDiagnostic.STDERR_ACCEPTOR);

	EObject model = getModel(stringModel).eContents().get(0);
	ISerializationContext context = nmSequencer.findContexts(model, true, null).iterator().next();

	generatedSequencer.createSequence(context, model);
	genericSequencer.createSequence(context, model);
	nmSequencer.createSequence(context, model);

	assertEquals(expected.toString(), genericActual.toString());
	assertEquals(expected.toString(), generatedActual.toString());
	return model;
}
 
Example 3
Source Project: xtext-core   Source File: Serializer.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void serialize(ISerializationContext context, EObject semanticObject, ISequenceAcceptor tokens,
		ISerializationDiagnostic.Acceptor errors) {
	ISemanticSequencer semantic = semanticSequencerProvider.get();
	ISyntacticSequencer syntactic = syntacticSequencerProvider.get();
	IHiddenTokenSequencer hidden = hiddenTokenSequencerProvider.get();
	semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
	syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
	hidden.init(context, semanticObject, tokens, errors);
	if (tokens instanceof TokenStreamSequenceAdapter)
		((TokenStreamSequenceAdapter) tokens).init(context);
	semantic.createSequence(context, semanticObject);
}
 
Example 4
Source Project: xtext-core   Source File: SequenceFeeder.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected SequenceFeeder(Provider provider, ISerializationContext context, EObject semanticObject, INodesForEObjectProvider nodes,
		ISemanticSequencer masterSequencer, ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
	super();
	if (semanticObject == null || nodes == null || sequenceAcceptor == null)
		throw new NullPointerException();
	this.context = context;
	this.provider = provider;
	this.semanticObject = semanticObject;
	this.nodes = nodes;
	this.masterSequencer = masterSequencer;
	this.sequenceAcceptor = sequenceAcceptor;
	this.errorAcceptor = errorAcceptor;
}
 
Example 5
Source Project: xtext-core   Source File: SyntacticSequencerTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private void testSequence(EObject inObj, String outModel) throws Exception {
	EObject outObj = getModel(outModel);
	ISerializationContext context = nmSequencer.findContexts(inObj, true, null).iterator().next();
	Acceptor actual = new Acceptor();
	ISemanticSequencer semanticSeq = semanticSequencerProvider.get();
	ISyntacticSequencer syntacticSeq = syntacticSequencerProvider.get();
	semanticSeq.init((ISemanticSequenceAcceptor) syntacticSeq, ISerializationDiagnostic.STDERR_ACCEPTOR);
	syntacticSeq.init(context, inObj, actual, ISerializationDiagnostic.STDERR_ACCEPTOR);
	semanticSeq.createSequence(context, inObj);
	assertEquals(Joiner.on("\n").join(getNodeSequence(outObj)), Joiner.on("\n").join(actual.getResult()));
}
 
Example 6
Source Project: xtext-core   Source File: Serializer.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @deprecated use {@link #serialize(ISerializationContext, EObject, ISequenceAcceptor, ISerializationDiagnostic.Acceptor)}
 */
@Deprecated
protected void serialize(EObject semanticObject, EObject context, ISequenceAcceptor tokens,
		ISerializationDiagnostic.Acceptor errors) {
	ISemanticSequencer semantic = semanticSequencerProvider.get();
	ISyntacticSequencer syntactic = syntacticSequencerProvider.get();
	IHiddenTokenSequencer hidden = hiddenTokenSequencerProvider.get();
	semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
	syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
	hidden.init(context, semanticObject, tokens, errors);
	if (tokens instanceof TokenStreamSequenceAdapter)
		((TokenStreamSequenceAdapter) tokens).init(context);
	semantic.createSequence(context, semanticObject);
}
 
Example 7
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return SuperTestLanguageSemanticSequencer.class;
}
 
Example 8
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return TwoParametersTestLanguageSemanticSequencer.class;
}
 
Example 9
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return InheritanceTest2LanguageSemanticSequencer.class;
}
 
Example 10
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return RegularExpressionSemanticSequencer.class;
}
 
Example 11
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return Bug317840TestLanguageSemanticSequencer.class;
}
 
Example 12
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return AssignmentFinderTestLanguageSemanticSequencer.class;
}
 
Example 13
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return Bug250313SemanticSequencer.class;
}
 
Example 14
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return UnassignedRuleCallTestLanguageSemanticSequencer.class;
}
 
Example 15
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return SimpleUnorderedGroupsTestLanguageSemanticSequencer.class;
}
 
Example 16
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return Bug299395TestLanguageSemanticSequencer.class;
}
 
Example 17
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return DummyTestLanguageSemanticSequencer.class;
}
 
Example 18
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return RefactoringTestLanguage1SemanticSequencer.class;
}
 
Example 19
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return Bug289059TestLanguageSemanticSequencer.class;
}
 
Example 20
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return TerminalsSemanticSequencer.class;
}
 
Example 21
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return EncodingTestLanguageSemanticSequencer.class;
}
 
Example 22
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return TestLanguageSemanticSequencer.class;
}
 
Example 23
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return EcoreFragmentTestLanguageSemanticSequencer.class;
}
 
Example 24
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return LiveContainerBuilderIntegerationTestLanguageSemanticSequencer.class;
}
 
Example 25
Source Project: xtext-core   Source File: SequenceFeeder.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @deprecated {@link #SequenceFeeder(SequenceFeeder.Provider, ISerializationContext, EObject, ISemanticNodeProvider.INodesForEObjectProvider, ISemanticSequencer, ISemanticSequenceAcceptor, ISerializationDiagnostic.Acceptor)}
 */
@Deprecated
protected SequenceFeeder(Provider provider, EObject semanticObject, INodesForEObjectProvider nodes, ISemanticSequencer masterSequencer,
		ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
	this(provider, null, semanticObject, nodes, masterSequencer, sequenceAcceptor, errorAcceptor);
}
 
Example 26
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return ActionTestLanguageSemanticSequencer.class;
}
 
Example 27
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return GH1462TestLanguageSemanticSequencer.class;
}
 
Example 28
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return Bug289524ExTestLanguageSemanticSequencer.class;
}
 
Example 29
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return EnumAndReferenceTestLanguageSemanticSequencer.class;
}
 
Example 30
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return StatemachineSemanticSequencer.class;
}