added QSE_XLI_NOLIST and QSE_XLI_NONIL
This commit is contained in:
parent
72fd080f70
commit
84aca0ecb1
@ -136,6 +136,8 @@ static void print_usage (QSE_FILE* out, int argc, qse_char_t* argv[])
|
||||
qse_fprintf (out, QSE_T(" -t keep comment text\n"));
|
||||
qse_fprintf (out, QSE_T(" -s allow multi-segmented strings\n"));
|
||||
qse_fprintf (out, QSE_T(" -d allow a leading digit in identifiers\n"));
|
||||
qse_fprintf (out, QSE_T(" -n disallow nil\n"));
|
||||
qse_fprintf (out, QSE_T(" -l disallow lists\n"));
|
||||
qse_fprintf (out, QSE_T(" -v perform validation\n"));
|
||||
qse_fprintf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
|
||||
#if defined(QSE_BUILD_DEBUG)
|
||||
@ -163,9 +165,9 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
static qse_opt_t opt =
|
||||
{
|
||||
#if defined(QSE_BUILD_DEBUG)
|
||||
QSE_T("hi:o:uaftsdvm:X:"),
|
||||
QSE_T("hi:o:uaftsdnlvm:X:"),
|
||||
#else
|
||||
QSE_T("hi:o:uaftsdvm:"),
|
||||
QSE_T("hi:o:uaftsdnlvm:"),
|
||||
#endif
|
||||
lng
|
||||
};
|
||||
@ -231,6 +233,14 @@ static int handle_args (int argc, qse_char_t* argv[])
|
||||
g_trait |= QSE_XLI_LEADDIGIT;
|
||||
break;
|
||||
|
||||
case QSE_T('n'):
|
||||
g_trait |= QSE_XLI_NONIL;
|
||||
break;
|
||||
|
||||
case QSE_T('l'):
|
||||
g_trait |= QSE_XLI_NOLIST;
|
||||
break;
|
||||
|
||||
case QSE_T('v'):
|
||||
g_trait |= QSE_XLI_VALIDATE;
|
||||
break;
|
||||
|
@ -96,7 +96,11 @@ enum qse_xli_trait_t
|
||||
|
||||
QSE_XLI_MULSEGSTR = (1 << 5), /**< support multi-segmented string */
|
||||
QSE_XLI_LEADDIGIT = (1 << 6), /**< allow a leading digit in an identifier */
|
||||
QSE_XLI_VALIDATE = (1 << 7)
|
||||
|
||||
QSE_XLI_NONIL = (1 << 7),
|
||||
QSE_XLI_NOLIST = (1 << 8),
|
||||
|
||||
QSE_XLI_VALIDATE = (1 << 9)
|
||||
};
|
||||
typedef enum qse_xli_trait_t qse_xli_trait_t;
|
||||
|
||||
|
@ -811,7 +811,7 @@ static int read_pair (qse_xli_t* xli)
|
||||
/* TODO: check against schema */
|
||||
|
||||
}
|
||||
else if (MATCH (xli, TOK_LBRACE))
|
||||
else if (!(xli->opt.trait & QSE_XLI_NOLIST) && MATCH (xli, TOK_LBRACE))
|
||||
{
|
||||
if (scm && !(scm->flags & QSE_XLI_SCM_VALLIST))
|
||||
{
|
||||
@ -847,6 +847,12 @@ static int read_pair (qse_xli_t* xli)
|
||||
}
|
||||
else if (MATCH (xli, TOK_SEMICOLON))
|
||||
{
|
||||
if (xli->opt.trait & QSE_XLI_NONIL)
|
||||
{
|
||||
qse_xli_seterror (xli, QSE_XLI_ENOVAL, (const qse_cstr_t*)&key, &kloc);
|
||||
goto oops;
|
||||
}
|
||||
|
||||
if (scm && !(scm->flags & QSE_XLI_SCM_VALNIL) &&
|
||||
!((scm->flags & QSE_XLI_SCM_VALSTR) && scm->str_minseg <= 0))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user