Search in sources :

Example 1 with IVisitorFactory

use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.

the class GenOperationsDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    // from java (legacy)
    platform.addOperationFactory(JavaLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new JavaJavaModelGeneratorVisitor();
            else
                return new JavaJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    // from artifacts (core)
    platform.addOperationFactory(ArtifactsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ArtifactsJavaModelGeneratorVisitor();
            else
                return new ArtifactsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    platform.addOperationFactory(ArtifactsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            // if (stage == 0)
            IBindingManager args = operation.getOperationEnvironment();
            if (args.wIsSet("resourceKind") && ResourceKindEnum.FILE_SYSTEM.equals(((ResourceKind) args.wGet("resourceKind")).getValue()))
                return new ResourceArtifactsGeneratorVisitor();
            else
                return new WorkspaceArtifactsGeneratorVisitor();
        }
    });
    // from editors (core)
    // platform.addOperationFactory(EditorsLanguageKit.URI, JavaCompilerOperation.ID,
    // new IVisitorFactory() {
    // public IVisitor create(IOperation operation, int stage) {
    // if (stage == 0)
    // return new EditorsJavaModelGeneratorVisitor();
    // else
    // return new EditorsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
    // }
    // });
    // misc (core)
    platform.addOperationFactory(MiscLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new MiscTraverseAllVisitor();
            else
                return new MiscJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    // from models (core)
    platform.addOperationFactory(ModelsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ModelsJavaModelGeneratorVisitor();
            else
                return new ModelsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    platform.addOperationFactory(GrammarsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new GrammarsJavaModelGeneratorVisitor();
        }
    });
    // from pojo (core.op)
    platform.addOperationFactory(PojoLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new PojoJavaModelGeneratorVisitor();
            else
                return new PojoJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) ModelsJavaModelGeneratorVisitor(org.whole.lang.visitors.ModelsJavaModelGeneratorVisitor) PojoJavaModelGeneratorVisitor(org.whole.lang.visitors.PojoJavaModelGeneratorVisitor) IVisitor(org.whole.lang.visitors.IVisitor) ResourceArtifactsGeneratorVisitor(org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor) GrammarsJavaModelGeneratorVisitor(org.whole.lang.visitors.GrammarsJavaModelGeneratorVisitor) JavaCompilerOperation(org.whole.lang.operations.JavaCompilerOperation) MiscTraverseAllVisitor(org.whole.lang.misc.visitors.MiscTraverseAllVisitor) MiscJavaStoreGeneratorVisitor(org.whole.lang.visitors.MiscJavaStoreGeneratorVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) JavaJavaStoreGeneratorVisitor(org.whole.lang.visitors.JavaJavaStoreGeneratorVisitor) ArtifactsJavaModelGeneratorVisitor(org.whole.lang.visitors.ArtifactsJavaModelGeneratorVisitor) WorkspaceArtifactsGeneratorVisitor(org.whole.lang.visitors.WorkspaceArtifactsGeneratorVisitor) JavaJavaModelGeneratorVisitor(org.whole.lang.visitors.JavaJavaModelGeneratorVisitor) IBindingManager(org.whole.lang.bindings.IBindingManager) PojoJavaStoreGeneratorVisitor(org.whole.lang.visitors.PojoJavaStoreGeneratorVisitor) ModelsJavaStoreGeneratorVisitor(org.whole.lang.visitors.ModelsJavaStoreGeneratorVisitor) ArtifactsJavaStoreGeneratorVisitor(org.whole.lang.visitors.ArtifactsJavaStoreGeneratorVisitor)

Example 2 with IVisitorFactory

use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.

the class MiscLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new MiscLanguageKit());
    platform.addOperationFactory(MiscLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MiscGenericBuilderAdapter((IMiscBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(MiscLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MiscSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(MiscLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

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

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new MiscOperationVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(MiscLanguageKit.URI, ValidatorOperation.ID, new IVisitorFactory() {

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

        public IVisitor create(IOperation operation, int stage) {
            return new MiscOperationVisitor();
        }
    });
    platform.addOperationFactory(MiscLanguageKit.URI, NormalizerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new MiscOperationVisitor();
        }
    });
    platform.addOperationFactory(MiscLanguageKit.URI, DynamicCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new MiscDynamicCompilerVisitor();
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) MiscDynamicCompilerVisitor(org.whole.lang.misc.visitors.MiscDynamicCompilerVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) IMiscBuilder(org.whole.lang.misc.builders.IMiscBuilder) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) MiscGenericBuilderAdapter(org.whole.lang.misc.builders.MiscGenericBuilderAdapter) MiscSpecificBuilderAdapter(org.whole.lang.misc.builders.MiscSpecificBuilderAdapter) MiscOperationVisitor(org.whole.lang.misc.visitors.MiscOperationVisitor)

Example 3 with IVisitorFactory

use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.

the class MathLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new MathLanguageKit());
    platform.addOperationFactory(MathLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MathGenericBuilderAdapter((IMathBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(MathLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new MathSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(MathLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new MathInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) MathInterpreterVisitor(org.whole.lang.math.visitors.MathInterpreterVisitor) IMathBuilder(org.whole.lang.math.builders.IMathBuilder) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) MathGenericBuilderAdapter(org.whole.lang.math.builders.MathGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) MathSpecificBuilderAdapter(org.whole.lang.math.builders.MathSpecificBuilderAdapter)

Example 4 with IVisitorFactory

use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.

the class ReusablesLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new ReusablesLanguageKit());
    platform.addOperationFactory(ReusablesLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ReusablesGenericBuilderAdapter((IReusablesBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ReusablesLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ReusablesSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ReusablesLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ReusablesInterpreterVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(ReusablesLanguageKit.URI, DynamicCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ReusablesDynamicCompilerVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(ReusablesLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ReusablesArtifactsGeneratorVisitor();
        }
    });
// platform.addReactionsHandler(ReusablesLanguageKit.URI, new ReusablesReactionsHandler());
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) ReusablesDynamicCompilerVisitor(org.whole.lang.reusables.visitors.ReusablesDynamicCompilerVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) ReusablesGenericBuilderAdapter(org.whole.lang.reusables.builders.ReusablesGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) ReusablesSpecificBuilderAdapter(org.whole.lang.reusables.builders.ReusablesSpecificBuilderAdapter) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ReusablesArtifactsGeneratorVisitor(org.whole.lang.reusables.visitors.ReusablesArtifactsGeneratorVisitor) IReusablesBuilder(org.whole.lang.reusables.builders.IReusablesBuilder) ReusablesInterpreterVisitor(org.whole.lang.reusables.visitors.ReusablesInterpreterVisitor)

Example 5 with IVisitorFactory

use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.

the class ModelsLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new ModelsLanguageKit());
    platform.addOperationFactory(ModelsLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ModelsGenericBuilderAdapter((IModelsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ModelsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, ExportTexOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new TeXGeneratorVisitor((ExportTexOperation) operation);
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

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

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

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ModelsInterpreterVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(ModelsLanguageKit.URI, NormalizerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ModelsNormalizerVisitor();
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) TeXGeneratorVisitor(org.whole.lang.models.visitors.TeXGeneratorVisitor) IModelsBuilder(org.whole.lang.models.builders.IModelsBuilder) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ModelsSpecificBuilderAdapter(org.whole.lang.models.builders.ModelsSpecificBuilderAdapter) ModelsPrettyPrinterVisitor(org.whole.lang.models.visitors.ModelsPrettyPrinterVisitor) ExportTexOperation(org.whole.lang.operations.ExportTexOperation) ModelsGenericBuilderAdapter(org.whole.lang.models.builders.ModelsGenericBuilderAdapter) ModelsInterpreterVisitor(org.whole.lang.models.visitors.ModelsInterpreterVisitor) ModelsNormalizerVisitor(org.whole.lang.models.visitors.ModelsNormalizerVisitor) ModelsValidatorVisitor(org.whole.lang.models.visitors.ModelsValidatorVisitor)

Aggregations

IOperation (org.whole.lang.operations.IOperation)36 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)36 IVisitor (org.whole.lang.visitors.IVisitor)34 IBuilder (org.whole.lang.builders.IBuilder)20 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)20 IEntityContext (org.whole.lang.contexts.IEntityContext)20 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)13 ResourceArtifactsGeneratorVisitor (org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor)2 IBindingManager (org.whole.lang.bindings.IBindingManager)2 IImpBuilder (org.whole.examples.lang.imp.builders.IImpBuilder)1 ImpGenericBuilderAdapter (org.whole.examples.lang.imp.builders.ImpGenericBuilderAdapter)1 ImpSpecificBuilderAdapter (org.whole.examples.lang.imp.builders.ImpSpecificBuilderAdapter)1 BytecodeGeneratorOperation (org.whole.examples.lang.imp.visitors.BytecodeGeneratorOperation)1 ImpBytecodeGeneratorVisitor (org.whole.examples.lang.imp.visitors.ImpBytecodeGeneratorVisitor)1 ImpDefUseValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpDefUseValidatorVisitor)1 ImpInterpreterVisitor (org.whole.examples.lang.imp.visitors.ImpInterpreterVisitor)1 ImpPrettyPrinterVisitor (org.whole.examples.lang.imp.visitors.ImpPrettyPrinterVisitor)1 ImpResolverValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpResolverValidatorVisitor)1 ReflectLibraryDeployer (org.whole.lang.ReflectLibraryDeployer)1 ViewDerivationLibraryDeployer (org.whole.lang.ViewDerivationLibraryDeployer)1