當前位置: 首頁>>代碼示例>>Java>>正文


Java ISemanticSequencer.init方法代碼示例

本文整理匯總了Java中org.eclipse.xtext.serializer.sequencer.ISemanticSequencer.init方法的典型用法代碼示例。如果您正苦於以下問題:Java ISemanticSequencer.init方法的具體用法?Java ISemanticSequencer.init怎麽用?Java ISemanticSequencer.init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.xtext.serializer.sequencer.ISemanticSequencer的用法示例。


在下文中一共展示了ISemanticSequencer.init方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSequence

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
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)));
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:18,代碼來源:HiddenTokenSequencerTest.java

示例2: testSequence

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
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;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:26,代碼來源:AbstractSemanticSequencerTest.java

示例3: serialize

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
@Override
public void serialize(ITextRegionDiffBuilder result) {
	ISemanticSequencer semantic = semanticSequencerProvider.get();
	ISyntacticSequencer syntactic = syntacticSequencerProvider.get();
	IHiddenTokenSequencer hidden = hiddenTokenSequencerProvider.get();
	semantic.init((ISemanticSequenceAcceptor) syntactic, errorAcceptor);
	syntactic.init(context, root, (ISyntacticSequenceAcceptor) hidden, errorAcceptor);
	ISequenceAcceptor acceptor;
	if (insertAt instanceof IHiddenRegion) {
		IHiddenRegion h = (IHiddenRegion) insertAt;
		acceptor = result.replaceSequence(h, h, context, root);
	} else {
		IHiddenRegion originalFirst = insertAt.getPreviousHiddenRegion();
		IHiddenRegion originalLast = insertAt.getNextHiddenRegion();
		acceptor = result.replaceSequence(originalFirst, originalLast, context, root);
	}
	hidden.init(context, root, acceptor, errorAcceptor);
	if (acceptor instanceof TokenStreamSequenceAdapter)
		((TokenStreamSequenceAdapter) acceptor).init(context);
	semantic.createSequence(context, root);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:22,代碼來源:PartialSerializer.java

示例4: serialize

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
/**
 * @since 2.3
 */
protected String serialize(EObject semanticObject, DelegatingSequenceAcceptor... acceptors) {
	ISequenceAcceptor debug = null;
	try {
		ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
		ISemanticSequencer semantic = semanticSequencerProvider.get();
		ISyntacticSequencer syntactic = syntacticSequencerProvider.get();
		IHiddenTokenSequencer hidden = hiddenTokenSequencerProvider.get();
		ISequenceAcceptor result = new StringBufferSequenceAcceptor();
		ISequenceAcceptor out = result;
		for (DelegatingSequenceAcceptor delegate : acceptors) {
			delegate.setDelegate(out);
			out = delegate;
		}
		out = debug = new DebugSequenceAcceptor(out);
		semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
		ISerializationContext context = getContext(semanticObject);
		syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
		hidden.init(context, semanticObject, out, errors);
		semantic.createSequence(context, semanticObject);
		return result.toString();
	} catch (Exception t) {
		if (debug != null) {
			System.out.println("Serializer debug output:");
			System.out.println(debug.toString());
		}
		Exceptions.sneakyThrow(t);
		return "";
	}
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:33,代碼來源:SerializerTester.java

示例5: serialize

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
/**
 * @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);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:17,代碼來源:Serializer.java

示例6: serialize

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
protected String serialize(EObject semanticObject, DelegatingSequenceAcceptor... acceptors) {
	ISequenceAcceptor debug = null;
	try {
		ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
		ISemanticSequencer semantic = semanticSequencerProvider.get();
		ISyntacticSequencer syntactic = syntacticSequencerProvider.get();
		IHiddenTokenSequencer hidden = hiddenTokenSequencerProvider.get();
		ISequenceAcceptor result = new StringBufferSequenceAcceptor();
		ISequenceAcceptor out = result;
		for (DelegatingSequenceAcceptor delegate : acceptors) {
			delegate.setDelegate(out);
			out = delegate;
		}
		out = debug = new DebugSequenceAcceptor(out);
		semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
		ISerializationContext context = getContext(semanticObject);
		syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
		hidden.init(context, semanticObject, out, errors);
		semantic.createSequence(context, semanticObject);
		return result.toString();
	} catch (Exception t) {
		if (debug != null) {
			System.out.println("Serializer debug output:");
			System.out.println(debug.toString());
		}
		Exceptions.sneakyThrow(t);
		return "";
	}
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:30,代碼來源:SerializerTestHelper.java

示例7: serializeToTokenBuffer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
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);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:FormatterTest.java

示例8: testSequence

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入方法依賴的package包/類
private void testSequence(String stringModel) throws Exception {
	EObject model = getModel(stringModel);
	ISerializationContext context = nmSequencer.findContexts(model, 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, model, actual, ISerializationDiagnostic.STDERR_ACCEPTOR);
	semanticSeq.createSequence(context, model);
	assertEquals(Joiner.on("\n").join(getNodeSequence(model)), Joiner.on("\n").join(actual.getResult()));
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:12,代碼來源:SyntacticSequencerTest.java


注:本文中的org.eclipse.xtext.serializer.sequencer.ISemanticSequencer.init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。