3#include <clingo/core/location.hh>
4#include <clingo/core/logger.hh>
6namespace CppClingo::Ground {
18 do_exec(loc, log, name, code);
22 virtual void do_exec(
Location const &loc,
Logger &log, std::string_view name, std::string_view code) = 0;
33 auto callable(std::string_view name,
size_t args) ->
bool {
return do_callable(name, args); }
36 do_call(loc, name, args, out);
40 virtual auto do_callable(std::string_view name,
size_t args) ->
bool = 0;
Interface to call functions during parsing/grounding.
Definition script.hh:28
auto callable(std::string_view name, size_t args) -> bool
Check if the function with the given name and number of arguments is callable.
Definition script.hh:33
virtual ~ScriptCallback()=default
Virtual destructor.
void call(Location const &loc, std::string_view name, SymbolSpan args, SymbolVec &out)
Call the function with the given name and arguments.
Definition script.hh:35
Interface to execute code in source files.
Definition script.hh:12
void exec(Location const &loc, Logger &log, std::string_view name, std::string_view code)
Execute the given code for the given script.
Definition script.hh:17
virtual ~ScriptExec()=default
Virtual destructor.
The Location of an expression in an input source.
Definition location.hh:44
Simple logger to report message to stderr or via a callback.
Definition logger.hh:63
std::span< Symbol const > SymbolSpan
A span of symbols.
Definition symbol.hh:218
std::vector< Symbol > SymbolVec
A vector of symbols.
Definition symbol.hh:220