Java 类org.eclipse.xtext.serializer.sequencer.ISemanticSequencer 实例源码

项目:xtext-core    文件:AbstractSemanticSequencerTest.java   
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;
}
项目:xtext-core    文件:PartialSerializer.java   
@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);
}
项目:xtext-extras    文件:SerializerFragment.java   
@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();
}
项目:xtext-extras    文件:SerializerTester.java   
/**
 * @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 "";
    }
}
项目:xtext-core    文件:SyntacticSequencerTest.java   
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()));
}
项目:xtext-core    文件:SequenceFeeder.java   
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;
}
项目:xtext-core    文件:Serializer.java   
/**
 * @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);
}
项目:xtext-core    文件:Serializer.java   
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);
}
项目:xtext-core    文件:SerializerFragment2.java   
@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());
    }
  }
}
项目:xtext-core    文件:SerializerTestHelper.java   
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 "";
    }
}
项目:xtext-core    文件:SyntacticSequencerTest.java   
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()));
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return PkmntcgoSemanticSequencer.class;
}
项目:n4js    文件:AbstractTypeExpressionsRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return TypeExpressionsSemanticSequencer.class;
}
项目:n4js    文件:AbstractTypesRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return TypesSemanticSequencer.class;
}
项目:n4js    文件:AbstractUnicodeRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return UnicodeSemanticSequencer.class;
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return RegularExpressionSemanticSequencer.class;
}
项目:n4js    文件:AbstractN4JSRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return N4JSSemanticSequencer.class;
}
项目:n4js    文件:AbstractN4MFRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return N4MFSemanticSequencer.class;
}
项目:DocIT    文件:AbstractIOISemanticSequencer.java   
@Override
public void init(ISemanticSequencer sequencer, ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
    super.init(sequencer, sequenceAcceptor, errorAcceptor);
    this.genericSequencer = genericSequencerProvider.get();
    this.genericSequencer.init(sequencer, sequenceAcceptor, errorAcceptor);
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return MyDslSemanticSequencer.class;
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return BromiumSemanticSequencer.class;
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return DSLPoliciesSemanticSequencer.class;
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return LcDslSemanticSequencer.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return DslSemanticSequencer.class;
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return RestauranteSemanticSequencer.class;
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return OCCISemanticSequencer.class;
}
项目:jason-eclipse-plugin    文件:AbstractMas2jSemanticSequencer.java   
@Override
public void init(ISemanticSequencer sequencer, ISemanticSequenceAcceptor sequenceAcceptor, Acceptor errorAcceptor) {
    super.init(sequencer, sequenceAcceptor, errorAcceptor);
    this.genericSequencer = genericSequencerProvider.get();
    this.genericSequencer.init(sequencer, sequenceAcceptor, errorAcceptor);
}
项目:xtext-core    文件:AbstractInheritanceTest2LanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return InheritanceTest2LanguageSemanticSequencer.class;
}
项目:xtext-extras    文件:AbstractXbaseRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return XbaseSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractFowlerDslTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return FowlerDslTestLanguageSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractBacktrackingLexerTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return BacktrackingLexerTestLanguageSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractInheritanceTest3LanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return InheritanceTest3LanguageSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractImportUriTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return ImportUriTestLanguageSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractBug305397RuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return Bug305397SemanticSequencer.class;
}
项目:xtext-core    文件:AbstractSyntacticSequencerTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return SyntacticSequencerTestLanguageSemanticSequencer.class;
}
项目:xtext-extras    文件:AbstractBuilderTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return BuilderTestLanguageSemanticSequencer.class;
}
项目:xtext-extras    文件:AbstractBug462047LangRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return Bug462047LangSemanticSequencer.class;
}
项目:xtext-extras    文件:AbstractXImportSectionTestLangRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return XImportSectionTestLangSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractEnumAndReferenceTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return EnumAndReferenceTestLanguageSemanticSequencer.class;
}
项目:xtext-core    文件:AbstractXtextGrammarTestLanguageRuntimeModule.java   
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
    return XtextGrammarTestLanguageSemanticSequencer.class;
}