enhanced error location handling for awk
This commit is contained in:
parent
48aa3f2d34
commit
9253c8644f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c 256 2009-08-16 13:44:20Z hyunghwan.chung $
|
* $Id: awk.c 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -644,20 +644,32 @@ static void freearg (struct arg_t* arg)
|
|||||||
|
|
||||||
static void print_awkerr (qse_awk_t* awk)
|
static void print_awkerr (qse_awk_t* awk)
|
||||||
{
|
{
|
||||||
|
const qse_awk_loc_t* loc = qse_awk_geterrloc (awk);
|
||||||
|
|
||||||
print_err (
|
print_err (
|
||||||
QSE_T("CODE [%d] LINE [%u] %s\n"),
|
QSE_T("CODE %d LINE %u COLUMN %u %s%s%s- %s\n"),
|
||||||
qse_awk_geterrnum(awk),
|
qse_awk_geterrnum(awk),
|
||||||
(unsigned int)qse_awk_geterrlin(awk),
|
(unsigned int)loc->lin,
|
||||||
|
(unsigned int)loc->col,
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): QSE_T("FILE ")),
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): loc->fil),
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): QSE_T(" ")),
|
||||||
qse_awk_geterrmsg(awk)
|
qse_awk_geterrmsg(awk)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_rtxerr (qse_awk_rtx_t* rtx)
|
static void print_rtxerr (qse_awk_rtx_t* rtx)
|
||||||
{
|
{
|
||||||
|
const qse_awk_loc_t* loc = qse_awk_rtx_geterrloc (rtx);
|
||||||
|
|
||||||
print_err (
|
print_err (
|
||||||
QSE_T("CODE [%d] LINE [%u] %s\n"),
|
QSE_T("CODE %d LINE %u COLUMN %u %s%s%s- %s\n"),
|
||||||
qse_awk_rtx_geterrnum(rtx),
|
qse_awk_rtx_geterrnum(rtx),
|
||||||
(unsigned int)qse_awk_rtx_geterrlin(rtx),
|
(unsigned int)loc->lin,
|
||||||
|
(unsigned int)loc->col,
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): QSE_T("FILE ")),
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): loc->fil),
|
||||||
|
((loc->fil == QSE_NULL)? QSE_T(""): QSE_T(" ")),
|
||||||
qse_awk_rtx_geterrmsg(rtx)
|
qse_awk_rtx_geterrmsg(rtx)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.hpp 259 2009-08-20 11:28:03Z hyunghwan.chung $
|
* $Id: Awk.hpp 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -46,6 +46,7 @@ public:
|
|||||||
/** Defines a primitive handle */
|
/** Defines a primitive handle */
|
||||||
typedef qse_awk_t awk_t;
|
typedef qse_awk_t awk_t;
|
||||||
|
|
||||||
|
typedef qse_awk_loc_t loc_t;
|
||||||
typedef qse_awk_errnum_t errnum_t;
|
typedef qse_awk_errnum_t errnum_t;
|
||||||
typedef qse_awk_errstr_t errstr_t;
|
typedef qse_awk_errstr_t errstr_t;
|
||||||
typedef qse_awk_errinf_t errinf_t;
|
typedef qse_awk_errinf_t errinf_t;
|
||||||
@ -224,10 +225,10 @@ public:
|
|||||||
ErrorNumber getErrorNumber () const;
|
ErrorNumber getErrorNumber () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Awk::getErrorLine() function returns the line number of the last
|
* The Awk::getErrorLocation() function returns the location of the
|
||||||
* error occurred.
|
* last error occurred.
|
||||||
*/
|
*/
|
||||||
size_t getErrorLine () const;
|
loc_t getErrorLocation () const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Awk::getErrorMessage() function returns a message describing
|
* The Awk::getErrorMessage() function returns a message describing
|
||||||
@ -241,13 +242,13 @@ public:
|
|||||||
void setError (
|
void setError (
|
||||||
ErrorNumber code,
|
ErrorNumber code,
|
||||||
const cstr_t* args = QSE_NULL,
|
const cstr_t* args = QSE_NULL,
|
||||||
size_t line = 0
|
const loc_t* loc = QSE_NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
void setErrorWithMessage (
|
void setErrorWithMessage (
|
||||||
ErrorNumber code,
|
ErrorNumber code,
|
||||||
const char_t* msg,
|
const char_t* msg,
|
||||||
size_t line
|
const loc_t* loc
|
||||||
);
|
);
|
||||||
|
|
||||||
/** clears error information */
|
/** clears error information */
|
||||||
@ -744,19 +745,19 @@ public:
|
|||||||
bool shouldStop () const;
|
bool shouldStop () const;
|
||||||
|
|
||||||
ErrorNumber getErrorNumber () const;
|
ErrorNumber getErrorNumber () const;
|
||||||
size_t getErrorLine () const;
|
loc_t getErrorLocation () const;
|
||||||
const char_t* getErrorMessage () const;
|
const char_t* getErrorMessage () const;
|
||||||
|
|
||||||
void setError (
|
void setError (
|
||||||
ErrorNumber code,
|
ErrorNumber code,
|
||||||
const cstr_t* args = QSE_NULL,
|
const cstr_t* args = QSE_NULL,
|
||||||
size_t line = 0
|
const loc_t* loc = QSE_NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
void setErrorWithMessage (
|
void setErrorWithMessage (
|
||||||
ErrorNumber code,
|
ErrorNumber code,
|
||||||
const char_t* msg,
|
const char_t* msg,
|
||||||
size_t line
|
const loc_t* loc
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h 264 2009-08-23 12:56:45Z hyunghwan.chung $
|
* $Id: awk.h 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -358,6 +358,7 @@ typedef enum qse_awk_rio_mode_t qse_awk_rio_mode_t;
|
|||||||
* #QSE_AWK_RIO_OPEN is requested. For other request type, it can refer
|
* #QSE_AWK_RIO_OPEN is requested. For other request type, it can refer
|
||||||
* to the handle field set previously.
|
* to the handle field set previously.
|
||||||
*/
|
*/
|
||||||
|
typedef struct qse_awk_rio_arg_t qse_awk_rio_arg_t;
|
||||||
struct qse_awk_rio_arg_t
|
struct qse_awk_rio_arg_t
|
||||||
{
|
{
|
||||||
qse_awk_rio_mode_t mode; /**< [IN] I/O mode */
|
qse_awk_rio_mode_t mode; /**< [IN] I/O mode */
|
||||||
@ -384,7 +385,6 @@ struct qse_awk_rio_arg_t
|
|||||||
|
|
||||||
struct qse_awk_rio_arg_t* next;
|
struct qse_awk_rio_arg_t* next;
|
||||||
};
|
};
|
||||||
typedef struct qse_awk_rio_arg_t qse_awk_rio_arg_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_rio_fun_t type defines a runtime I/O handler.
|
* The qse_awk_rio_fun_t type defines a runtime I/O handler.
|
||||||
@ -400,6 +400,7 @@ typedef qse_ssize_t (*qse_awk_rio_fun_t) (
|
|||||||
/**
|
/**
|
||||||
* The qse_awk_prm_t type defines primitive functions
|
* The qse_awk_prm_t type defines primitive functions
|
||||||
*/
|
*/
|
||||||
|
typedef struct qse_awk_prm_t qse_awk_prm_t;
|
||||||
struct qse_awk_prm_t
|
struct qse_awk_prm_t
|
||||||
{
|
{
|
||||||
qse_awk_pow_t pow;
|
qse_awk_pow_t pow;
|
||||||
@ -436,7 +437,17 @@ struct qse_awk_prm_t
|
|||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
typedef struct qse_awk_prm_t qse_awk_prm_t;
|
|
||||||
|
/**
|
||||||
|
* The qse_awk_loc_t type defines a structure to hold location.
|
||||||
|
*/
|
||||||
|
typedef struct qse_awk_loc_t qse_awk_loc_t;
|
||||||
|
struct qse_awk_loc_t
|
||||||
|
{
|
||||||
|
const qse_char_t* fil; /**< file */
|
||||||
|
qse_size_t lin; /**< line */
|
||||||
|
qse_size_t col; /**< column */
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_sio_t type defines a script stream handler set.
|
* The qse_awk_sio_t type defines a script stream handler set.
|
||||||
@ -508,7 +519,7 @@ struct qse_awk_rcb_t
|
|||||||
* each statement executed.
|
* each statement executed.
|
||||||
*/
|
*/
|
||||||
void (*on_statement) (
|
void (*on_statement) (
|
||||||
qse_awk_rtx_t* rtx, qse_size_t line, void* udd);
|
qse_awk_rtx_t* rtx, const qse_awk_loc_t* loc, void* udd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A caller may store a custom data pointer into this field.
|
* A caller may store a custom data pointer into this field.
|
||||||
@ -765,7 +776,6 @@ enum qse_awk_errnum_t
|
|||||||
};
|
};
|
||||||
typedef enum qse_awk_errnum_t qse_awk_errnum_t;
|
typedef enum qse_awk_errnum_t qse_awk_errnum_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_errinf_t type defines a placeholder for error information.
|
* The qse_awk_errinf_t type defines a placeholder for error information.
|
||||||
*/
|
*/
|
||||||
@ -773,7 +783,7 @@ struct qse_awk_errinf_t
|
|||||||
{
|
{
|
||||||
qse_awk_errnum_t num; /**< error number */
|
qse_awk_errnum_t num; /**< error number */
|
||||||
qse_char_t msg[256]; /**< error message */
|
qse_char_t msg[256]; /**< error message */
|
||||||
qse_size_t lin; /**< line number where an error occurred */
|
qse_awk_loc_t loc; /**< error location */
|
||||||
};
|
};
|
||||||
typedef struct qse_awk_errinf_t qse_awk_errinf_t;
|
typedef struct qse_awk_errinf_t qse_awk_errinf_t;
|
||||||
|
|
||||||
@ -1018,11 +1028,10 @@ qse_awk_errnum_t qse_awk_geterrnum (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_geterrlin() function returns the line number where the
|
* The qse_awk_geterrloc() function returns the location where the
|
||||||
* last error has occurred.
|
* last error has occurred.
|
||||||
* @return line number
|
|
||||||
*/
|
*/
|
||||||
qse_size_t qse_awk_geterrlin (
|
const qse_awk_loc_t* qse_awk_geterrloc (
|
||||||
qse_awk_t* awk /**< awk object */
|
qse_awk_t* awk /**< awk object */
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1065,17 +1074,18 @@ void qse_awk_geterror (
|
|||||||
qse_awk_t* awk,
|
qse_awk_t* awk,
|
||||||
qse_awk_errnum_t* errnum,
|
qse_awk_errnum_t* errnum,
|
||||||
const qse_char_t** errmsg,
|
const qse_char_t** errmsg,
|
||||||
qse_size_t* errlin
|
qse_awk_loc_t* errloc
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_seterror() functon sets error information.
|
* The qse_awk_seterror() functon sets error information.
|
||||||
*/
|
*/
|
||||||
void qse_awk_seterror (
|
void qse_awk_seterror (
|
||||||
qse_awk_t* awk, /**< awk object */
|
qse_awk_t* awk, /**< awk object */
|
||||||
qse_awk_errnum_t errnum, /**< error number */
|
qse_awk_errnum_t errnum, /**< error number */
|
||||||
const qse_cstr_t* errarg, /**< argument array for formatting error message */
|
const qse_cstr_t* errarg, /**< array of arguments for formatting
|
||||||
qse_size_t errlin /**< line number */
|
* an error message */
|
||||||
|
const qse_awk_loc_t* errloc /**< error location */
|
||||||
);
|
);
|
||||||
|
|
||||||
int qse_awk_getoption (
|
int qse_awk_getoption (
|
||||||
@ -1528,7 +1538,7 @@ qse_awk_errnum_t qse_awk_rtx_geterrnum (
|
|||||||
qse_awk_rtx_t* rtx /**< runtime context */
|
qse_awk_rtx_t* rtx /**< runtime context */
|
||||||
);
|
);
|
||||||
|
|
||||||
qse_size_t qse_awk_rtx_geterrlin (
|
const qse_awk_loc_t* qse_awk_rtx_geterrloc (
|
||||||
qse_awk_rtx_t* rtx /**< runtime context */
|
qse_awk_rtx_t* rtx /**< runtime context */
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1555,7 +1565,7 @@ void qse_awk_rtx_geterror (
|
|||||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||||
qse_awk_errnum_t* errnum, /**< error number */
|
qse_awk_errnum_t* errnum, /**< error number */
|
||||||
const qse_char_t** errmsg, /**< error message */
|
const qse_char_t** errmsg, /**< error message */
|
||||||
qse_size_t* errlin /**< error line */
|
qse_awk_loc_t* errloc /**< error location */
|
||||||
);
|
);
|
||||||
|
|
||||||
void qse_awk_rtx_seterrnum (
|
void qse_awk_rtx_seterrnum (
|
||||||
@ -1570,10 +1580,11 @@ void qse_awk_rtx_seterrinf (
|
|||||||
);
|
);
|
||||||
|
|
||||||
void qse_awk_rtx_seterror (
|
void qse_awk_rtx_seterror (
|
||||||
qse_awk_rtx_t* rtx, /**< runtime context */
|
qse_awk_rtx_t* rtx, /**< runtime context */
|
||||||
qse_awk_errnum_t errnum, /**< error number */
|
qse_awk_errnum_t errnum, /**< error number */
|
||||||
const qse_cstr_t* errarg, /**< argument array for formatting error message */
|
const qse_cstr_t* errarg, /**< array of arguments for formatting
|
||||||
qse_size_t errlin /**< error line */
|
* an error message */
|
||||||
|
const qse_awk_loc_t* errloc /**< error line */
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.cpp 259 2009-08-20 11:28:03Z hyunghwan.chung $
|
* $Id: Awk.cpp 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -908,10 +908,10 @@ Awk::ErrorNumber Awk::Run::getErrorNumber () const
|
|||||||
return (ErrorNumber)qse_awk_rtx_geterrnum (this->rtx);
|
return (ErrorNumber)qse_awk_rtx_geterrnum (this->rtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
Awk::size_t Awk::Run::getErrorLine () const
|
Awk::loc_t Awk::Run::getErrorLocation () const
|
||||||
{
|
{
|
||||||
QSE_ASSERT (this->rtx != QSE_NULL);
|
QSE_ASSERT (this->rtx != QSE_NULL);
|
||||||
return qse_awk_rtx_geterrlin (this->rtx);
|
return *qse_awk_rtx_geterrloc (this->rtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Awk::char_t* Awk::Run::getErrorMessage () const
|
const Awk::char_t* Awk::Run::getErrorMessage () const
|
||||||
@ -920,21 +920,22 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
|
|||||||
return qse_awk_rtx_geterrmsg (this->rtx);
|
return qse_awk_rtx_geterrmsg (this->rtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setError (ErrorNumber code, const cstr_t* args, size_t line)
|
void Awk::Run::setError (ErrorNumber code, const cstr_t* args, const loc_t* loc)
|
||||||
{
|
{
|
||||||
QSE_ASSERT (this->rtx != QSE_NULL);
|
QSE_ASSERT (this->rtx != QSE_NULL);
|
||||||
qse_awk_rtx_seterror (this->rtx, (errnum_t)code, args, line);
|
qse_awk_rtx_seterror (this->rtx, (errnum_t)code, args, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setErrorWithMessage (
|
void Awk::Run::setErrorWithMessage (
|
||||||
ErrorNumber code, const char_t* msg, size_t line)
|
ErrorNumber code, const char_t* msg, const loc_t* loc)
|
||||||
{
|
{
|
||||||
QSE_ASSERT (this->rtx != QSE_NULL);
|
QSE_ASSERT (this->rtx != QSE_NULL);
|
||||||
|
|
||||||
errinf_t errinf;
|
errinf_t errinf;
|
||||||
|
|
||||||
|
QSE_MEMSET (&errinf, 0, QSE_SIZEOF(errinf));
|
||||||
errinf.num = (errnum_t)code;
|
errinf.num = (errnum_t)code;
|
||||||
errinf.lin = line;
|
if (loc == QSE_NULL) errinf.loc = *loc;
|
||||||
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg), msg);
|
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg), msg);
|
||||||
|
|
||||||
qse_awk_rtx_seterrinf (this->rtx, &errinf);
|
qse_awk_rtx_seterrinf (this->rtx, &errinf);
|
||||||
@ -998,9 +999,8 @@ int Awk::Run::getGlobal (int id, Value& g) const
|
|||||||
Awk::Awk () : awk (QSE_NULL), functionMap (QSE_NULL), runctx (this)
|
Awk::Awk () : awk (QSE_NULL), functionMap (QSE_NULL), runctx (this)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
QSE_MEMSET (&errinf, 0, QSE_SIZEOF(errinf));
|
||||||
errinf.num = (errnum_t)ERR_NOERR;
|
errinf.num = (errnum_t)ERR_NOERR;
|
||||||
errinf.lin = 0;
|
|
||||||
errinf.msg[0] = QSE_T('\0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Awk::operator Awk::awk_t* () const
|
Awk::operator Awk::awk_t* () const
|
||||||
@ -1027,9 +1027,9 @@ Awk::ErrorNumber Awk::getErrorNumber () const
|
|||||||
return (ErrorNumber)this->errinf.num;
|
return (ErrorNumber)this->errinf.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
Awk::size_t Awk::getErrorLine () const
|
Awk::loc_t Awk::getErrorLocation () const
|
||||||
{
|
{
|
||||||
return this->errinf.lin;
|
return this->errinf.loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Awk::char_t* Awk::getErrorMessage () const
|
const Awk::char_t* Awk::getErrorMessage () const
|
||||||
@ -1037,44 +1037,38 @@ const Awk::char_t* Awk::getErrorMessage () const
|
|||||||
return this->errinf.msg;
|
return this->errinf.msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::setError (ErrorNumber code, const cstr_t* args, size_t line)
|
void Awk::setError (ErrorNumber code, const cstr_t* args, const loc_t* loc)
|
||||||
{
|
{
|
||||||
if (awk != QSE_NULL)
|
if (awk != QSE_NULL)
|
||||||
{
|
{
|
||||||
qse_awk_seterror (awk, (errnum_t)code, args, line);
|
qse_awk_seterror (awk, (errnum_t)code, args, loc);
|
||||||
retrieveError ();
|
retrieveError ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
QSE_MEMSET (&errinf, 0, QSE_SIZEOF(errinf));
|
||||||
errinf.num = (errnum_t)code;
|
errinf.num = (errnum_t)code;
|
||||||
errinf.lin = line;
|
if (loc != QSE_NULL) errinf.loc = *loc;
|
||||||
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg),
|
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg),
|
||||||
QSE_T("not ready to set an error message"));
|
QSE_T("not ready to set an error message"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::setErrorWithMessage (ErrorNumber code, const char_t* msg, size_t line)
|
void Awk::setErrorWithMessage (ErrorNumber code, const char_t* msg, const loc_t* loc)
|
||||||
{
|
{
|
||||||
if (awk != QSE_NULL)
|
QSE_MEMSET (&errinf, 0, QSE_SIZEOF(errinf));
|
||||||
{
|
|
||||||
errinf.num = (errnum_t)code;
|
errinf.num = (errnum_t)code;
|
||||||
errinf.lin = line;
|
if (loc != QSE_NULL) errinf.loc = *loc;
|
||||||
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg), msg);
|
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg), msg);
|
||||||
qse_awk_seterrinf (awk, &errinf);
|
|
||||||
}
|
if (awk != QSE_NULL) qse_awk_seterrinf (awk, &errinf);
|
||||||
else
|
|
||||||
{
|
|
||||||
errinf.num = (errnum_t)code;
|
|
||||||
errinf.lin = line;
|
|
||||||
qse_strxcpy (errinf.msg, QSE_COUNTOF(errinf.msg), msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::clearError ()
|
void Awk::clearError ()
|
||||||
{
|
{
|
||||||
|
QSE_MEMSET (&errinf, 0, QSE_SIZEOF(errinf));
|
||||||
errinf.num = (errnum_t)ERR_NOERR;
|
errinf.num = (errnum_t)ERR_NOERR;
|
||||||
errinf.lin = 0;
|
|
||||||
errinf.msg[0] = QSE_T('\0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::retrieveError ()
|
void Awk::retrieveError ()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c 266 2009-08-24 12:15:56Z hyunghwan.chung $
|
* $Id: awk.c 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -183,7 +183,9 @@ qse_awk_t* qse_awk_open (qse_mmgr_t* mmgr, qse_size_t xtn, qse_awk_prm_t* prm)
|
|||||||
|
|
||||||
awk->option = QSE_AWK_CLASSIC;
|
awk->option = QSE_AWK_CLASSIC;
|
||||||
awk->errinf.num = QSE_AWK_ENOERR;
|
awk->errinf.num = QSE_AWK_ENOERR;
|
||||||
awk->errinf.lin = 0;
|
awk->errinf.loc.lin = 0;
|
||||||
|
awk->errinf.loc.col = 0;
|
||||||
|
awk->errinf.loc.fil = QSE_NULL;
|
||||||
awk->errstr = qse_awk_dflerrstr;
|
awk->errstr = qse_awk_dflerrstr;
|
||||||
awk->stopall = QSE_FALSE;
|
awk->stopall = QSE_FALSE;
|
||||||
|
|
||||||
@ -322,7 +324,11 @@ int qse_awk_clear (qse_awk_t* awk)
|
|||||||
awk->tree.chain_size = 0;
|
awk->tree.chain_size = 0;
|
||||||
|
|
||||||
QSE_ASSERT (awk->sio.inp == &awk->sio.arg);
|
QSE_ASSERT (awk->sio.inp == &awk->sio.arg);
|
||||||
qse_map_clear (awk->sio.names);
|
/* this table must not be cleared here as there can be a reference
|
||||||
|
* to an entry of this table from errinf.fil when qse_awk_parse()
|
||||||
|
* failed. this table is cleared in qse_awk_parse().
|
||||||
|
* qse_map_clear (awk->sio.names);
|
||||||
|
*/
|
||||||
|
|
||||||
awk->sio.last.c = QSE_CHAR_EOF;
|
awk->sio.last.c = QSE_CHAR_EOF;
|
||||||
awk->sio.last.lin = 0;
|
awk->sio.last.lin = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h 265 2009-08-24 01:50:38Z hyunghwan.chung $
|
* $Id: awk.h 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -96,14 +96,6 @@ struct qse_awk_tree_t
|
|||||||
int ok;
|
int ok;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct qse_awk_loc_t qse_awk_loc_t;
|
|
||||||
struct qse_awk_loc_t
|
|
||||||
{
|
|
||||||
const qse_char_t* fil;
|
|
||||||
qse_size_t lin;
|
|
||||||
qse_size_t col;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct qse_awk_tok_t qse_awk_tok_t;
|
typedef struct qse_awk_tok_t qse_awk_tok_t;
|
||||||
struct qse_awk_tok_t
|
struct qse_awk_tok_t
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: err.c 258 2009-08-19 14:04:15Z hyunghwan.chung $
|
* $Id: err.c 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -169,9 +169,9 @@ qse_awk_errnum_t qse_awk_geterrnum (qse_awk_t* awk)
|
|||||||
return awk->errinf.num;
|
return awk->errinf.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_awk_geterrlin (qse_awk_t* awk)
|
const qse_awk_loc_t* qse_awk_geterrloc (qse_awk_t* awk)
|
||||||
{
|
{
|
||||||
return awk->errinf.lin;
|
return &awk->errinf.loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qse_char_t* qse_awk_geterrmsg (qse_awk_t* awk)
|
const qse_char_t* qse_awk_geterrmsg (qse_awk_t* awk)
|
||||||
@ -192,10 +192,10 @@ void qse_awk_geterrinf (qse_awk_t* awk, qse_awk_errinf_t* errinf)
|
|||||||
|
|
||||||
void qse_awk_geterror (
|
void qse_awk_geterror (
|
||||||
qse_awk_t* awk, qse_awk_errnum_t* errnum,
|
qse_awk_t* awk, qse_awk_errnum_t* errnum,
|
||||||
const qse_char_t** errmsg, qse_size_t* errlin)
|
const qse_char_t** errmsg, qse_awk_loc_t* errloc)
|
||||||
{
|
{
|
||||||
if (errnum != QSE_NULL) *errnum = awk->errinf.num;
|
if (errnum != QSE_NULL) *errnum = awk->errinf.num;
|
||||||
if (errlin != QSE_NULL) *errlin = awk->errinf.lin;
|
if (errloc != QSE_NULL) *errloc = awk->errinf.loc;
|
||||||
if (errmsg != QSE_NULL)
|
if (errmsg != QSE_NULL)
|
||||||
{
|
{
|
||||||
*errmsg = (awk->errinf.msg[0] == QSE_T('\0'))?
|
*errmsg = (awk->errinf.msg[0] == QSE_T('\0'))?
|
||||||
@ -207,7 +207,7 @@ void qse_awk_geterror (
|
|||||||
void qse_awk_seterrnum (
|
void qse_awk_seterrnum (
|
||||||
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg)
|
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg)
|
||||||
{
|
{
|
||||||
qse_awk_seterror (awk, errnum, errarg, 0);
|
qse_awk_seterror (awk, errnum, errarg, QSE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qse_awk_seterrinf (qse_awk_t* awk, const qse_awk_errinf_t* errinf)
|
void qse_awk_seterrinf (qse_awk_t* awk, const qse_awk_errinf_t* errinf)
|
||||||
@ -217,10 +217,11 @@ void qse_awk_seterrinf (qse_awk_t* awk, const qse_awk_errinf_t* errinf)
|
|||||||
|
|
||||||
void qse_awk_seterror (
|
void qse_awk_seterror (
|
||||||
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
|
qse_awk_t* awk, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
|
||||||
qse_size_t errlin)
|
const qse_awk_loc_t* errloc)
|
||||||
{
|
{
|
||||||
const qse_char_t* errfmt;
|
const qse_char_t* errfmt;
|
||||||
|
|
||||||
|
QSE_MEMSET (&awk->errinf, 0, QSE_SIZEOF(awk->errinf));
|
||||||
awk->errinf.num = errnum;
|
awk->errinf.num = errnum;
|
||||||
|
|
||||||
errfmt = qse_awk_geterrstr(awk)(awk,errnum);
|
errfmt = qse_awk_geterrstr(awk)(awk,errnum);
|
||||||
@ -230,7 +231,7 @@ void qse_awk_seterror (
|
|||||||
errfmt, errarg
|
errfmt, errarg
|
||||||
);
|
);
|
||||||
|
|
||||||
awk->errinf.lin = errlin;
|
if (errloc != QSE_NULL) awk->errinf.loc = *errloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_awk_errnum_t qse_awk_rtx_geterrnum (qse_awk_rtx_t* rtx)
|
qse_awk_errnum_t qse_awk_rtx_geterrnum (qse_awk_rtx_t* rtx)
|
||||||
@ -238,9 +239,9 @@ qse_awk_errnum_t qse_awk_rtx_geterrnum (qse_awk_rtx_t* rtx)
|
|||||||
return rtx->errinf.num;
|
return rtx->errinf.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_awk_rtx_geterrlin (qse_awk_rtx_t* rtx)
|
const qse_awk_loc_t* qse_awk_rtx_geterrloc (qse_awk_rtx_t* rtx)
|
||||||
{
|
{
|
||||||
return rtx->errinf.lin;
|
return &rtx->errinf.loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qse_char_t* qse_awk_rtx_geterrmsg (qse_awk_rtx_t* rtx)
|
const qse_char_t* qse_awk_rtx_geterrmsg (qse_awk_rtx_t* rtx)
|
||||||
@ -261,10 +262,10 @@ void qse_awk_rtx_geterrinf (qse_awk_rtx_t* rtx, qse_awk_errinf_t* errinf)
|
|||||||
|
|
||||||
void qse_awk_rtx_geterror (
|
void qse_awk_rtx_geterror (
|
||||||
qse_awk_rtx_t* rtx, qse_awk_errnum_t* errnum,
|
qse_awk_rtx_t* rtx, qse_awk_errnum_t* errnum,
|
||||||
const qse_char_t** errmsg, qse_size_t* errlin)
|
const qse_char_t** errmsg, qse_awk_loc_t* errloc)
|
||||||
{
|
{
|
||||||
if (errnum != QSE_NULL) *errnum = rtx->errinf.num;
|
if (errnum != QSE_NULL) *errnum = rtx->errinf.num;
|
||||||
if (errlin != QSE_NULL) *errlin = rtx->errinf.lin;
|
if (errloc != QSE_NULL) *errloc = rtx->errinf.loc;
|
||||||
if (errmsg != QSE_NULL)
|
if (errmsg != QSE_NULL)
|
||||||
{
|
{
|
||||||
*errmsg = (rtx->errinf.msg[0] == QSE_T('\0'))?
|
*errmsg = (rtx->errinf.msg[0] == QSE_T('\0'))?
|
||||||
@ -285,12 +286,12 @@ void qse_awk_rtx_seterrinf (qse_awk_rtx_t* rtx, const qse_awk_errinf_t* errinf)
|
|||||||
|
|
||||||
void qse_awk_rtx_seterror (
|
void qse_awk_rtx_seterror (
|
||||||
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
|
qse_awk_rtx_t* rtx, qse_awk_errnum_t errnum, const qse_cstr_t* errarg,
|
||||||
qse_size_t errlin)
|
const qse_awk_loc_t* errloc)
|
||||||
{
|
{
|
||||||
const qse_char_t* errfmt;
|
const qse_char_t* errfmt;
|
||||||
|
|
||||||
|
QSE_MEMSET (&rtx->errinf, 0, QSE_SIZEOF(rtx->errinf));
|
||||||
rtx->errinf.num = errnum;
|
rtx->errinf.num = errnum;
|
||||||
rtx->errinf.lin = errlin;
|
|
||||||
|
|
||||||
errfmt = qse_awk_geterrstr(rtx->awk)(rtx->awk,errnum);
|
errfmt = qse_awk_geterrstr(rtx->awk)(rtx->awk,errnum);
|
||||||
QSE_ASSERT (errfmt != QSE_NULL);
|
QSE_ASSERT (errfmt != QSE_NULL);
|
||||||
@ -298,4 +299,6 @@ void qse_awk_rtx_seterror (
|
|||||||
rtx->errinf.msg, QSE_COUNTOF(rtx->errinf.msg),
|
rtx->errinf.msg, QSE_COUNTOF(rtx->errinf.msg),
|
||||||
errfmt, errarg
|
errfmt, errarg
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (errloc != QSE_NULL) rtx->errinf.loc = *errloc;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: tree.h 236 2009-07-16 08:27:53Z hyunghwan.chung $
|
* $Id: tree.h 267 2009-08-25 09:50:07Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ struct qse_awk_fun_t
|
|||||||
|
|
||||||
#define QSE_AWK_NDE_HDR \
|
#define QSE_AWK_NDE_HDR \
|
||||||
qse_awk_nde_type_t type; \
|
qse_awk_nde_type_t type; \
|
||||||
qse_size_t line; \
|
qse_awk_loc_t loc; \
|
||||||
qse_awk_nde_t* next
|
qse_awk_nde_t* next
|
||||||
|
|
||||||
struct qse_awk_nde_t
|
struct qse_awk_nde_t
|
||||||
|
@ -937,7 +937,7 @@ my hello
|
|||||||
my hello
|
my hello
|
||||||
my hello
|
my hello
|
||||||
my hello
|
my hello
|
||||||
ERROR: CODE [15] LINE [6] block nested too deeply
|
ERROR: CODE 15 LINE 6 COLUMN 1 - block nested too deeply
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-003.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-003.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -956,7 +956,7 @@ BEGIN {
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-004.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-004.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [42] LINE [3] function 'a' redefined
|
ERROR: CODE 42 LINE 3 COLUMN 9 - function 'a' redefined
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-005.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-005.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -984,7 +984,7 @@ BEGIN {
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-006.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --implicit=off --explicit=on --newline=on -o- -f lang-006.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [43] LINE [5] global variable 'a' redefined
|
ERROR: CODE 43 LINE 5 COLUMN 10 - global variable 'a' redefined
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --implicit=on --explicit=on --newline=on -o- -f lang-007.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --implicit=on --explicit=on --newline=on -o- -f lang-007.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -1352,7 +1352,7 @@ BEGIN {
|
|||||||
printf ("%s\n",10.34);
|
printf ("%s\n",10.34);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR: CODE [103] LINE [3] recursion detected in format conversion
|
ERROR: CODE 103 LINE 3 COLUMN 2 - recursion detected in format conversion
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-014.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-014.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -1367,7 +1367,7 @@ BEGIN {
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-015.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-015.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [15] LINE [3] block nested too deeply
|
ERROR: CODE 15 LINE 3 COLUMN 50 - block nested too deeply
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-016.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-016.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -1481,27 +1481,27 @@ END {
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-018.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-018.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [47] LINE [1] duplicate global variable 'ARGV'
|
ERROR: CODE 47 LINE 1 COLUMN 8 - duplicate global variable 'ARGV'
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-019.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-019.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [49] LINE [1] '+' not a valid parameter name
|
ERROR: CODE 49 LINE 1 COLUMN 15 - '+' not a valid parameter name
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-020.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-020.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [50] LINE [1] '+' not a valid variable name
|
ERROR: CODE 50 LINE 1 COLUMN 8 - '+' not a valid variable name
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-021.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-021.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [50] LINE [3] '+' not a valid variable name
|
ERROR: CODE 50 LINE 3 COLUMN 8 - '+' not a valid variable name
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-022.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-022.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [23] LINE [2] left parenthesis expected in place of '='
|
ERROR: CODE 23 LINE 2 COLUMN 9 - left parenthesis expected in place of '='
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-023.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-023.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [28] LINE [5] colon expected in place of ';'
|
ERROR: CODE 28 LINE 5 COLUMN 20 - colon expected in place of ';'
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-024.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-024.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -1520,7 +1520,7 @@ BEGIN {
|
|||||||
delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix;
|
delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR: CODE [78] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable
|
ERROR: CODE 78 LINE 3 COLUMN 9 - variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-026.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-026.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -1532,19 +1532,19 @@ BEGIN {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abc
|
abc
|
||||||
ERROR: CODE [86] LINE [4] map 'abc' not assignable with a scalar
|
ERROR: CODE 86 LINE 4 COLUMN 2 - map 'abc' not assignable with a scalar
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-027.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-027.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [17] LINE [2] invalid character '<NUL>'
|
ERROR: CODE 17 LINE 2 COLUMN 1 - invalid character '<NUL>'
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-028.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-028.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [41] LINE [2] intrinsic function 'substr' redefined
|
ERROR: CODE 41 LINE 2 COLUMN 10 - intrinsic function 'substr' redefined
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-029.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --explicit=on --newline=on -o- -f lang-029.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
ERROR: CODE [42] LINE [9] function 'abc' redefined
|
ERROR: CODE 42 LINE 9 COLUMN 9 - function 'abc' redefined
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk --newline=on -o- -f lang-030.awk </dev/stdin 2>&1
|
../../cmd/awk/qseawk --newline=on -o- -f lang-030.awk </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
|
||||||
static void print_error (unsigned long line, const qse_char_t* msg)
|
static void print_error (const qse_awk_loc_t& loc, const qse_char_t* msg)
|
||||||
{
|
{
|
||||||
if (line > 0)
|
if (loc.lin > 0 || loc.col > 0)
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu\n"), msg, line);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu COLUMN %lu\n"), msg, loc.lin, loc.col);
|
||||||
else
|
else
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
||||||
|
|
||||||
@ -61,7 +61,11 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
int ret = awk.open ();
|
int ret = awk.open ();
|
||||||
if (ret >= 0) ret = run_awk (awk);
|
if (ret >= 0) ret = run_awk (awk);
|
||||||
|
|
||||||
if (ret <= -1) print_error (awk.getErrorLine(), awk.getErrorMessage());
|
if (ret <= -1)
|
||||||
|
{
|
||||||
|
qse_awk_loc_t loc = awk.getErrorLocation();
|
||||||
|
print_error (loc, awk.getErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
awk.close ();
|
awk.close ();
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
|
||||||
static void print_error (unsigned long line, const qse_char_t* msg)
|
static void print_error (const qse_awk_loc_t& loc, const qse_char_t* msg)
|
||||||
{
|
{
|
||||||
if (line > 0)
|
if (loc.lin > 0 || loc.col > 0)
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu\n"), msg, line);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu COLUMN %lu\n"), msg, loc.lin, loc.col);
|
||||||
else
|
else
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
||||||
|
|
||||||
@ -88,7 +88,11 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
int ret = awk.open();
|
int ret = awk.open();
|
||||||
|
|
||||||
if (ret >= 0) ret = run_awk (awk);
|
if (ret >= 0) ret = run_awk (awk);
|
||||||
if (ret <= -1) print_error (awk.getErrorLine(), awk.getErrorMessage());
|
if (ret <= -1)
|
||||||
|
{
|
||||||
|
qse_awk_loc_t loc = awk.getErrorLocation();
|
||||||
|
print_error (loc, awk.getErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
awk.close ();
|
awk.close ();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
|
||||||
static void print_error (unsigned long line, const qse_char_t* msg)
|
static void print_error (const qse_awk_loc_t& loc, const qse_char_t* msg)
|
||||||
{
|
{
|
||||||
if (line > 0)
|
if (loc.lin > 0 || loc.col > 0)
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu\n"), msg, line);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s at LINE %lu COLUMN %lu\n"), msg, loc.lin, loc.col);
|
||||||
else
|
else
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), msg);
|
||||||
|
|
||||||
@ -123,7 +123,11 @@ static int awk_main (int argc, qse_char_t* argv[])
|
|||||||
QSE::StdAwk::OPT_RESET);
|
QSE::StdAwk::OPT_RESET);
|
||||||
|
|
||||||
if (ret >= 0) ret = run_awk (awk);
|
if (ret >= 0) ret = run_awk (awk);
|
||||||
if (ret <= -1) print_error (awk.getErrorLine(), awk.getErrorMessage());
|
if (ret <= -1)
|
||||||
|
{
|
||||||
|
qse_awk_loc_t loc = awk.getErrorLocation();
|
||||||
|
print_error (loc, awk.getErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
awk.close ();
|
awk.close ();
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -173,9 +173,11 @@ static void print_error (const qse_char_t* fmt, ...)
|
|||||||
|
|
||||||
static void print_error (MyAwk& awk)
|
static void print_error (MyAwk& awk)
|
||||||
{
|
{
|
||||||
|
MyAwk::loc_t loc = awk.getErrorLocation();
|
||||||
|
|
||||||
print_error (
|
print_error (
|
||||||
QSE_T("LINE [%u] %s\n"),
|
QSE_T("LINE [%u] %s\n"),
|
||||||
(unsigned)awk.getErrorLine(),
|
(unsigned)loc.lin,
|
||||||
awk.getErrorMessage()
|
awk.getErrorMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user