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


Java ISemanticSequencer類代碼示例

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


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

示例1: 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

示例2: 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

示例3: getGuiceBindingsRt

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final BindFactory bf = new BindFactory();
  bf.addTypeToType(ISemanticSequencer.class.getName(), this.names.getSemanticSequencer().getQualifiedName());
  bf.addTypeToType(ISyntacticSequencer.class.getName(), this.names.getSyntacticSequencer().getQualifiedName());
  bf.addTypeToType(ISerializer.class.getName(), Serializer.class.getName());
  return bf.getBindings();
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:9,代碼來源:SerializerFragment.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: 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

示例6: SequenceFeeder

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

示例7: 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

示例8: generate

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
@Override
public void generate() {
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(ISemanticSequencer.class), this.getSemanticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISyntacticSequencer.class), this.getSyntacticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISerializer.class), TypeReference.typeRef(Serializer.class)).contributeTo(this.getLanguage().getRuntimeGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
    String _serializerBasePackage = this.getSerializerBasePackage(this.getGrammar());
    _exportedPackages.add(_serializerBasePackage);
    Set<String> _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles();
    String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
    String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
    String _plus_1 = (_plus + "\"");
    _requiredBundles.add(_plus_1);
  }
  this.generateAbstractSemanticSequencer();
  this.generateAbstractSyntacticSequencer();
  boolean _isGenerateStub = this.isGenerateStub();
  if (_isGenerateStub) {
    this.generateSemanticSequencer();
    this.generateSyntacticSequencer();
  }
  if (this.generateDebugData) {
    this.generateGrammarConstraints();
    Iterable<Pair<String, String>> _generateDebugGraphs = this.debugGraphGenerator.generateDebugGraphs();
    for (final Pair<String, String> fileToContent : _generateDebugGraphs) {
      this.getProjectConfig().getRuntime().getSrcGen().generateFile(fileToContent.getKey(), fileToContent.getValue());
    }
  }
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:31,代碼來源:SerializerFragment2.java

示例9: 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

示例10: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return PkmntcgoSemanticSequencer.class;
}
 
開發者ID:rehne93,項目名稱:pokemon-tcgo-deck-generator,代碼行數:4,代碼來源:AbstractPkmntcgoRuntimeModule.java

示例11: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return TypeExpressionsSemanticSequencer.class;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:4,代碼來源:AbstractTypeExpressionsRuntimeModule.java

示例12: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return TypesSemanticSequencer.class;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:4,代碼來源:AbstractTypesRuntimeModule.java

示例13: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return UnicodeSemanticSequencer.class;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:4,代碼來源:AbstractUnicodeRuntimeModule.java

示例14: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return RegularExpressionSemanticSequencer.class;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:4,代碼來源:AbstractRegularExpressionRuntimeModule.java

示例15: bindISemanticSequencer

import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer; //導入依賴的package包/類
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
	return N4JSSemanticSequencer.class;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:4,代碼來源:AbstractN4JSRuntimeModule.java


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