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

项目: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-core    文件:HiddenTokenSequencerTest.java   
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)));
}
项目: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-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    文件: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    文件:FormatterTest.java   
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);
}
项目: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()));
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return PkmntcgoSyntacticSequencer.class;
}
项目:n4js    文件:AbstractTypeExpressionsRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return TypeExpressionsSyntacticSequencer.class;
}
项目:n4js    文件:AbstractTypesRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return TypesSyntacticSequencer.class;
}
项目:n4js    文件:AbstractUnicodeRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return UnicodeSyntacticSequencer.class;
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return RegularExpressionSyntacticSequencer.class;
}
项目:n4js    文件:AbstractN4JSRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return N4JSSyntacticSequencer.class;
}
项目:n4js    文件:AbstractN4MFRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return N4MFSyntacticSequencer.class;
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return MyDslSyntacticSequencer.class;
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return BromiumSyntacticSequencer.class;
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return DSLPoliciesSyntacticSequencer.class;
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return LcDslSyntacticSequencer.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return DslSyntacticSequencer.class;
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return RestauranteSyntacticSequencer.class;
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return OCCISyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractPureXbaseRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return PureXbaseSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractXbaseRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return XbaseSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return XbaseWithAnnotationsSyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractBug362902RuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return Bug362902SyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractInheritanceTest2LanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return InheritanceTest2LanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractRefactoringTestLanguage1RuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return RefactoringTestLanguage1SyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractSyntacticSequencerTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return SyntacticSequencerTestLanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractRefactoringTestLanguage2RuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return RefactoringTestLanguage2SyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractBuilderTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return BuilderTestLanguageSyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractActionTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return ActionTestLanguageSyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractXtextGrammarTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return XtextGrammarTestLanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractXImportSectionTestLangRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return XImportSectionTestLangSyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractIgnoreCaseNamespacesTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return IgnoreCaseNamespacesTestLanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractGrammarAccessTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return GrammarAccessTestLanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractEnumRulesTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return EnumRulesTestLanguageSyntacticSequencer.class;
}
项目:xtext-extras    文件:AbstractMultiRuleEnumTestLanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return MultiRuleEnumTestLanguageSyntacticSequencer.class;
}
项目:xtext-core    文件:AbstractInheritanceTest3LanguageRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return InheritanceTest3LanguageSyntacticSequencer.class;
}
项目:M2Doc    文件:AbstractMyDslRuntimeModule.java   
public Class<? extends ISyntacticSequencer> bindISyntacticSequencer() {
    return MyDslSyntacticSequencer.class;
}