added a new pragma pedantic to make syntax check stricter - for now. it flags about unused local and global variables
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-12-13 22:09:05 +09:00
parent 3d64e38f5a
commit d3b90da1e7
11 changed files with 203 additions and 74 deletions

View File

@@ -333,22 +333,23 @@ struct opttab_t
const hawk_bch_t* desc;
} opttab[] =
{
{ "implicit", HAWK_IMPLICIT, "allow undeclared variables" },
{ "multilinestr", HAWK_MULTILINESTR, "allow raw multiline string and regular expression literals" },
{ "nextofile", HAWK_NEXTOFILE, "enable nextofile & OFILENAME" },
{ "rio", HAWK_RIO, "enable builtin I/O including getline & print" },
{ "rwpipe", HAWK_RWPIPE, "allow a dual-directional pipe" },
{ "newline", HAWK_NEWLINE, "enable a newline to terminate a statement" },
{ "striprecspc", HAWK_STRIPRECSPC, "strip spaces in splitting a record" },
{ "stripstrspc", HAWK_STRIPSTRSPC, "strip spaces in string-to-number conversion" },
{ "blankconcat", HAWK_BLANKCONCAT, "enable concatenation by blanks" },
{ "crlf", HAWK_CRLF, "use CRLF for a newline" },
{ "flexmap", HAWK_FLEXMAP, "allow a map to be assigned or returned" },
{ "pablock", HAWK_PABLOCK, "enable pattern-action loop" },
{ "rexbound", HAWK_REXBOUND, "enable {n,m} in a regular expression" },
{ "implicit", HAWK_IMPLICIT, "allow undeclared variables" },
{ "multilinestr", HAWK_MULTILINESTR, "allow raw multiline string and regular expression literals" },
{ "ncmponstr", HAWK_NCMPONSTR, "perform numeric comparsion on numeric strings" },
{ "newline", HAWK_NEWLINE, "enable a newline to terminate a statement" },
{ "nextofile", HAWK_NEXTOFILE, "enable nextofile & OFILENAME" },
{ "numstrdetect", HAWK_NUMSTRDETECT, "detect a numeric string and convert it to a number" },
{ "pablock", HAWK_PABLOCK, "enable pattern-action loop" },
{ "pedantic", HAWK_PEDANTIC, "enable pedantic mode" },
{ "rexbound", HAWK_REXBOUND, "enable {n,m} in a regular expression" },
{ "rio", HAWK_RIO, "enable builtin I/O including getline & print" },
{ "rwpipe", HAWK_RWPIPE, "allow a dual-directional pipe" },
{ "strictnaming", HAWK_STRICTNAMING, "enable the strict naming rule" },
{ "striprecspc", HAWK_STRIPRECSPC, "strip spaces in splitting a record" },
{ "stripstrspc", HAWK_STRIPSTRSPC, "strip spaces in string-to-number conversion" },
{ "tolerant", HAWK_TOLERANT, "make more fault-tolerant" },
{ HAWK_NULL, 0, HAWK_NULL }
};
@@ -408,22 +409,23 @@ static int process_argv (int argc, hawk_bch_t* argv[], const hawk_bch_t* real_ar
{
static hawk_bcli_lng_t lng[] =
{
{ ":implicit", '\0' },
{ ":multilinestr", '\0' },
{ ":nextofile", '\0' },
{ ":rio", '\0' },
{ ":rwpipe", '\0' },
{ ":newline", '\0' },
{ ":striprecspc", '\0' },
{ ":stripstrspc", '\0' },
{ ":blankconcat", '\0' },
{ ":crlf", '\0' },
{ ":flexmap", '\0' },
{ ":pablock", '\0' },
{ ":rexbound", '\0' },
{ ":implicit", '\0' },
{ ":multilinestr", '\0' },
{ ":ncmponstr", '\0' },
{ ":newline", '\0' },
{ ":nextofile", '\0' },
{ ":numstrdetect", '\0' },
{ ":pablock", '\0' },
{ ":pedantic", '\0' },
{ ":rexbound", '\0' },
{ ":rio", '\0' },
{ ":rwpipe", '\0' },
{ ":strictnaming", '\0' },
{ ":striprecspc", '\0' },
{ ":stripstrspc", '\0' },
{ ":tolerant", '\0' },
{ ":call", 'c' },

View File

@@ -7,7 +7,6 @@ import "io"
//import "net/http"
//import _ "net/http/pprof"
import "os"
import "path/filepath"
import "runtime"
import "runtime/debug"
import "strconv"
@@ -144,13 +143,13 @@ func run_script(h *hawk.Hawk, fs_idx int, data_idx int, cfg* Config, wg *sync.Wa
if wg != nil { defer wg.Done() }
if data_idx <= -1 {
rtx, err = h.NewRtx(filepath.Base(os.Args[0]), cfg.data_in_files, nil)
rtx, err = h.NewRtx(os.Args[0], cfg.data_in_files, nil)
} else {
var out_idx_end int = data_idx
if cfg.data_out_files[data_idx] != "" { out_idx_end++ }
rtx, err = h.NewRtx(
fmt.Sprintf("%s.%d", filepath.Base(os.Args[0]), data_idx),
fmt.Sprintf("%s.%d", os.Args[0], data_idx),
cfg.data_in_files[data_idx: data_idx + 1],
cfg.data_out_files[data_idx: out_idx_end],
)