From 1c9c7753adf20ee0e37febb19bbcdb88ead1bc15 Mon Sep 17 00:00:00 2001 From: Hugo Musso Gualandi Date: Tue, 24 May 2022 19:14:47 +0200 Subject: [PATCH] Rename args --> opts To avoid confusion with the similarly-named "arg" --- src/pallene/pallenec.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pallene/pallenec.lua b/src/pallene/pallenec.lua index 5670fdee..8821dc1b 100644 --- a/src/pallene/pallenec.lua +++ b/src/pallene/pallenec.lua @@ -19,7 +19,7 @@ local pallenec = {} local compiler_name = arg[0] -- Command-line options -local args +local opts do local p = argparse("pallenec", "Pallene compiler") p:argument("source_file", "File to compile") @@ -39,20 +39,20 @@ do p:option("-o --output", "Output file path") - args = p:parse() + opts = p:parse() end local function compile(in_ext, out_ext) - local ok, errs = driver.compile(compiler_name, args.O, in_ext, out_ext, args.source_file, - args.output) + local ok, errs = driver.compile(compiler_name, opts.O, in_ext, out_ext, opts.source_file, + opts.output) if not ok then util.abort(table.concat(errs, "\n")) end end local function compile_up_to(stop_after) - local input, err = driver.load_input(args.source_file) + local input, err = driver.load_input(opts.source_file) if err then util.abort(err) end - local out, errs = driver.compile_internal(args.source_file, input, stop_after, args.O) + local out, errs = driver.compile_internal(opts.source_file, input, stop_after, opts.O) if not out then util.abort(table.concat(errs, "\n")) end return out @@ -64,10 +64,10 @@ local function do_print_ir() end function pallenec.main() - if args.emit_c then compile("pln", "c") - elseif args.emit_lua then compile("pln", "lua") - elseif args.compile_c then compile("c" , "so") - elseif args.print_ir then do_print_ir() + if opts.emit_c then compile("pln", "c") + elseif opts.emit_lua then compile("pln", "lua") + elseif opts.compile_c then compile("c" , "so") + elseif opts.print_ir then do_print_ir() else --[[default]] compile("pln", "so") end end