Search in sources :

Example 1 with CommonsGenericBuilderAdapter

use of org.whole.lang.commons.builders.CommonsGenericBuilderAdapter in project whole by wholeplatform.

the class CommonsLanguageDeployer method deploy.

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

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new CommonsGenericBuilderAdapter((ICommonsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new CommonsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {

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

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

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

        public IVisitor create(IOperation operation, int stage) {
            return new CommonsPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, FindDeclarationOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, FindDeclarationsOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, IOperation.ANY_ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new CommonsInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) CommonsContentAssistVisitor(org.whole.lang.commons.visitors.CommonsContentAssistVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) CommonsGenericBuilderAdapter(org.whole.lang.commons.builders.CommonsGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder) CommonsPrettyPrinterVisitor(org.whole.lang.commons.visitors.CommonsPrettyPrinterVisitor) CommonsDynamicCompilerVisitor(org.whole.lang.commons.visitors.CommonsDynamicCompilerVisitor) CommonsInterpreterVisitor(org.whole.lang.commons.visitors.CommonsInterpreterVisitor) CommonsSpecificBuilderAdapter(org.whole.lang.commons.builders.CommonsSpecificBuilderAdapter)

Aggregations

IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 CommonsGenericBuilderAdapter (org.whole.lang.commons.builders.CommonsGenericBuilderAdapter)1 CommonsSpecificBuilderAdapter (org.whole.lang.commons.builders.CommonsSpecificBuilderAdapter)1 ICommonsBuilder (org.whole.lang.commons.builders.ICommonsBuilder)1 CommonsContentAssistVisitor (org.whole.lang.commons.visitors.CommonsContentAssistVisitor)1 CommonsDynamicCompilerVisitor (org.whole.lang.commons.visitors.CommonsDynamicCompilerVisitor)1 CommonsInterpreterVisitor (org.whole.lang.commons.visitors.CommonsInterpreterVisitor)1 CommonsPrettyPrinterVisitor (org.whole.lang.commons.visitors.CommonsPrettyPrinterVisitor)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IOperation (org.whole.lang.operations.IOperation)1 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1