Search in sources :

Example 1 with GrammarsInterpreterVisitor

use of org.whole.lang.grammars.visitors.GrammarsInterpreterVisitor in project whole by wholeplatform.

the class CoreOperationsDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addOperationFactory(EditorsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new EditorsArtifactsGeneratorVisitor((ArtifactsGeneratorOperation) operation);
        }
    });
    platform.addOperationFactory(GrammarsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new GrammarsContentAssistVisitor();
        }
    });
    platform.addOperationFactory(GrammarsLanguageKit.URI, ValidatorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new GrammarsValidatorVisitor();
        }
    });
    if (!ReflectionFactory.getLanguageKit(GrammarsLanguageKit.URI, false, null).hasVisitor(InterpreterOperation.ID))
        platform.addOperationFactory(GrammarsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

            public IVisitor create(IOperation operation, int stage) {
                if (stage == 0)
                    return new GrammarsInterpreterVisitor();
                else
                    return null;
            }
        });
    platform.addPersistenceKit("org.whole.lang.grammars.GrammarEditor", GrammarsPersistenceKit.instance());
    platform.addPersistenceKit("org.whole.lang.objectivec.ObjectiveCEditor", ObjectiveCPersistenceKit.instance());
    platform.addPersistenceKit("org.whole.lang.mediawiki.MediaWikiEditor", MediaWikiPersistenceKit.instance());
    platform.addOperationFactory(TemplatesLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new AbstractVisitor() {

                public void visit(IEntity entity) {
                    BehaviorUtils.apply("whole:org.whole.lang.templates:TemplatesSemantics#toJava", entity, getBindings());
                }
            };
        }
    });
    platform.addOperationFactory(PojoLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new PojoArtifactsGeneratorVisitor((ArtifactsGeneratorOperation) operation);
        }
    });
    platform.addOperationFactory(FramesLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new FramesInterpreterVisitor();
            else
                return null;
        }
    });
    // TODO test
    // ReflectLibrary.deploy();
    new ReflectLibraryDeployer().deploy(platform);
    new ViewDerivationLibraryDeployer().deploy(platform);
}
Also used : IOperation(org.whole.lang.operations.IOperation) AbstractVisitor(org.whole.lang.visitors.AbstractVisitor) EditorsArtifactsGeneratorVisitor(org.whole.lang.editors.visitors.EditorsArtifactsGeneratorVisitor) GrammarsInterpreterVisitor(org.whole.lang.grammars.visitors.GrammarsInterpreterVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntity(org.whole.lang.model.IEntity) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) FramesInterpreterVisitor(org.whole.lang.frames.visitors.FramesInterpreterVisitor) GrammarsContentAssistVisitor(org.whole.lang.grammars.visitors.GrammarsContentAssistVisitor) PojoArtifactsGeneratorVisitor(org.whole.lang.pojo.visitors.PojoArtifactsGeneratorVisitor) ReflectLibraryDeployer(org.whole.lang.ReflectLibraryDeployer) ArtifactsGeneratorOperation(org.whole.lang.operations.ArtifactsGeneratorOperation) ViewDerivationLibraryDeployer(org.whole.lang.ViewDerivationLibraryDeployer) GrammarsValidatorVisitor(org.whole.lang.grammars.visitors.GrammarsValidatorVisitor)

Aggregations

ReflectLibraryDeployer (org.whole.lang.ReflectLibraryDeployer)1 ViewDerivationLibraryDeployer (org.whole.lang.ViewDerivationLibraryDeployer)1 EditorsArtifactsGeneratorVisitor (org.whole.lang.editors.visitors.EditorsArtifactsGeneratorVisitor)1 FramesInterpreterVisitor (org.whole.lang.frames.visitors.FramesInterpreterVisitor)1 GrammarsContentAssistVisitor (org.whole.lang.grammars.visitors.GrammarsContentAssistVisitor)1 GrammarsInterpreterVisitor (org.whole.lang.grammars.visitors.GrammarsInterpreterVisitor)1 GrammarsValidatorVisitor (org.whole.lang.grammars.visitors.GrammarsValidatorVisitor)1 IEntity (org.whole.lang.model.IEntity)1 ArtifactsGeneratorOperation (org.whole.lang.operations.ArtifactsGeneratorOperation)1 IOperation (org.whole.lang.operations.IOperation)1 PojoArtifactsGeneratorVisitor (org.whole.lang.pojo.visitors.PojoArtifactsGeneratorVisitor)1 AbstractVisitor (org.whole.lang.visitors.AbstractVisitor)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1