1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 17:59:30 +00:00

Added cancheck; candran.compile, .make and .preprocess returns nil, err instead of throwing an error; can and canc error output should now be similar to Lua

This commit is contained in:
Étienne Fildadut 2020-04-06 21:30:57 +02:00
parent dc19ac56a9
commit 1de0aafa5b
9 changed files with 412 additions and 226 deletions

View file

@ -1,4 +1,5 @@
#!/bin/lua
#!/usr/bin/env lua
local candran = require("candran")
local cmdline = require("candran.cmdline")
local parse = require("candran.can-parser.parser").parse
@ -78,13 +79,28 @@ for _, file in ipairs(args) do
local out = input
if args.preprocess then
out = candran.preprocess(out, args)
local r, err = candran.preprocess(out, args)
if not r then
print("canc: "..err)
os.exit(1)
end
out = r
end
if args.compile then
out = candran.compile(out, args)
local r, err = candran.compile(out, args)
if not r then
print("canc: "..err)
os.exit(1)
end
out = r
end
if args.compile == nil and args.preprocess == nil then
out = candran.make(input, args)
local r, err = candran.make(input, args)
if not r then
print("canc: "..err)
os.exit(1)
end
out = r
end
if args.print then