added moo_fill_uchars()/moo_fill_bchars()
implemented the new fixed-point decimal prescale notation like 9p10.1 to indicate 10.100000000
This commit is contained in:
parent
0805ecc76b
commit
d384801eec
@ -59,6 +59,7 @@ class MyObject(Object)
|
||||
'string expected'
|
||||
'invalid radix'
|
||||
'invalid integer literal'
|
||||
'invalid fixed-point decimal scale'
|
||||
'invalid fixed-point decimal literal'
|
||||
'byte too small or too large'
|
||||
'wrong error literal'
|
||||
|
@ -230,9 +230,10 @@ extend MyObject
|
||||
[ (10 scale: 2) scale = (10.11 scale) ],
|
||||
|
||||
## 75-79
|
||||
[ ((10.19 scale: 3) scale) = (10.199 scale) ],
|
||||
[ ((10.19 scale: 0) scale) = (10 scale) ],
|
||||
|
||||
[ ((-10.19 scale: 3) scale) = (10.199 scale) ],
|
||||
[ ((-10.19 scale: 0) scale) = (10 scale) ],
|
||||
[ (-9p10 scale) = (-10.000000000 scale) ],
|
||||
[ (-9p10.123 scale) = (-10.123000000 scale) ],
|
||||
|
||||
[
|
||||
| b |
|
||||
|
@ -3668,7 +3668,8 @@ moo_oop_t moo_strtoint (moo_t* moo, const moo_ooch_t* str, moo_oow_t len, int ra
|
||||
|
||||
if (outlen > MOO_COUNTOF(hw))
|
||||
{
|
||||
hwp = moo_allocmem (moo, outlen * MOO_SIZEOF(hw[0]));
|
||||
/* TODO: reuse this buffer? */
|
||||
hwp = moo_allocmem(moo, outlen * MOO_SIZEOF(hw[0]));
|
||||
if (!hwp) return MOO_NULL;
|
||||
}
|
||||
else
|
||||
@ -3716,7 +3717,7 @@ moo_oop_t moo_strtoint (moo_t* moo, const moo_ooch_t* str, moo_oow_t len, int ra
|
||||
outlen = (end - str) / safe_ndigits + 1;
|
||||
if (outlen > MOO_COUNTOF(hw))
|
||||
{
|
||||
hwp = moo_allocmem (moo, outlen * MOO_SIZEOF(moo_liw_t));
|
||||
hwp = moo_allocmem(moo, outlen * MOO_SIZEOF(moo_liw_t));
|
||||
if (!hwp) return MOO_NULL;
|
||||
}
|
||||
else
|
||||
@ -3745,7 +3746,6 @@ moo_oop_t moo_strtoint (moo_t* moo, const moo_ooch_t* str, moo_oow_t len, int ra
|
||||
ptr++;
|
||||
}
|
||||
|
||||
|
||||
r2 = r1;
|
||||
for (i = 0; i < hwlen; i++)
|
||||
{
|
||||
@ -3803,7 +3803,7 @@ moo_oop_t moo_strtoint (moo_t* moo, const moo_ooch_t* str, moo_oow_t len, int ra
|
||||
|
||||
oops_einval:
|
||||
if (hwp && hw != hwp) moo_freemem (moo, hwp);
|
||||
moo_seterrnum (moo, MOO_EINVAL);
|
||||
moo_seterrbfmt (moo, MOO_EINVAL, "unable to convert to integer %.*js", len, str);
|
||||
return MOO_NULL;
|
||||
}
|
||||
|
||||
|
104
moo/lib/comp.c
104
moo/lib/comp.c
@ -704,10 +704,10 @@ static moo_oop_t string_to_int (moo_t* moo, moo_oocs_t* str, int radixed)
|
||||
return moo_strtoint(moo, ptr, end - ptr, base);
|
||||
}
|
||||
|
||||
static moo_oop_t string_to_fpdec (moo_t* moo, moo_oocs_t* str)
|
||||
static moo_oop_t string_to_fpdec (moo_t* moo, moo_oocs_t* str, int prescaled)
|
||||
{
|
||||
moo_oow_t pos, len;
|
||||
moo_oow_t scale = 0;
|
||||
moo_oow_t scale = 0, xscale = 0;
|
||||
moo_oop_t v;
|
||||
int base = 10;
|
||||
|
||||
@ -733,8 +733,62 @@ static moo_oop_t string_to_fpdec (moo_t* moo, moo_oocs_t* str)
|
||||
len--;
|
||||
}
|
||||
|
||||
v = moo_strtoint(moo, &str->ptr[pos], len, base);
|
||||
if (!v) return MOO_NULL;
|
||||
if (prescaled)
|
||||
{
|
||||
do
|
||||
{
|
||||
xscale = xscale * 10 + CHAR_TO_NUM(str->ptr[pos], 10);
|
||||
pos++;
|
||||
len--;
|
||||
}
|
||||
while (str->ptr[pos] != 'p');
|
||||
|
||||
pos++;
|
||||
len--;
|
||||
}
|
||||
else xscale = scale;
|
||||
|
||||
/* the caller guarantees that the scale is greater than 0 if not pre-scaled.
|
||||
* it might be zero if pre-scaled. but it guarantees that the prescale is
|
||||
* greater than 0 */
|
||||
|
||||
if (scale < xscale)
|
||||
{
|
||||
/* need to add more zeros */
|
||||
moo_ooch_t* tmp;
|
||||
moo_oow_t explen;
|
||||
|
||||
explen = len + xscale - scale;
|
||||
/* TODO: reuse this buffer? */
|
||||
tmp = moo_allocmem(moo, explen * MOO_SIZEOF(*tmp));
|
||||
if (!tmp)
|
||||
{
|
||||
const moo_ooch_t* oldmsg = moo_backuperrmsg(moo);
|
||||
moo_seterrbfmt (moo, moo_geterrnum(moo), "unable to convert to fpdec %.*js - %js", str->len, str->ptr, oldmsg);
|
||||
return MOO_NULL;
|
||||
}
|
||||
|
||||
moo_copy_oochars (tmp, &str->ptr[pos], len);
|
||||
moo_fill_oochars (&tmp[len], '0', explen - len);
|
||||
v = moo_strtoint(moo, tmp, explen, base);
|
||||
moo_freemem (moo, tmp);
|
||||
scale = xscale;
|
||||
}
|
||||
else if (scale > xscale)
|
||||
{
|
||||
v = moo_strtoint(moo, &str->ptr[pos], len - (scale - xscale), base);
|
||||
scale = xscale;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = moo_strtoint(moo, &str->ptr[pos], len, base);
|
||||
}
|
||||
if (!v)
|
||||
{
|
||||
const moo_ooch_t* oldmsg = moo_backuperrmsg(moo);
|
||||
moo_seterrbfmt (moo, moo_geterrnum(moo), "unable to convert to fpdec %.*js - %js", str->len, str->ptr, oldmsg);
|
||||
return MOO_NULL;
|
||||
}
|
||||
|
||||
return moo_makefpdec(moo, v, scale);
|
||||
}
|
||||
@ -1366,7 +1420,7 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
*/
|
||||
|
||||
moo_ooci_t c;
|
||||
moo_oow_t radix = 0;
|
||||
moo_oow_t radix = 0, xscale = 0;
|
||||
int radix_overflowed = 0;
|
||||
|
||||
c = moo->c->lxc.c;
|
||||
@ -1407,7 +1461,23 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
}
|
||||
while (is_digitchar(c));
|
||||
|
||||
if (c == 'r')
|
||||
if (c == 'p')
|
||||
{
|
||||
/* fixed-point decimal with the scale specified.
|
||||
* 5p99 -> 99.0000, 5p99.12 -> 99.12000
|
||||
* treat the raxid value as the scale */
|
||||
|
||||
if (radix_overflowed || radix < 1 || radix > MOO_SMOOI_MAX)
|
||||
{
|
||||
moo_setsynerr (moo, MOO_SYNERR_FPDECSCALEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||
return -1;
|
||||
}
|
||||
|
||||
xscale = radix;
|
||||
radix = 10;
|
||||
goto radixed; /* not really radixed. but use the same code. will eventually jump to fixed-point */
|
||||
}
|
||||
else if (c == 'r')
|
||||
{
|
||||
/* radix specifier */
|
||||
|
||||
@ -1418,13 +1488,14 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
return -1;
|
||||
}
|
||||
|
||||
radixed:
|
||||
ADD_TOKEN_CHAR (moo, c);
|
||||
GET_CHAR_TO (moo, c);
|
||||
|
||||
if (CHAR_TO_NUM(c, radix) >= radix)
|
||||
{
|
||||
/* no digit after the radix specifier */
|
||||
moo_setsynerr (moo, MOO_SYNERR_RADINTLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||
moo_setsynerr (moo, (xscale > 0? MOO_SYNERR_FPDECLITINVAL: MOO_SYNERR_RADINTLITINVAL), TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1432,6 +1503,8 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
{
|
||||
ADD_TOKEN_CHAR (moo, c);
|
||||
GET_CHAR_TO (moo, c);
|
||||
if (xscale > 0 && c == '.') goto fixed_point;
|
||||
|
||||
if (c == '_')
|
||||
{
|
||||
moo_iolxc_t underscore;
|
||||
@ -1448,7 +1521,7 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
}
|
||||
while (CHAR_TO_NUM(c, radix) < radix);
|
||||
|
||||
SET_TOKEN_TYPE (moo, MOO_IOTOK_RADINTLIT);
|
||||
SET_TOKEN_TYPE (moo, (xscale > 0? MOO_IOTOK_SCALEDFPDECLIT: MOO_IOTOK_RADINTLIT));
|
||||
unget_char (moo, &moo->c->lxc);
|
||||
}
|
||||
else if (c == '.')
|
||||
@ -1456,6 +1529,7 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
moo_iolxc_t period;
|
||||
moo_oow_t scale = 0;
|
||||
|
||||
fixed_point:
|
||||
period = moo->c->lxc;
|
||||
GET_CHAR_TO (moo, c);
|
||||
if (!is_digitchar(c))
|
||||
@ -1468,7 +1542,7 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
ADD_TOKEN_CHAR (moo, '.');
|
||||
do
|
||||
{
|
||||
if (scale >= MOO_SMOOI_MAX)
|
||||
if (scale > MOO_SMOOI_MAX)
|
||||
{
|
||||
moo_setsynerrbfmt (moo, MOO_SYNERR_FPDECLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo), "invalid fixed-point decimal - too many digits after point");
|
||||
return -1;
|
||||
@ -1494,15 +1568,13 @@ static int get_numlit (moo_t* moo, int negated)
|
||||
|
||||
MOO_ASSERT (moo, scale > 0 && scale <= MOO_SMOOI_MAX);
|
||||
|
||||
/* TODO: handle floating-point? fpdec if only suffixed with 's' like 1.23s4?, 'e','g' for floating point?
|
||||
* for now, there is no floating point support. as long as a point appears, it's a fpdec number. */
|
||||
SET_TOKEN_TYPE (moo, MOO_IOTOK_FPDECLIT);
|
||||
SET_TOKEN_TYPE (moo, (xscale > 0? MOO_IOTOK_SCALEDFPDECLIT: MOO_IOTOK_FPDECLIT));
|
||||
unget_char (moo, &moo->c->lxc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unget_char (moo, &moo->c->lxc);
|
||||
unget_char (moo, &moo->c->lxc);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5295,10 +5367,11 @@ static int compile_expression_primary (moo_t* moo, const moo_oocs_t* ident, cons
|
||||
}
|
||||
|
||||
case MOO_IOTOK_FPDECLIT:
|
||||
case MOO_IOTOK_SCALEDFPDECLIT:
|
||||
{
|
||||
moo_oop_t tmp;
|
||||
|
||||
tmp = string_to_fpdec(moo, TOKEN_NAME(moo));
|
||||
tmp = string_to_fpdec(moo, TOKEN_NAME(moo), TOKEN_TYPE(moo) == MOO_IOTOK_SCALEDFPDECLIT);
|
||||
if (!tmp) return -1;
|
||||
|
||||
if (add_literal(moo, tmp, &index) <= -1 ||
|
||||
@ -8703,9 +8776,10 @@ static moo_oop_t token_to_literal (moo_t* moo, int rdonly)
|
||||
}
|
||||
|
||||
case MOO_IOTOK_FPDECLIT:
|
||||
case MOO_IOTOK_SCALEDFPDECLIT:
|
||||
{
|
||||
moo_oop_t lit;
|
||||
lit = string_to_fpdec(moo, TOKEN_NAME(moo));
|
||||
lit = string_to_fpdec(moo, TOKEN_NAME(moo), TOKEN_TYPE(moo) == MOO_IOTOK_SCALEDFPDECLIT);
|
||||
if (rdonly && lit && MOO_OOP_IS_POINTER(lit)) MOO_OBJ_SET_FLAGS_RDONLY (lit, 1);
|
||||
return lit;
|
||||
}
|
||||
|
131
moo/lib/err.c
131
moo/lib/err.c
@ -84,70 +84,71 @@ static moo_ooch_t synerrstr_8[] = {'c','o','l','o','n',' ','e','x','p','e','c','
|
||||
static moo_ooch_t synerrstr_9[] = {'s','t','r','i','n','g',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_10[] = {'i','n','v','a','l','i','d',' ','r','a','d','i','x','\0'};
|
||||
static moo_ooch_t synerrstr_11[] = {'i','n','v','a','l','i','d',' ','i','n','t','e','g','e','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_12[] = {'i','n','v','a','l','i','d',' ','f','i','x','e','d','-','p','o','i','n','t',' ','d','e','c','i','m','a','l',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_13[] = {'b','y','t','e',' ','t','o','o',' ','s','m','a','l','l',' ','o','r',' ','t','o','o',' ','l','a','r','g','e','\0'};
|
||||
static moo_ooch_t synerrstr_14[] = {'w','r','o','n','g',' ','e','r','r','o','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_15[] = {'w','r','o','n','g',' ','s','m','p','t','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_16[] = {'{',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_17[] = {'}',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_18[] = {'(',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_19[] = {')',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_20[] = {']',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_21[] = {'.',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_22[] = {',',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_23[] = {'|',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_24[] = {'>',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_25[] = {':','=',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_26[] = {'i','d','e','n','t','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_27[] = {'i','n','t','e','g','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_28[] = {'p','r','i','m','i','t','i','v','e',':',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_29[] = {'w','r','o','n','g',' ','d','i','r','e','c','t','i','v','e','\0'};
|
||||
static moo_ooch_t synerrstr_30[] = {'w','r','o','n','g',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_31[] = {'d','u','p','l','i','c','a','t','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_32[] = {'u','n','d','e','f','i','n','e','d',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_33[] = {'c','o','n','t','r','a','d','i','c','t','o','r','y',' ','c','l','a','s','s',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_34[] = {'c','l','a','s','s',' ','n','o','t',' ','c','o','n','f','o','r','m','i','n','g',' ','t','o',' ','i','n','t','e','r','f','a','c','e','\0'};
|
||||
static moo_ooch_t synerrstr_35[] = {'i','n','v','a','l','i','d',' ','n','o','n','-','p','o','i','n','t','e','r',' ','i','n','s','t','a','n','c','e',' ','s','i','z','e','\0'};
|
||||
static moo_ooch_t synerrstr_36[] = {'p','r','o','h','i','b','i','t','e','d',' ','i','n','h','e','r','i','t','a','n','c','e','\0'};
|
||||
static moo_ooch_t synerrstr_37[] = {'v','a','r','i','a','b','l','e',' ','d','e','c','l','a','r','a','t','i','o','n',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_38[] = {'m','o','d','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_39[] = {'w','r','o','n','g',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_40[] = {'d','i','s','a','l','l','o','w','e','d',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_41[] = {'d','u','p','l','i','c','a','t','e',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_42[] = {'m','e','t','h','o','d',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_43[] = {'d','u','p','l','i','c','a','t','e',' ','m','e','t','h','o','d',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_44[] = {'i','n','v','a','l','i','d',' ','v','a','r','i','a','d','i','c',' ','m','e','t','h','o','d',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_45[] = {'v','a','r','i','a','b','l','e',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_46[] = {'d','u','p','l','i','c','a','t','e',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_47[] = {'d','u','p','l','i','c','a','t','e',' ','t','e','m','p','o','r','a','r','y',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_48[] = {'d','u','p','l','i','c','a','t','e',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_49[] = {'d','u','p','l','i','c','a','t','e',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_50[] = {'u','n','d','e','c','l','a','r','e','d',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_51[] = {'u','n','u','s','a','b','l','e',' ','v','a','r','i','a','b','l','e',' ','i','n',' ','c','o','m','p','i','l','e','d',' ','c','o','d','e','\0'};
|
||||
static moo_ooch_t synerrstr_52[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_53[] = {'a','m','b','i','g','u','o','u','s',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_54[] = {'t','o','o',' ','m','a','n','y',' ','i','n','s','t','a','n','c','e','/','c','l','a','s','s',' ','v','a','r','i','a','b','l','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_55[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','s','e','l','f','\0'};
|
||||
static moo_ooch_t synerrstr_56[] = {'w','r','o','n','g',' ','e','x','p','r','e','s','s','i','o','n',' ','p','r','i','m','a','r','y','\0'};
|
||||
static moo_ooch_t synerrstr_57[] = {'t','o','o',' ','m','a','n','y',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_58[] = {'t','o','o',' ','m','a','n','y',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static moo_ooch_t synerrstr_59[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_60[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static moo_ooch_t synerrstr_61[] = {'t','o','o',' ','l','a','r','g','e',' ','b','l','o','c','k','\0'};
|
||||
static moo_ooch_t synerrstr_62[] = {'t','o','o',' ','l','a','r','g','e',' ','a','r','r','a','y',' ','e','x','p','r','e','s','s','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_63[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','n','u','m','b','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_64[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','i','d','e','n','t','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_65[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','a','r','g','u','m','e','n','t',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_66[] = {'f','a','i','l','e','d',' ','t','o',' ','i','m','p','o','r','t',' ','m','o','d','u','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_67[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
|
||||
static moo_ooch_t synerrstr_68[] = {'w','r','o','n','g',' ','p','r','a','g','m','a',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_69[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_70[] = {'w','r','o','n','g',' ','p','o','o','l','d','i','c','i','m','p','o','r','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_71[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l','d','i','c','i','m','p','o','r','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_72[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_73[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','n','o','t',' ','w','i','t','h','i','n',' ','a',' ','l','o','o','p','\0'};
|
||||
static moo_ooch_t synerrstr_74[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','w','i','t','h','i','n',' ','a',' ','b','l','o','c','k','\0'};
|
||||
static moo_ooch_t synerrstr_75[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_12[] = {'i','n','v','a','l','i','d',' ','f','i','x','e','d','-','p','o','i','n','t',' ','d','e','c','i','m','a','l',' ','s','c','a','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_13[] = {'i','n','v','a','l','i','d',' ','f','i','x','e','d','-','p','o','i','n','t',' ','d','e','c','i','m','a','l',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_14[] = {'b','y','t','e',' ','t','o','o',' ','s','m','a','l','l',' ','o','r',' ','t','o','o',' ','l','a','r','g','e','\0'};
|
||||
static moo_ooch_t synerrstr_15[] = {'w','r','o','n','g',' ','e','r','r','o','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_16[] = {'w','r','o','n','g',' ','s','m','p','t','r',' ','l','i','t','e','r','a','l','\0'};
|
||||
static moo_ooch_t synerrstr_17[] = {'{',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_18[] = {'}',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_19[] = {'(',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_20[] = {')',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_21[] = {']',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_22[] = {'.',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_23[] = {',',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_24[] = {'|',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_25[] = {'>',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_26[] = {':','=',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_27[] = {'i','d','e','n','t','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_28[] = {'i','n','t','e','g','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_29[] = {'p','r','i','m','i','t','i','v','e',':',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_30[] = {'w','r','o','n','g',' ','d','i','r','e','c','t','i','v','e','\0'};
|
||||
static moo_ooch_t synerrstr_31[] = {'w','r','o','n','g',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_32[] = {'d','u','p','l','i','c','a','t','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_33[] = {'u','n','d','e','f','i','n','e','d',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_34[] = {'c','o','n','t','r','a','d','i','c','t','o','r','y',' ','c','l','a','s','s',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_35[] = {'c','l','a','s','s',' ','n','o','t',' ','c','o','n','f','o','r','m','i','n','g',' ','t','o',' ','i','n','t','e','r','f','a','c','e','\0'};
|
||||
static moo_ooch_t synerrstr_36[] = {'i','n','v','a','l','i','d',' ','n','o','n','-','p','o','i','n','t','e','r',' ','i','n','s','t','a','n','c','e',' ','s','i','z','e','\0'};
|
||||
static moo_ooch_t synerrstr_37[] = {'p','r','o','h','i','b','i','t','e','d',' ','i','n','h','e','r','i','t','a','n','c','e','\0'};
|
||||
static moo_ooch_t synerrstr_38[] = {'v','a','r','i','a','b','l','e',' ','d','e','c','l','a','r','a','t','i','o','n',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_39[] = {'m','o','d','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_40[] = {'w','r','o','n','g',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_41[] = {'d','i','s','a','l','l','o','w','e','d',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_42[] = {'d','u','p','l','i','c','a','t','e',' ','m','o','d','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_43[] = {'m','e','t','h','o','d',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_44[] = {'d','u','p','l','i','c','a','t','e',' ','m','e','t','h','o','d',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_45[] = {'i','n','v','a','l','i','d',' ','v','a','r','i','a','d','i','c',' ','m','e','t','h','o','d',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_46[] = {'v','a','r','i','a','b','l','e',' ','n','a','m','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_47[] = {'d','u','p','l','i','c','a','t','e',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_48[] = {'d','u','p','l','i','c','a','t','e',' ','t','e','m','p','o','r','a','r','y',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_49[] = {'d','u','p','l','i','c','a','t','e',' ','v','a','r','i','a','b','l','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_50[] = {'d','u','p','l','i','c','a','t','e',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_51[] = {'u','n','d','e','c','l','a','r','e','d',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_52[] = {'u','n','u','s','a','b','l','e',' ','v','a','r','i','a','b','l','e',' ','i','n',' ','c','o','m','p','i','l','e','d',' ','c','o','d','e','\0'};
|
||||
static moo_ooch_t synerrstr_53[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_54[] = {'a','m','b','i','g','u','o','u','s',' ','v','a','r','i','a','b','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_55[] = {'t','o','o',' ','m','a','n','y',' ','i','n','s','t','a','n','c','e','/','c','l','a','s','s',' ','v','a','r','i','a','b','l','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_56[] = {'i','n','a','c','c','e','s','s','i','b','l','e',' ','s','e','l','f','\0'};
|
||||
static moo_ooch_t synerrstr_57[] = {'w','r','o','n','g',' ','e','x','p','r','e','s','s','i','o','n',' ','p','r','i','m','a','r','y','\0'};
|
||||
static moo_ooch_t synerrstr_58[] = {'t','o','o',' ','m','a','n','y',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_59[] = {'t','o','o',' ','m','a','n','y',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static moo_ooch_t synerrstr_60[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
|
||||
static moo_ooch_t synerrstr_61[] = {'t','o','o',' ','m','a','n','y',' ','b','l','o','c','k',' ','a','r','g','u','m','e','n','t','s','\0'};
|
||||
static moo_ooch_t synerrstr_62[] = {'t','o','o',' ','l','a','r','g','e',' ','b','l','o','c','k','\0'};
|
||||
static moo_ooch_t synerrstr_63[] = {'t','o','o',' ','l','a','r','g','e',' ','a','r','r','a','y',' ','e','x','p','r','e','s','s','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_64[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','n','u','m','b','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_65[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','i','d','e','n','t','i','f','i','e','r','\0'};
|
||||
static moo_ooch_t synerrstr_66[] = {'w','r','o','n','g',' ','p','r','i','m','i','t','i','v','e',' ','f','u','n','c','t','i','o','n',' ','a','r','g','u','m','e','n','t',' ','d','e','f','i','n','i','t','i','o','n','\0'};
|
||||
static moo_ooch_t synerrstr_67[] = {'f','a','i','l','e','d',' ','t','o',' ','i','m','p','o','r','t',' ','m','o','d','u','l','e','\0'};
|
||||
static moo_ooch_t synerrstr_68[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
|
||||
static moo_ooch_t synerrstr_69[] = {'w','r','o','n','g',' ','p','r','a','g','m','a',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_70[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_71[] = {'w','r','o','n','g',' ','p','o','o','l','d','i','c','i','m','p','o','r','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_72[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l','d','i','c','i','m','p','o','r','t',' ','n','a','m','e','\0'};
|
||||
static moo_ooch_t synerrstr_73[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t synerrstr_74[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','n','o','t',' ','w','i','t','h','i','n',' ','a',' ','l','o','o','p','\0'};
|
||||
static moo_ooch_t synerrstr_75[] = {'b','r','e','a','k',' ','o','r',' ','c','o','n','t','i','n','u','e',' ','w','i','t','h','i','n',' ','a',' ','b','l','o','c','k','\0'};
|
||||
static moo_ooch_t synerrstr_76[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
|
||||
static moo_ooch_t* synerrstr[] =
|
||||
{
|
||||
synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7,
|
||||
@ -159,7 +160,7 @@ static moo_ooch_t* synerrstr[] =
|
||||
synerrstr_48, synerrstr_49, synerrstr_50, synerrstr_51, synerrstr_52, synerrstr_53, synerrstr_54, synerrstr_55,
|
||||
synerrstr_56, synerrstr_57, synerrstr_58, synerrstr_59, synerrstr_60, synerrstr_61, synerrstr_62, synerrstr_63,
|
||||
synerrstr_64, synerrstr_65, synerrstr_66, synerrstr_67, synerrstr_68, synerrstr_69, synerrstr_70, synerrstr_71,
|
||||
synerrstr_72, synerrstr_73, synerrstr_74, synerrstr_75
|
||||
synerrstr_72, synerrstr_73, synerrstr_74, synerrstr_75, synerrstr_76
|
||||
};
|
||||
#endif
|
||||
/* END: GENERATED WITH generr.moo */
|
||||
|
@ -284,6 +284,7 @@ enum moo_iotok_type_t
|
||||
MOO_IOTOK_INTLIT,
|
||||
MOO_IOTOK_RADINTLIT,
|
||||
MOO_IOTOK_FPDECLIT,
|
||||
MOO_IOTOK_SCALEDFPDECLIT, /* NNpNNNN.NN e.g. 5p10.3 ===> 10.30000 */
|
||||
MOO_IOTOK_ERRLIT, /* #\eNN */
|
||||
MOO_IOTOK_SMPTRLIT, /* #\pXX */
|
||||
|
||||
|
@ -257,6 +257,19 @@ MOO_EXPORT moo_oow_t moo_copy_bcstr (
|
||||
const moo_bch_t* src
|
||||
);
|
||||
|
||||
MOO_EXPORT void moo_fill_uchars (
|
||||
moo_uch_t* dst,
|
||||
const moo_uch_t ch,
|
||||
moo_oow_t len
|
||||
);
|
||||
|
||||
MOO_EXPORT void moo_fill_bchars (
|
||||
moo_bch_t* dst,
|
||||
const moo_bch_t ch,
|
||||
moo_oow_t len
|
||||
);
|
||||
|
||||
|
||||
MOO_EXPORT moo_uch_t* moo_find_uchar (
|
||||
const moo_uch_t* ptr,
|
||||
moo_oow_t len,
|
||||
@ -310,6 +323,7 @@ MOO_EXPORT moo_oow_t moo_count_bcstr (
|
||||
# define moo_copy_oochars(dst,src,len) moo_copy_uchars(dst,src,len)
|
||||
# define moo_copy_bchars_to_oochars(dst,src,len) moo_copy_bchars_to_uchars(dst,src,len)
|
||||
# define moo_copy_oocstr(dst,len,src) moo_copy_ucstr(dst,len,src)
|
||||
# define moo_fill_oochars(dst,ch,len) moo_fill_uchars(dst,ch,len)
|
||||
# define moo_find_oochar(ptr,len,c) moo_find_uchar(ptr,len,c)
|
||||
# define moo_rfind_oochar(ptr,len,c) moo_rfind_uchar(ptr,len,c)
|
||||
# define moo_find_oochar_in_oocstr(ptr,c) moo_find_uchar_in_ucstr(ptr,c)
|
||||
@ -325,6 +339,7 @@ MOO_EXPORT moo_oow_t moo_count_bcstr (
|
||||
# define moo_copy_oochars(dst,src,len) moo_copy_bchars(dst,src,len)
|
||||
# define moo_copy_bchars_to_oochars(dst,src,len) moo_copy_bchars(dst,src,len)
|
||||
# define moo_copy_oocstr(dst,len,src) moo_copy_bcstr(dst,len,src)
|
||||
# define moo_fill_oochars(dst,ch,len) moo_fill_bchars(dst,ch,len)
|
||||
# define moo_find_oochar(ptr,len,c) moo_find_bchar(ptr,len,c)
|
||||
# define moo_rfind_oochar(ptr,len,c) moo_rfind_bchar(ptr,len,c)
|
||||
# define moo_find_oochar_in_oocstr(ptr,c) moo_find_bchar_in_bcstr(ptr,c)
|
||||
|
@ -1812,6 +1812,7 @@ enum moo_synerrnum_t
|
||||
MOO_SYNERR_STRING, /* string expected */
|
||||
MOO_SYNERR_RADIXINVAL, /* invalid radix */
|
||||
MOO_SYNERR_RADINTLITINVAL, /* invalid integer literal with radix */
|
||||
MOO_SYNERR_FPDECSCALEINVAL, /* invalid fixed-point decimal scale */
|
||||
MOO_SYNERR_FPDECLITINVAL, /* invalid fixed-point decimal literal */
|
||||
MOO_SYNERR_BYTERANGE, /* byte too small or too large */
|
||||
MOO_SYNERR_ERRLITINVAL, /* wrong error literal */
|
||||
|
@ -257,6 +257,18 @@ moo_oow_t moo_copy_bcstr (moo_bch_t* dst, moo_oow_t len, const moo_bch_t* src)
|
||||
return p - dst;
|
||||
}
|
||||
|
||||
void moo_fill_uchars (moo_uch_t* dst, moo_uch_t ch, moo_oow_t len)
|
||||
{
|
||||
moo_oow_t i;
|
||||
for (i = 0; i < len; i++) dst[i] = ch;
|
||||
}
|
||||
|
||||
void moo_fill_bchars (moo_bch_t* dst, moo_bch_t ch, moo_oow_t len)
|
||||
{
|
||||
moo_oow_t i;
|
||||
for (i = 0; i < len; i++) dst[i] = ch;
|
||||
}
|
||||
|
||||
moo_oow_t moo_count_ucstr (const moo_uch_t* str)
|
||||
{
|
||||
const moo_uch_t* ptr = str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user