Interface BuiltinProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Hook for registering built-in symbols into the symbol table before any
user-defined symbols are processed.
Implement this interface to provide functions and/or relations that are
available in every .relix script without an explicit import.
Common examples include mathematical functions (abs, ceil,
floor), string utilities (length, upper), and
aggregate helpers (coalesce, now).
The interface is FunctionalInterface so it can be expressed as a
lambda or method reference:
BuiltinProvider myBuiltins = table -> {
table.register(ScalarFunctionSymbol.builder("length")
.namespace("builtin")
.provenance(Provenance.BUILTIN)
.shadowPolicy(ShadowPolicy.FORBIDDEN)
.parameter("s", ScalarType.STRING)
.returnType(ScalarType.NUMBER)
.build());
};
SemanticAnalyzer analyzer = new SemanticAnalyzer(loader, myBuiltins);
Use none() to explicitly pass a no-op provider.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BuiltinProvidernone()Returns aBuiltinProviderthat registers nothing.voidregister(SymbolTable symbolTable) Registers built-in symbols intosymbolTable.
-
Method Details
-
register
Registers built-in symbols intosymbolTable.Called once, before user-defined symbols are collected. Any symbol registered here is visible to every script processed by the analyser.
- Parameters:
symbolTable- the symbol table to populate; never null
-
none
Returns aBuiltinProviderthat registers nothing.- Returns:
- a no-op provider
-