From 45f858db15e89dbea67fdba00e46dd60cc88e5c5 Mon Sep 17 00:00:00 2001 From: Allan Bowe <> Date: Sun, 3 Jan 2021 22:35:56 +0000 Subject: [PATCH] fix: scope of json var, brining the %inc _inside_ the macro --- all.sas | 5 +++-- build.py | 7 ++++--- lua/json.lua | 2 +- lua/ml_json.sas | 5 +++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/all.sas b/all.sas index 81087a3..a2cef6f 100644 --- a/all.sas +++ b/all.sas @@ -13572,7 +13572,7 @@ data _null_; put '-- SOFTWARE. '; put '-- '; put ' '; - put 'local json = { _version = "0.1.2" } '; + put 'json = { _version = "0.1.2" } '; put ' '; put '------------------------------------------------------------------------------- '; put '-- Encode '; @@ -13920,6 +13920,7 @@ data _null_; put ' '; put 'return json '; run; -%mend; %inc "%sysfunc(pathname(work))/ml_json.lua"; + +%mend; diff --git a/build.py b/build.py index fc36bfc..96b5377 100755 --- a/build.py +++ b/build.py @@ -21,9 +21,10 @@ for file in files: with open(file) as infile: for line in infile: ml.write(" put '" + line.rstrip().replace("'","''") + " ';\n") - ml.write("run;\n") - ml.write("%mend;\n\n") - ml.write("%inc \"%sysfunc(pathname(work))/" + name + ".lua\";\n") + ml.write("run;\n\n") + ml.write("%inc \"%sysfunc(pathname(work))/" + name + ".lua\";\n\n") + ml.write("%mend;\n") + ml.close() # prepare web files diff --git a/lua/json.lua b/lua/json.lua index b7f7827..1994588 100644 --- a/lua/json.lua +++ b/lua/json.lua @@ -22,7 +22,7 @@ -- SOFTWARE. -- -local json = { _version = "0.1.2" } +json = { _version = "0.1.2" } ------------------------------------------------------------------------------- -- Encode diff --git a/lua/ml_json.sas b/lua/ml_json.sas index ffd00a6..2493e5d 100644 --- a/lua/ml_json.sas +++ b/lua/ml_json.sas @@ -36,7 +36,7 @@ data _null_; put '-- SOFTWARE. '; put '-- '; put ' '; - put 'local json = { _version = "0.1.2" } '; + put 'json = { _version = "0.1.2" } '; put ' '; put '------------------------------------------------------------------------------- '; put '-- Encode '; @@ -384,6 +384,7 @@ data _null_; put ' '; put 'return json '; run; -%mend; %inc "%sysfunc(pathname(work))/ml_json.lua"; + +%mend;