fixed a few bugs in awk
- improved input console file and ARGV handling. - fixed bugs in the builtin rand() function. - added a new option to rex. - fixed a control flow handling bug in for(x in y) of awk.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp 185 2009-06-05 12:48:15Z hyunghwan.chung $
|
||||
* $Id: Awk.hpp 195 2009-06-10 13:18:25Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -518,7 +518,8 @@ public:
|
||||
ERR_REXRPAREN = QSE_AWK_EREXRPAREN,
|
||||
ERR_REXRBRACKET = QSE_AWK_EREXRBRACKET,
|
||||
ERR_REXRBRACE = QSE_AWK_EREXRBRACE,
|
||||
ERR_REXUNBALPAR = QSE_AWK_EREXUNBALPAR,
|
||||
ERR_REXUNBALPAREN = QSE_AWK_EREXUNBALPAREN,
|
||||
ERR_REXINVALBRACE = QSE_AWK_EREXINVALBRACE,
|
||||
ERR_REXCOLON = QSE_AWK_EREXCOLON,
|
||||
ERR_REXCRANGE = QSE_AWK_EREXCRANGE,
|
||||
ERR_REXCCLASS = QSE_AWK_EREXCCLASS,
|
||||
@ -555,7 +556,9 @@ public:
|
||||
/** Allows the assignment of a map value to a variable */
|
||||
OPT_MAPTOVAR = QSE_AWK_MAPTOVAR,
|
||||
/** Allows BEGIN, END, pattern-action blocks */
|
||||
OPT_PABLOCK = QSE_AWK_PABLOCK
|
||||
OPT_PABLOCK = QSE_AWK_PABLOCK,
|
||||
/** Allows {n,m} in a regular expression */
|
||||
OPT_REXBOUND = QSE_AWK_REXBOUND
|
||||
};
|
||||
// end of enum Option
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.h 194 2009-06-09 13:07:42Z hyunghwan.chung $
|
||||
* $Id: awk.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -411,6 +411,9 @@ enum qse_awk_option_t
|
||||
/* allows BEGIN, END, pattern-action blocks */
|
||||
QSE_AWK_PABLOCK = (1 << 16),
|
||||
|
||||
/* allow {n,m} in a regular expression */
|
||||
QSE_AWK_REXBOUND = (1 << 17),
|
||||
|
||||
/* option aggregtes */
|
||||
QSE_AWK_CLASSIC = QSE_AWK_IMPLICIT | QSE_AWK_RIO |
|
||||
QSE_AWK_NEWLINE | QSE_AWK_PABLOCK |
|
||||
@ -560,7 +563,8 @@ enum qse_awk_errnum_t
|
||||
QSE_AWK_EREXRPAREN, /* a right parenthesis is expected */
|
||||
QSE_AWK_EREXRBRACKET, /* a right bracket is expected */
|
||||
QSE_AWK_EREXRBRACE, /* a right brace is expected */
|
||||
QSE_AWK_EREXUNBALPAR, /* unbalanced parenthesis */
|
||||
QSE_AWK_EREXUNBALPAREN, /* unbalanced parenthesis */
|
||||
QSE_AWK_EREXINVALBRACE, /* invalid brace */
|
||||
QSE_AWK_EREXCOLON, /* a colon is expected */
|
||||
QSE_AWK_EREXCRANGE, /* invalid character range */
|
||||
QSE_AWK_EREXCCLASS, /* invalid character class */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: std.h 194 2009-06-09 13:07:42Z hyunghwan.chung $
|
||||
* $Id: std.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -79,10 +79,6 @@ struct qse_awk_parsestd_out_t
|
||||
typedef struct qse_awk_parsestd_out_t qse_awk_parsestd_out_t;
|
||||
/******/
|
||||
|
||||
#define QSE_AWK_RTX_OPENSTD_STDIO (qse_awk_rtx_openstd_stdio)
|
||||
extern const qse_char_t*const qse_awk_rtx_openstd_stdio[];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: rex.h 135 2009-05-15 13:31:43Z hyunghwan.chung $
|
||||
* $Id: rex.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -57,18 +57,20 @@
|
||||
|
||||
enum qse_rex_option_t
|
||||
{
|
||||
QSE_REX_IGNORECASE = (1 << 0)
|
||||
QSE_REX_BUILD_NOBOUND = (1 << 0),
|
||||
QSE_REX_MATCH_IGNORECASE = (1 << 8)
|
||||
};
|
||||
|
||||
enum qse_rex_errnum_t
|
||||
{
|
||||
QSE_REX_ENOERR = 0,
|
||||
QSE_REX_ENOMEM,
|
||||
QSE_REX_ENOMEM, /* no sufficient memory available */
|
||||
QSE_REX_ERECUR, /* recursion too deep */
|
||||
QSE_REX_ERPAREN, /* a right parenthesis is expected */
|
||||
QSE_REX_ERBRACKET, /* a right bracket is expected */
|
||||
QSE_REX_ERBRACE, /* a right brace is expected */
|
||||
QSE_REX_EUNBALPAR, /* unbalanced parenthesis */
|
||||
QSE_REX_EUNBALPAREN, /* unbalanced parenthesis */
|
||||
QSE_REX_EINVALBRACE, /* invalid brace */
|
||||
QSE_REX_ECOLON, /* a colon is expected */
|
||||
QSE_REX_ECRANGE, /* invalid character range */
|
||||
QSE_REX_ECCLASS, /* invalid character class */
|
||||
@ -128,6 +130,7 @@ int qse_rex_match (
|
||||
void* qse_buildrex (
|
||||
qse_mmgr_t* mmgr,
|
||||
qse_size_t depth,
|
||||
int option,
|
||||
const qse_char_t* ptn,
|
||||
qse_size_t len,
|
||||
qse_rex_errnum_t* errnum
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sed.h 193 2009-06-08 13:09:01Z hyunghwan.chung $
|
||||
* $Id: sed.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
|
||||
@ -113,11 +113,13 @@ typedef const qse_char_t* (*qse_sed_errstr_t) (
|
||||
*/
|
||||
enum qse_sed_option_t
|
||||
{
|
||||
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
|
||||
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
|
||||
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
|
||||
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
|
||||
QSE_SED_CLASSIC = (1 << 4) /**< disable extended features */
|
||||
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
|
||||
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
|
||||
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
|
||||
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
|
||||
QSE_SED_STRICT = (1 << 4), /**< do strict address check */
|
||||
QSE_SED_STARTSTEP = (1 << 5), /**< allow start~step */
|
||||
QSE_SED_REXBOUND = (1 << 6) /**< allow {n,m} in regular expression */
|
||||
};
|
||||
typedef enum qse_sed_option_t qse_sed_option_t;
|
||||
|
||||
|
Reference in New Issue
Block a user