From 01464d1fb14eb1461dad7c1d19039f77798a55b8 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 3 Jan 2020 10:22:23 +0000 Subject: [PATCH] better error information handling in parse.c --- hawk/Makefile.in | 4 +-- hawk/configure | 2 +- hawk/configure.ac | 2 +- hawk/lib/err.c | 18 +++++----- hawk/lib/hawk-cfg.h.in | 6 ++++ hawk/lib/hawk-cmn.h | 16 ++++----- hawk/lib/mod-math.c | 13 +++---- hawk/lib/parse.c | 79 ++++++++++++++++++------------------------ hawk/t/test.txt | 35 +++++++++++++++++++ 9 files changed, 102 insertions(+), 73 deletions(-) diff --git a/hawk/Makefile.in b/hawk/Makefile.in index 4be8f379..6e2d3b40 100644 --- a/hawk/Makefile.in +++ b/hawk/Makefile.in @@ -167,8 +167,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \ $(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \ $(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing ac/ar-lib \ - ac/compile ac/config.guess ac/config.sub ac/install-sh \ - ac/ltmain.sh ac/missing + ac/compile ac/config.guess ac/config.sub ac/depcomp \ + ac/install-sh ac/ltmain.sh ac/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) diff --git a/hawk/configure b/hawk/configure index 25397996..ef44c1b5 100755 --- a/hawk/configure +++ b/hawk/configure @@ -18841,7 +18841,7 @@ _ACEOF fi done -for ac_func in snprintf _vsnprintf _vsnwprintf strerror_r random_r random +for ac_func in snprintf _vsnprintf _vsnwprintf strerror_r initstate_r srandom_r random_r random do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/hawk/configure.ac b/hawk/configure.ac index 709dba5f..5bd0dbff 100644 --- a/hawk/configure.ac +++ b/hawk/configure.ac @@ -205,7 +205,7 @@ AC_CHECK_FUNCS([backtrace backtrace_symbols]) AC_CHECK_FUNCS([makecontext swapcontext getcontext setcontext]) AC_CHECK_FUNCS([clock_nanosleep nanosleep usleep select]) AC_CHECK_FUNCS([sigaction signal getpgid getpgrp]) -AC_CHECK_FUNCS([snprintf _vsnprintf _vsnwprintf strerror_r random_r random]) +AC_CHECK_FUNCS([snprintf _vsnprintf _vsnwprintf strerror_r initstate_r srandom_r random_r random]) AC_CHECK_FUNCS([accept4 pipe2 epoll_create epoll_create1 kqueue kqueue1]) AC_CHECK_FUNCS([isatty mmap munmap]) AC_CHECK_FUNCS([readdir64 dirfd faccessat]) diff --git a/hawk/lib/err.c b/hawk/lib/err.c index fb1c2972..9db7f1c3 100644 --- a/hawk/lib/err.c +++ b/hawk/lib/err.c @@ -82,25 +82,25 @@ const hawk_ooch_t* hawk_dflerrstr (hawk_t* awk, hawk_errnum_t errnum) HAWK_T("comma expected in place of '${0}'"), HAWK_T("semicolon expected in place of '${0}'"), HAWK_T("colon expected in place of '${0}'"), - HAWK_T("integer literal expected in place of '${0}'"), + HAWK_T("integer literal expected"), HAWK_T("statement not ending with a semicolon"), HAWK_T("keyword 'in' expected in place of '${0}'"), HAWK_T("right-hand side of 'in' not a variable"), - HAWK_T("expression not recognized around"), + HAWK_T("expression not recognized"), - HAWK_T("keyword 'function' expected in place of '${0}'"), + HAWK_T("keyword 'function' expected"), HAWK_T("keyword 'while' expected in place of '${0}'"), HAWK_T("invalid assignment statement"), HAWK_T("identifier expected in place of '${0}'"), HAWK_T("'${0}' not a valid function name"), HAWK_T("BEGIN not followed by left bracket on the same line"), HAWK_T("END not followed by left bracket on the same line"), - HAWK_T("keyword '${0}' redefined"), - HAWK_T("intrinsic function '${0}' redefined"), - HAWK_T("function '${0}' redefined"), - HAWK_T("global variable '${0}' redefined"), - HAWK_T("parameter '${0}' redefined"), - HAWK_T("variable '${0}' redefined"), + HAWK_T("keyword redefined"), + HAWK_T("intrinsic function redefined"), + HAWK_T("function redefined"), + HAWK_T("global variable redefined"), + HAWK_T("parameter redefined"), + HAWK_T("variable redefined"), HAWK_T("duplicate parameter name '${0}'"), HAWK_T("duplicate global variable '${0}'"), HAWK_T("duplicate local variable"), diff --git a/hawk/lib/hawk-cfg.h.in b/hawk/lib/hawk-cfg.h.in index a45879be..0abd5a68 100644 --- a/hawk/lib/hawk-cfg.h.in +++ b/hawk/lib/hawk-cfg.h.in @@ -226,6 +226,9 @@ /* Define to 1 if you have the `gmtime_r' function. */ #undef HAVE_GMTIME_R +/* Define to 1 if you have the `initstate_r' function. */ +#undef HAVE_INITSTATE_R + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -442,6 +445,9 @@ /* Define to 1 if you have the `sqrtq' function. */ #undef HAVE_SQRTQ +/* Define to 1 if you have the `srandom_r' function. */ +#undef HAVE_SRANDOM_R + /* Define to 1 if you have the `stat64' function. */ #undef HAVE_STAT64 diff --git a/hawk/lib/hawk-cmn.h b/hawk/lib/hawk-cmn.h index 7393e5e7..f4c7b7c4 100644 --- a/hawk/lib/hawk-cmn.h +++ b/hawk/lib/hawk-cmn.h @@ -812,9 +812,9 @@ enum hawk_errnum_t HAWK_ECOMMA, /**< comma expected in place of '${0}' */ HAWK_ESCOLON, /**< semicolon expected in place of '${0}' */ HAWK_ECOLON, /**< colon expected in place of '${0}' */ - HAWK_EINTLIT, /**< integer literal expected in place of '${0}' */ + HAWK_EINTLIT, /**< integer literal expected */ HAWK_ESTMEND, /**< statement not ending with a semicolon */ - HAWK_EKWIN, /**< keyword 'in' expected in place of '${0}' */ + HAWK_EKWIN, /**< keyword 'in' expected */ HAWK_ENOTVAR, /**< right-hand side of 'in' not a variable */ HAWK_EEXPRNR, /**< expression not recognized */ @@ -825,12 +825,12 @@ enum hawk_errnum_t HAWK_EFUNNAM, /**< '${0}' not a valid function name */ HAWK_EBLKBEG, /**< BEGIN not followed by left bracket on the same line */ HAWK_EBLKEND, /**< END not followed by left bracket on the same line */ - HAWK_EKWRED, /**< keyword '${0}' redefined */ - HAWK_EFNCRED, /**< intrinsic function '${0}' redefined */ - HAWK_EFUNRED, /**< function '${0}' redefined */ - HAWK_EGBLRED, /**< global variable '${0}' redefined */ - HAWK_EPARRED, /**< parameter '${0}' redefined */ - HAWK_EVARRED, /**< variable '${0}' redefined */ + HAWK_EKWRED, /**< keyword redefined */ + HAWK_EFNCRED, /**< intrinsic function redefined */ + HAWK_EFUNRED, /**< function redefined */ + HAWK_EGBLRED, /**< global variable redefined */ + HAWK_EPARRED, /**< parameter redefined */ + HAWK_EVARRED, /**< variable redefined */ HAWK_EDUPPAR, /**< duplicate parameter name '${0}' */ HAWK_EDUPGBL, /**< duplicate global variable name '${0}' */ HAWK_EDUPLCL, /**< duplicate local variable name '${0}' */ diff --git a/hawk/lib/mod-math.c b/hawk/lib/mod-math.c index 53fbc0ee..e62dfc55 100644 --- a/hawk/lib/mod-math.c +++ b/hawk/lib/mod-math.c @@ -60,12 +60,12 @@ # define HAVE_SQRT # endif #endif - typedef struct modctx_t { unsigned int seed; -#if defined(HAVE_RANDOM_R) +#if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R) struct random_data prand; + hawk_uint8_t prand_bin[256]; #endif } modctx_t; @@ -536,7 +536,7 @@ static int fnc_rand (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) modctx_t* modctx; modctx = (modctx_t*)fi->mod->ctx; -#if defined(HAVE_RANDOM_R) +#if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R) random_r (&modctx->prand, &randv); #elif defined(HAVE_RANDOM) randv = random(); @@ -573,7 +573,7 @@ static int fnc_srand (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) hawk_ntime_t tv; hawk_get_time (&tv); modctx->seed = tv.sec + tv.nsec; - #if defined(HAVE_RANDOM_R) + #if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R) srandom_r (modctx->seed, &modctx->prand); #elif defined(HAVE_RANDOM) srandom (modctx->seed); @@ -586,7 +586,7 @@ static int fnc_srand (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) a0 = hawk_rtx_getarg(rtx, 0); n = hawk_rtx_valtoint(rtx, a0, &lv); if (n <= -1) return -1; - #if defined(HAVE_RANDOM_R) + #if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R) srandom_r (lv, &modctx->prand); #elif defined(HAVE_RANDOM) srandom (lv); @@ -714,7 +714,8 @@ int hawk_mod_math (hawk_mod_t* mod, hawk_t* awk) hawk_get_time (&tv); modctx->seed = tv.sec + tv.nsec; -#if defined(HAVE_RANDOM_R) +#if defined(HAVE_INITSTATE_R) && defined(HAVE_SRANDOM_R) && defined(HAVE_RANDOM_R) + initstate_r (0, &modctx->prand_bin, HAWK_SIZEOF(&modctx->prand_bin), &modctx->prand); srandom_r (modctx->seed, &modctx->prand); #elif defined(HAVE_RANDOM) srandom (modctx->seed); diff --git a/hawk/lib/parse.c b/hawk/lib/parse.c index f6fb88b7..76bfcc25 100644 --- a/hawk/lib/parse.c +++ b/hawk/lib/parse.c @@ -796,20 +796,13 @@ static int record_ever_included (hawk_t* awk, hawk_sio_arg_t* arg) static int begin_include (hawk_t* awk, int once) { hawk_sio_arg_t* arg = HAWK_NULL; - hawk_link_t* link; hawk_ooch_t* sio_name; if (hawk_count_oocstr(HAWK_OOECS_PTR(awk->tok.name)) != HAWK_OOECS_LEN(awk->tok.name)) { /* a '\0' character included in the include file name. * we don't support such a file name */ - SETERR_ARG_LOC ( - awk, - HAWK_EIONMNL, - HAWK_OOECS_PTR(awk->tok.name), - hawk_count_oocstr(HAWK_OOECS_PTR(awk->tok.name)), - &awk->tok.loc - ); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EIONMNL, HAWK_T("invalid I/O name of length %zu containing '\\0'"), HAWK_OOECS_LEN(awk->tok.name)); return -1; } @@ -1000,7 +993,7 @@ static int parse_progunit (hawk_t* awk) if (get_token(awk) <= -1) return -1; if (!MATCH(awk, TOK_INT)) { - SETERR_TOK (awk, HAWK_EINTLIT); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EINTLIT, HAWK_T("integer literal expected in place of '%.*js'"), HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return -1; } @@ -1027,9 +1020,9 @@ static int parse_progunit (hawk_t* awk) } else if (MATCH(awk, TOK_BEGIN)) { - if ((awk->opt.trait & HAWK_PABLOCK) == 0) + if (!(awk->opt.trait & HAWK_PABLOCK)) /* pattern action block not allowed */ { - SETERR_TOK (awk, HAWK_EKWFNC); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EKWFNC, HAWK_T("keyword 'function' expected in place of '%.*js'"), HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return -1; } @@ -1058,9 +1051,9 @@ static int parse_progunit (hawk_t* awk) } else if (MATCH(awk, TOK_END)) { - if ((awk->opt.trait & HAWK_PABLOCK) == 0) + if (!(awk->opt.trait & HAWK_PABLOCK)) { - SETERR_TOK (awk, HAWK_EKWFNC); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EKWFNC, HAWK_T("keyword 'function' expected in place of '%.*js'"), HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return -1; } @@ -1090,9 +1083,9 @@ static int parse_progunit (hawk_t* awk) else if (MATCH(awk, TOK_LBRACE)) { /* patternless block */ - if ((awk->opt.trait & HAWK_PABLOCK) == 0) + if (!(awk->opt.trait & HAWK_PABLOCK)) { - SETERR_TOK (awk, HAWK_EKWFNC); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EKWFNC, HAWK_T("keyword 'function' expected in place of '%.*js'"), HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return -1; } @@ -1116,9 +1109,9 @@ static int parse_progunit (hawk_t* awk) hawk_nde_t* ptn; hawk_loc_t eloc; - if ((awk->opt.trait & HAWK_PABLOCK) == 0) + if (!(awk->opt.trait & HAWK_PABLOCK)) { - SETERR_TOK (awk, HAWK_EKWFNC); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EKWFNC, HAWK_T("keyword 'function' expected in place of '%.*js'"), HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return -1; } @@ -1222,6 +1215,7 @@ static hawk_nde_t* parse_function (hawk_t* awk) hawk_htb_pair_t* pair; hawk_loc_t xloc; int rederr; + const hawk_ooch_t* redobj; /* eat up the keyword 'function' and get the next token */ HAWK_ASSERT (MATCH(awk,TOK_FUNCTION)); @@ -1241,15 +1235,15 @@ static hawk_nde_t* parse_function (hawk_t* awk) /* note that i'm assigning to rederr in the 'if' conditions below. * i'm not checking equality */ /* check if it is a builtin function */ - if ((hawk_findfncwithoocs(awk, &name) != HAWK_NULL && (rederr = HAWK_EFNCRED)) || + if ((hawk_findfncwithoocs(awk, &name) != HAWK_NULL && (rederr = HAWK_EFNCRED, redobj = HAWK_T("intrinsic function"))) || /* check if it has already been defined as a function */ - (hawk_htb_search(awk->tree.funs, name.ptr, name.len) != HAWK_NULL && (rederr = HAWK_EFUNRED)) || + (hawk_htb_search(awk->tree.funs, name.ptr, name.len) != HAWK_NULL && (rederr = HAWK_EFUNRED, redobj = HAWK_T("function"))) || /* check if it conflicts with a named variable */ - (hawk_htb_search(awk->parse.named, name.ptr, name.len) != HAWK_NULL && (rederr = HAWK_EVARRED)) || + (hawk_htb_search(awk->parse.named, name.ptr, name.len) != HAWK_NULL && (rederr = HAWK_EVARRED, redobj = HAWK_T("variable"))) || /* check if it coincides to be a global variable name */ - (((g = find_global (awk, &name)) != HAWK_ARR_NIL) && (rederr = HAWK_EGBLRED))) + (((g = find_global (awk, &name)) != HAWK_ARR_NIL) && (rederr = HAWK_EGBLRED, redobj = HAWK_T("global variable")))) { - hawk_seterror (awk, rederr, &name, &awk->tok.loc); + hawk_seterrfmt (awk, &awk->tok.loc, rederr, HAWK_T("%js '%.*js' redefined"), redobj, HAWK_OOECS_LEN(awk->tok.name), HAWK_OOECS_PTR(awk->tok.name)); return HAWK_NULL; } @@ -1839,29 +1833,23 @@ static int add_global (hawk_t* awk, const hawk_oocs_t* name, hawk_loc_t* xloc, i /* check if it is a keyword */ if (classify_ident(awk, name) != TOK_IDENT) { - SETERR_ARG_LOC (awk, HAWK_EKWRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EKWRED, HAWK_T("keyword '%.*js' redefined"), name->len, name->ptr); return -1; } /* check if it conflicts with a builtin function name */ if (hawk_findfncwithoocs(awk, name) != HAWK_NULL) { - SETERR_ARG_LOC (awk, HAWK_EFNCRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EFNCRED, HAWK_T("intrinsic function '%.*js' redefined"), name->len, name->ptr); return -1; } /* check if it conflicts with a function name */ - if (hawk_htb_search(awk->tree.funs, name->ptr, name->len) != HAWK_NULL) + if (hawk_htb_search(awk->tree.funs, name->ptr, name->len) != HAWK_NULL || + /* check if it conflicts with a function name caught in the function call table */ + hawk_htb_search(awk->parse.funs, name->ptr, name->len) != HAWK_NULL) { - SETERR_ARG_LOC (awk, HAWK_EFUNRED, name->ptr, name->len, xloc); - return -1; - } - - /* check if it conflicts with a function name - * caught in the function call table */ - if (hawk_htb_search(awk->parse.funs, name->ptr, name->len) != HAWK_NULL) - { - SETERR_ARG_LOC (awk, HAWK_EFUNRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EFUNRED, HAWK_T("function '%.*js' redefined"), name->len, name->ptr); return -1; } @@ -1876,12 +1864,12 @@ static int add_global (hawk_t* awk, const hawk_oocs_t* name, hawk_loc_t* xloc, i /* TODO: need to check if it conflicts with a named variable to * disallow such a program shown below (IMPLICIT & EXPLICIT on) * BEGIN {X=20; x(); x(); x(); print X} - * global X; + * @global X; * function x() { print X++; } */ if (hawk_htb_search(awk->parse.named, name, len) != HAWK_NULL) { - SETERR_ARG_LOC (awk, HAWK_EVARRED, name, len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EVARRED, HAWK_T("variable '%.*js' redefined"), len, name); return -1; } #endif @@ -2239,7 +2227,7 @@ static hawk_t* collect_locals (hawk_t* awk, hawk_oow_t nlcls, int istop) * function f() { local length; } */ if (hawk_findfncwithoocs(awk, &lcl) != HAWK_NULL) { - SETERR_ARG_LOC (awk, HAWK_EFNCRED, lcl.ptr, lcl.len, &awk->tok.loc); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EFNCRED, HAWK_T("intrinsic function '%.*js' redefined"), lcl.len, lcl.ptr); return HAWK_NULL; } @@ -2251,7 +2239,7 @@ static hawk_t* collect_locals (hawk_t* awk, hawk_oow_t nlcls, int istop) n = hawk_arr_search(awk->parse.params, 0, lcl.ptr, lcl.len); if (n != HAWK_ARR_NIL) { - SETERR_ARG_LOC (awk, HAWK_EPARRED, lcl.ptr, lcl.len, &awk->tok.loc); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EPARRED, HAWK_T("parameter '%.*js' redefined"), lcl.len, lcl.ptr); return HAWK_NULL; } } @@ -2263,7 +2251,7 @@ static hawk_t* collect_locals (hawk_t* awk, hawk_oow_t nlcls, int istop) { if (hawk_comp_oochars(lcl.ptr, lcl.len, awk->tree.cur_fun.ptr, awk->tree.cur_fun.len, 0) == 0) { - SETERR_ARG_LOC (awk, HAWK_EFUNRED, lcl.ptr, lcl.len, &awk->tok.loc); + hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EFUNRED, HAWK_T("function '%.*js' redefined"), lcl.len, lcl.ptr); return HAWK_NULL; } } @@ -2283,8 +2271,7 @@ static hawk_t* collect_locals (hawk_t* awk, hawk_oow_t nlcls, int istop) { if (n < awk->tree.ngbls_base) { - /* it is a conflict only if it is one of a - * static global variable */ + /* it is a conflict only if it is one of a static global variable */ hawk_seterrfmt (awk, &awk->tok.loc, HAWK_EDUPLCL, HAWK_T("duplicate local variable - %.*js"), lcl.len, lcl.ptr); return HAWK_NULL; } @@ -5295,11 +5282,11 @@ static hawk_nde_t* parse_primary_ident_noseg (hawk_t* awk, const hawk_loc_t* xlo } else { - /* function name appeared without () */ + /* function name appeared without (). used as a value without invocation */ #if defined(ENABLE_FEATURE_FUN_AS_VALUE) nde = parse_fun_as_value(awk, name, xloc, funptr); #else - SETERR_ARG_LOC (awk, HAWK_EFUNRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EFUNRED, HAWK_T("function '%.*js' redefined"), name->len, name->ptr); #endif } } @@ -5329,7 +5316,7 @@ static hawk_nde_t* parse_primary_ident_noseg (hawk_t* awk, const hawk_loc_t* xlo is_fncall_var = 1; goto named_var; #else - SETERR_ARG_LOC (awk, HAWK_EVARRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EVARRED, HAWK_T("variable '%.*js' redefined"), name->len, name->ptr); #endif } else @@ -5630,11 +5617,11 @@ static hawk_nde_t* parse_hashidx (hawk_t* awk, const hawk_oocs_t* name, const ha switch (fnname) { case FNTYPE_FNC: - SETERR_ARG_LOC (awk, HAWK_EFNCRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EFNCRED, HAWK_T("intrinsic function '%.*js' redefined"), name->len, name->ptr); goto exit_func; case FNTYPE_FUN: - SETERR_ARG_LOC (awk, HAWK_EFUNRED, name->ptr, name->len, xloc); + hawk_seterrfmt (awk, xloc, HAWK_EFUNRED, HAWK_T("function '%.*js' redefined"), name->len, name->ptr); goto exit_func; } diff --git a/hawk/t/test.txt b/hawk/t/test.txt index dd74843e..d7f8b1e9 100644 --- a/hawk/t/test.txt +++ b/hawk/t/test.txt @@ -78,3 +78,38 @@ HAWK_ELXDIG -> ERROR: CODE 32 LINE 1 COLUMN 15 - invalid digit '9' $ hawk 'BEGIN { + > }' HAWK_EEXPRNR -> ERROR: CODE 49 LINE 1 COLUMN 9 - expression not recognized around '+' + +$ ~/xxx/bin/hawk '@pragma stack_limit "99"; BEGIN { }' +HAWK_EINTLIT -> ERROR: CODE 45 LINE 1 COLUMN 21 - integer literal expected in place of '99' + + +$ ~/xxx/bin/hawk --pablock=off '{ print $0; }' +HAWK_EKWFNC -> ERROR: CODE 50 LINE 1 COLUMN 1 - keyword 'function' expected in place of '{' + +$ ~/xxx/bin/hawk --pablock=off 'BEGIN { print $0; }' +HAWK_EKWFNC -> ERROR: CODE 50 LINE 1 COLUMN 1 - keyword 'function' expected in place of 'BEGIN' + + +$ ~/xxx/bin/hawk '@include "a\0b"; function; BEGIN { function=10; }' +HAWK_EIONMNL -> ERROR: CODE 122 LINE 1 COLUMN 10 - invalid I/O name of length 3 containing '\0' + +$ ~/xxx/bin/hawk 'function add(a,b) { return a + b; } @global add; BEGIN { add = 10; }' +HAWK_EFUNRED -> ERROR: CODE 59 LINE 1 COLUMN 45 - function 'add' redefined + +$ ~/xxx/bin/hawk '@global add; function add(a,b) { return a + b; } BEGIN { add = 10; }' +HAWK_EGBLRED -> ERROR: CODE 60 LINE 1 COLUMN 23 - global variable 'add' redefined + +$ ~/xxx/bin/hawk 'BEGIN { @local length; }' +HAWK_EFNCRED -> ERROR: CODE 58 LINE 1 COLUMN 16 - intrinsic function 'length' redefined + +$ ~/xxx/bin/hawk '@global length;' +HAWK_EFNCRED -> ERROR: CODE 58 LINE 1 COLUMN 9 - intrinsic function 'length' redefined + +$ ~/xxx/bin/hawk 'function length(x) { return 10; }' +HAWK_EFNCRED -> ERROR: CODE 58 LINE 1 COLUMN 10 - intrinsic function 'length' redefined + +$ ~/xxx/bin/hawk 'function test(ax) { @local ax; }' +HAWK_EPARRED -> ERROR: CODE 61 LINE 1 COLUMN 28 - parameter 'ax' redefined + + +