From 3eeebdbf11e29a947fd4d6d64ea02f946b6d13bd Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 7 Sep 2022 22:05:58 -0700 Subject: [PATCH] Build a shebanged executable instead of a binary. This makes the build itself a lot more portable. The executable of course relies on lua being installed on the machine, but this will nearly always be the case for a program used by Fennel developers. Bonus: removes the direct use of the fennel.utils module which was only used for the table? function and was causing a warning. --- Makefile | 9 +++++---- src/fennel-ls/language.fnl | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 8398415..4edeb02 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -LUA_LIB=/usr/lib/liblua.so.5.4 -LUA_INCLUDE_DIR=/usr/include/lua5.4 FENNEL=./fennel EXE=fennel-ls @@ -11,10 +9,13 @@ SRC+=$(wildcard src/fennel-ls/*.fnl) all: $(EXE) $(EXE): $(SRC) - LUA_PATH="./src/?.lua;./src/?/init.lua" FENNEL_PATH="./src/?.fnl;./src/?/init.fnl" $(FENNEL) --compile-binary src/fennel-ls.fnl fennel-ls $(LUA_LIB) $(LUA_INCLUDE_DIR) + echo "#!/usr/bin/env lua" > $@ + LUA_PATH="./src/?.lua;./src/?/init.lua" FENNEL_PATH="./src/?.fnl;./src/?/init.fnl" \ + $(FENNEL) --require-as-include --compile src/fennel-ls.fnl >> $@ + chmod 755 $@ clean: - rm -f fennel-ls + rm -f $(EXE) test: # requires busted to be installed diff --git a/src/fennel-ls/language.fnl b/src/fennel-ls/language.fnl index 88ad0e5..ef5ebe5 100644 --- a/src/fennel-ls/language.fnl +++ b/src/fennel-ls/language.fnl @@ -2,8 +2,7 @@ The high level analysis system that does deep searches following the data provided by compiler.fnl." -(local {: sym? : list? : sequence? : sym : view} (require :fennel)) -(local {: table?} (require :fennel.utils)) +(local {: sym? : list? : sequence? : varg? : sym : view} (require :fennel)) (local utils (require :fennel-ls.utils)) (local state (require :fennel-ls.state)) @@ -147,7 +146,7 @@ the data provided by compiler.fnl." &until result] (if (contains? child byte) (recurse child byte))) - (table? ast) + (and (not (sym? ast)) (not (varg? ast))) (accumulate [(result done) nil key value (pairs ast) &until done]