feat(lua): low-level interpreter mode (nvim -ll)

This commit is contained in:
bfredl
2022-02-26 15:19:10 +01:00
parent facbb11e05
commit d6d6ab3f8e
4 changed files with 77 additions and 23 deletions

View File

@@ -239,6 +239,14 @@ int main(int argc, char **argv)
argv0 = argv[0];
if (argc > 1 && STRICMP(argv[1], "-ll") == 0) {
if (argc == 2) {
print_mainerr(err_arg_missing, argv[1]);
exit(1);
}
nlua_run_script(argv, argc, 3);
}
char *fname = NULL; // file name from command line
mparm_T params; // various parameters passed between
// main() and other functions.
@@ -2110,6 +2118,12 @@ static int execute_env(char *env)
/// @param str string to append to the primary error message, or NULL
static void mainerr(const char *errstr, const char *str)
FUNC_ATTR_NORETURN
{
print_mainerr(errstr, str);
os_exit(1);
}
static void print_mainerr(const char *errstr, const char *str)
{
char *prgname = path_tail(argv0);
@@ -2126,8 +2140,6 @@ static void mainerr(const char *errstr, const char *str)
os_errmsg(_("\nMore info with \""));
os_errmsg(prgname);
os_errmsg(" -h\"\n");
os_exit(1);
}
/// Prints version information for "nvim -v" or "nvim --version".