Documentation
¶
Overview ¶
Package integration defines interfaces and helpers for writing language integrations with Serulian.
Index ¶
Constants ¶
const PROVIDER_SYMBOL_NAME = "Provider"
PROVIDER_SYMBOL_NAME defines the name of the symbol to be exported by dynamic language integration provider plugins.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LanguageIntegration ¶
type LanguageIntegration interface { // GraphID returns the ID for this integration's nodes in the graph. Must match the Kind // in the SourceHandler. GraphID() string // SourceHandler returns the source handler used to load, parse and validate the input // source file(s) for the integrated language or system. Note that calling this method // will typically start a modifier, so it should only be called if the full handler // lifecycle will be used. SourceHandler() packageloader.SourceHandler // TypeConstructor returns the type constructor used to construct the types and members that // should be added to the type system by the integrated language or system. TypeConstructor() typegraph.TypeGraphConstructor // PathHandler returns a handler for translating generated paths to those provided by the integration. // If the integration returns nil, then no translation is done. PathHandler() PathHandler }
LanguageIntegration defines an integration of an external language or system into Serulian.
type LanguageIntegrationProvider ¶
type LanguageIntegrationProvider interface { // GetIntegration returns a new LanguageIntegration instance over the given graph. GetIntegration(graph *compilergraph.SerulianGraph) LanguageIntegration }
LanguageIntegrationProvider defines an interface for providing a LanguageIntegration implementation over a Serulian graph.
func LoadLanguageIntegrationProviders ¶
func LoadLanguageIntegrationProviders(providerDirPath string) ([]LanguageIntegrationProvider, error)
LoadLanguageIntegrationProviders loads all the language integration providers found under the given path. *All* files in the directory without an extension will be treated as a potential provider, so callers should make sure that the directory is clean otherwise. Note that if the path does not exist, the list returned will be *empty*.
type PathHandler ¶
type PathHandler interface { // GetStaticMemberPath returns the global path for the given statically defined type member. If the handler // returns empty string, the default path will be used. GetStaticMemberPath(member typegraph.TGMember, referenceType typegraph.TypeReference) string // GetModulePath returns the global path for the given module. If the handler // returns empty string, the default path will be used. GetModulePath(module typegraph.TGModule) string }
PathHandler translates various paths encountered during code generation into those provided by the integration, if any.