Class TemplateModuleBase

    • Constructor Detail

      • TemplateModuleBase

        protected TemplateModuleBase()
      • TemplateModuleBase

        protected TemplateModuleBase​(LanguageRegistry languageRegistry,
                                     LanguageRuntime sourceLanguage)
        Parameters:
        languageRegistry - not null (unless your subclass overrides all the methods of this base class that need that registry).
        sourceLanguage - not null.
    • Method Detail

      • getSourceLanguage

        @NotNull
        public LanguageRuntime getSourceLanguage()
        Description copied from interface: GeneratorRuntime
        IMPLEMENTATION NOTE: Now GeneratorRuntime is instantiated with appropriate runtime instance of its language, which is natural given the way generators are declared. However, another approach seems more general and is worth considering: (a) GeneratorRuntime could answer SLanguage/set{SLanguage} itself (GR instantiated using no-arg default constructor) (b) GR doesn't tell its source language, instead, this information is recorded externally e.g. in module descriptor/manifest Though (b) is most flexible, (a) seems to be aligned with the rest of MPS and more convenient provided we need to go from GR to LR and back. (c) LanguageRuntime of source language is kept internally by GeneratorRuntime, and it registers/unregisters itself with API of attach/detach (to hide implementation details, although LR is hardly an implementation detail to hide)
        Specified by:
        getSourceLanguage in interface GeneratorRuntime
        Returns:
        language this generator is associated with
      • getEmployedGenerators

        public Collection<TemplateModule> getEmployedGenerators()
        Description copied from interface: TemplateModule
        Generators that are utilized by this one, e.g. by invoking their templates, excluding extended generators. Employed generators do not contribute their reduction rules (other than those involved through $SWITCH$ call of invoked template)
        Specified by:
        getEmployedGenerators in interface TemplateModule
      • getQueryLanguages

        public Set<SLanguage> getQueryLanguages()
        Description copied from interface: TemplateModule
        Languages we wrote queries in XXX is there need for these in generator runtime? or just in Generator SModule?
        Specified by:
        getQueryLanguages in interface TemplateModule