renamed the #native method modifier to #primitive for consistency

improved the method modifier processing logic in the compiler
This commit is contained in:
hyunghwan.chung 2017-02-20 04:45:23 +00:00
parent 6a7cbc8dcb
commit b45d896d9f
6 changed files with 199 additions and 156 deletions

View File

@ -75,7 +75,10 @@ class MyObject(Object)
'wrong class name' 'wrong class name'
'non-pointer class inheriting superclass with trailer size set' 'non-pointer class inheriting superclass with trailer size set'
'dcl not allowed' 'dcl not allowed'
'#native not allowed' 'modifier expected'
'wrong modifier'
'disallowed modifier'
'duplicate modifier'
'wrong method name' 'wrong method name'
'duplicate method name' 'duplicate method name'
'duplicate argument name' 'duplicate argument name'

View File

@ -105,12 +105,12 @@ static struct voca_t
{ 8, { '#','i','n','c','l','u','d','e' } }, { 8, { '#','i','n','c','l','u','d','e' } },
{ 7, { '#','l','i','w','o','r','d' } }, { 7, { '#','l','i','w','o','r','d' } },
{ 6, { 'm','e','t','h','o','d' } }, { 6, { 'm','e','t','h','o','d' } },
{ 7, { '#','n','a','t','i','v','e' } },
{ 3, { 'n','i','l' } }, { 3, { 'n','i','l' } },
{ 8, { '#','p','o','i','n','t','e','r' } }, { 8, { '#','p','o','i','n','t','e','r' } },
{ 7, { 'p','o','o','l','d','i','c' } }, { 7, { 'p','o','o','l','d','i','c' } },
{ 8, { '#','p','o','o','l','d','i','c' } }, { 8, { '#','p','o','o','l','d','i','c' } },
{ 10, { 'p','r','i','m','i','t','i','v','e',':' } }, { 10, { 'p','r','i','m','i','t','i','v','e',':' } },
{ 10, { '#','p','r','i','m','i','t','i','v','e' } },
{ 4, { 's','e','l','f' } }, { 4, { 's','e','l','f' } },
{ 5, { 's','u','p','e','r' } }, { 5, { 's','u','p','e','r' } },
{ 11, { 't','h','i','s','C','o','n','t','e','x','t' } }, { 11, { 't','h','i','s','C','o','n','t','e','x','t' } },
@ -151,12 +151,12 @@ enum voca_id_t
VOCA_INCLUDE_S, VOCA_INCLUDE_S,
VOCA_LIWORD_S, VOCA_LIWORD_S,
VOCA_METHOD, VOCA_METHOD,
VOCA_NATIVE_S,
VOCA_NIL, VOCA_NIL,
VOCA_POINTER_S, VOCA_POINTER_S,
VOCA_POOLDIC, VOCA_POOLDIC,
VOCA_POOLDIC_S, VOCA_POOLDIC_S,
VOCA_PRIMITIVE_COLON, VOCA_PRIMITIVE_COLON,
VOCA_PRIMITIVE_S,
VOCA_SELF, VOCA_SELF,
VOCA_SUPER, VOCA_SUPER,
VOCA_THIS_CONTEXT, VOCA_THIS_CONTEXT,
@ -941,7 +941,7 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead)
if (!is_digitchar(c)) if (!is_digitchar(c))
{ {
ADD_TOKEN_CHAR (moo, c); ADD_TOKEN_CHAR (moo, c);
set_syntax_error (moo, MOO_SYNERR_ERRLIT, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_ERRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -1165,7 +1165,7 @@ static int get_numlit (moo_t* moo, int negated)
if (radix < 2 || radix > 36) if (radix < 2 || radix > 36)
{ {
/* no digit after the radix specifier */ /* no digit after the radix specifier */
set_syntax_error (moo, MOO_SYNERR_RADIX, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_RADIXINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -1175,7 +1175,7 @@ static int get_numlit (moo_t* moo, int negated)
if (CHAR_TO_NUM(c, radix) >= radix) if (CHAR_TO_NUM(c, radix) >= radix)
{ {
/* no digit after the radix specifier */ /* no digit after the radix specifier */
set_syntax_error (moo, MOO_SYNERR_RADNUMLIT, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_RADNUMLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -1747,7 +1747,7 @@ retry:
{ {
if (moo->c->tok.name.len != 1) if (moo->c->tok.name.len != 1)
{ {
set_syntax_error (moo, MOO_SYNERR_CHARLIT, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_CHARLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
SET_TOKEN_TYPE (moo, MOO_IOTOK_CHARLIT); SET_TOKEN_TYPE (moo, MOO_IOTOK_CHARLIT);
@ -2911,7 +2911,7 @@ static int preprocess_dotted_name (moo_t* moo, int dont_add_ns, int accept_poold
wrong_name: wrong_name:
seg.len += seg.ptr - fqn->ptr; seg.len += seg.ptr - fqn->ptr;
seg.ptr = fqn->ptr; seg.ptr = fqn->ptr;
set_syntax_error (moo, MOO_SYNERR_NAMESPACE, fqn_loc, &seg); set_syntax_error (moo, MOO_SYNERR_NAMESPACEINVAL, fqn_loc, &seg);
return -1; return -1;
} }
@ -2937,7 +2937,7 @@ static int resolve_pooldic (moo_t* moo, int dotted, const moo_oocs_t* name)
ass = moo_lookupdic (moo, ns_oop, &last); ass = moo_lookupdic (moo, ns_oop, &last);
if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary) if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary)
{ {
set_syntax_error (moo, MOO_SYNERR_POOLDIC, TOKEN_LOC(moo), name); set_syntax_error (moo, MOO_SYNERR_POOLDICINVAL, TOKEN_LOC(moo), name);
return -1; return -1;
} }
@ -2946,7 +2946,7 @@ static int resolve_pooldic (moo_t* moo, int dotted, const moo_oocs_t* name)
{ {
if ((moo_oop_set_t)ass->value == moo->c->cls.pooldic_imp_oops[i]) if ((moo_oop_set_t)ass->value == moo->c->cls.pooldic_imp_oops[i])
{ {
set_syntax_error (moo, MOO_SYNERR_POOLDICDUP, TOKEN_LOC(moo), name); set_syntax_error (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), name);
return -1; return -1;
} }
} }
@ -2963,7 +2963,7 @@ static int import_pool_dictionary (moo_t* moo, moo_oop_set_t ns_oop, const moo_o
ass = moo_lookupdic (moo, ns_oop, tok_lastseg); ass = moo_lookupdic (moo, ns_oop, tok_lastseg);
if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary) if (!ass || MOO_CLASSOF(moo, ass->value) != moo->_pool_dictionary)
{ {
set_syntax_error (moo, MOO_SYNERR_POOLDIC, tok_loc, tok_name); set_syntax_error (moo, MOO_SYNERR_POOLDICINVAL, tok_loc, tok_name);
return -1; return -1;
} }
@ -2972,7 +2972,7 @@ static int import_pool_dictionary (moo_t* moo, moo_oop_set_t ns_oop, const moo_o
{ {
if ((moo_oop_set_t)ass->value == moo->c->cls.pooldic_imp_oops[i]) if ((moo_oop_set_t)ass->value == moo->c->cls.pooldic_imp_oops[i])
{ {
set_syntax_error (moo, MOO_SYNERR_POOLDICDUP, tok_loc, tok_name); set_syntax_error (moo, MOO_SYNERR_POOLDICDUPL, tok_loc, tok_name);
return -1; return -1;
} }
} }
@ -3070,7 +3070,7 @@ if super is variable-nonpointer, no instance variable is allowed.
*/ */
if (dcl_type == VAR_INSTANCE && (moo->c->cls.flags & CLASS_INDEXED) && (moo->c->cls.indexed_type != MOO_OBJ_TYPE_OOP)) if (dcl_type == VAR_INSTANCE && (moo->c->cls.flags & CLASS_INDEXED) && (moo->c->cls.indexed_type != MOO_OBJ_TYPE_OOP))
{ {
set_syntax_error (moo, MOO_SYNERR_VARNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3078,7 +3078,7 @@ if super is variable-nonpointer, no instance variable is allowed.
moo_lookupdic (moo, moo->sysdic, TOKEN_NAME(moo)) || /* conflicts with a top global name */ moo_lookupdic (moo, moo->sysdic, TOKEN_NAME(moo)) || /* conflicts with a top global name */
moo_lookupdic (moo, moo->c->cls.ns_oop, TOKEN_NAME(moo))) /* conflicts with a global name in the class'es name space */ moo_lookupdic (moo, moo->c->cls.ns_oop, TOKEN_NAME(moo))) /* conflicts with a global name in the class'es name space */
{ {
set_syntax_error (moo, MOO_SYNERR_VARNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_VARNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3131,7 +3131,7 @@ static int compile_unary_method_name (moo_t* moo)
if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0)
{ {
set_syntax_error (moo, MOO_SYNERR_ARGNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3215,7 +3215,7 @@ static int compile_keyword_method_name (moo_t* moo)
if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0)
{ {
set_syntax_error (moo, MOO_SYNERR_ARGNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_ARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3268,7 +3268,7 @@ static int compile_method_name (moo_t* moo)
{ {
if (method_exists(moo, &moo->c->mth.name)) if (method_exists(moo, &moo->c->mth.name))
{ {
set_syntax_error (moo, MOO_SYNERR_MTHNAMEDUP, &moo->c->mth.name_loc, &moo->c->mth.name); set_syntax_error (moo, MOO_SYNERR_MTHNAMEDUPL, &moo->c->mth.name_loc, &moo->c->mth.name);
return -1; return -1;
} }
} }
@ -3300,7 +3300,7 @@ static int compile_method_temporaries (moo_t* moo)
{ {
if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0)
{ {
set_syntax_error (moo, MOO_SYNERR_TMPRNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3359,7 +3359,7 @@ static int compile_method_primitive (moo_t* moo)
pfnum = pfnum * 10 + (*ptr - '0'); pfnum = pfnum * 10 + (*ptr - '0');
if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum)) if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum))
{ {
set_syntax_error (moo, MOO_SYNERR_PFNUM, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_PFNUMINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3396,12 +3396,12 @@ static int compile_method_primitive (moo_t* moo)
} }
/* wrong primitive number */ /* wrong primitive number */
set_syntax_error (moo, MOO_SYNERR_PFID, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
else if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum)) else if (!MOO_OOI_IN_METHOD_PREAMBLE_INDEX_RANGE(pfnum))
{ {
set_syntax_error (moo, MOO_SYNERR_PFID, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_PFIDINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3640,7 +3640,7 @@ static int compile_block_temporaries (moo_t* moo)
{ {
if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0)
{ {
set_syntax_error (moo, MOO_SYNERR_TMPRNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_TMPRNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -3735,7 +3735,7 @@ static int compile_block_expression (moo_t* moo)
/* TODO: check conflicting names as well */ /* TODO: check conflicting names as well */
if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0) if (find_temporary_variable(moo, TOKEN_NAME(moo), MOO_NULL) >= 0)
{ {
set_syntax_error (moo, MOO_SYNERR_BLKARGNAMEDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_BLKARGNAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -4534,7 +4534,7 @@ static int compile_expression_primary (moo_t* moo, const moo_oocs_t* ident, cons
break; break;
default: default:
set_syntax_error (moo, MOO_SYNERR_PRIMARY, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_PRIMARYINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
} }
@ -5798,7 +5798,7 @@ static int compile_method_definition (moo_t* moo)
{ {
/* clear data required to compile a method */ /* clear data required to compile a method */
moo->c->mth.type = MOO_METHOD_INSTANCE; moo->c->mth.type = MOO_METHOD_INSTANCE;
moo->c->mth.native = 0; moo->c->mth.primitive = 0;
moo->c->mth.text.len = 0; moo->c->mth.text.len = 0;
moo->c->mth.assignees.len = 0; moo->c->mth.assignees.len = 0;
moo->c->mth.binsels.len = 0; moo->c->mth.binsels.len = 0;
@ -5820,31 +5820,62 @@ static int compile_method_definition (moo_t* moo)
if (TOKEN_TYPE(moo) == MOO_IOTOK_LPAREN) if (TOKEN_TYPE(moo) == MOO_IOTOK_LPAREN)
{ {
/* process method modifiers */ /* process method modifiers */
next_modifier:
GET_TOKEN (moo); GET_TOKEN (moo);
if (is_token_symbol(moo, VOCA_CLASS_S)) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN)
{ {
/* method(#class) */ do
moo->c->mth.type = MOO_METHOD_CLASS;
GET_TOKEN (moo);
}
else if (is_token_symbol(moo, VOCA_NATIVE_S))
{
/* method(#native) */
if (moo->c->cls.self_oop->modname == moo->_nil)
{ {
set_syntax_error (moo, MOO_SYNERR_NATIVEBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo)); if (is_token_symbol(moo, VOCA_CLASS_S))
return -1; {
/* method(#class) */
if (moo->c->mth.type == MOO_METHOD_CLASS)
{
set_syntax_error (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1;
}
moo->c->mth.type = MOO_METHOD_CLASS;
GET_TOKEN (moo);
}
else if (is_token_symbol(moo, VOCA_PRIMITIVE_S))
{
/* method(#primitive) */
if (moo->c->cls.self_oop->modname == moo->_nil)
{
MOO_DEBUG2 (moo, "Disallowed #primitive method modifier in the class %.*js without 'from'\n",
MOO_OBJ_GET_SIZE(moo->c->cls.self_oop->name),
MOO_OBJ_GET_CHAR_SLOT(moo->c->cls.self_oop->name));
set_syntax_error (moo, MOO_SYNERR_MODIFIERBANNED, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1;
}
if (moo->c->mth.primitive)
{
set_syntax_error (moo, MOO_SYNERR_MODIFIERDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1;
}
moo->c->mth.primitive = 1;
GET_TOKEN (moo);
}
else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_RPAREN)
{
/* no modifier is present */
set_syntax_error (moo, MOO_SYNERR_MODIFIER, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1;
}
else
{
/* invalid modifier */
set_syntax_error (moo, MOO_SYNERR_MODIFIERINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1;
}
if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA) break; /* hopefully ) */
GET_TOKEN (moo); /* get the token after , */
} }
while (1);
moo->c->mth.native = 1;
GET_TOKEN (moo);
}
if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA)
{
goto next_modifier;
} }
if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN) if (TOKEN_TYPE(moo) != MOO_IOTOK_RPAREN)
@ -5859,8 +5890,11 @@ static int compile_method_definition (moo_t* moo)
if (compile_method_name(moo) <= -1) return -1; if (compile_method_name(moo) <= -1) return -1;
if (moo->c->mth.native) if (moo->c->mth.primitive)
{ {
/* the primitive method must be of this form
* method(#primitive) method_name.
*/
moo_oow_t litidx, savedlen; moo_oow_t litidx, savedlen;
moo_oocs_t tmp; moo_oocs_t tmp;
@ -5871,7 +5905,7 @@ static int compile_method_definition (moo_t* moo)
return -1; return -1;
} }
/* TODO: i can check if the native method is available at compile time by querying the module. /* TODO: i can check if the primitive method is available at compile time by querying the module.
* do the check depending on the compiler option */ * do the check depending on the compiler option */
/* combine the module name and the method name delimited by a period /* combine the module name and the method name delimited by a period
@ -5879,7 +5913,7 @@ static int compile_method_definition (moo_t* moo)
* back once done */ * back once done */
MOO_ASSERT (moo, MOO_CLASSOF(moo, moo->c->cls.self_oop->modname) == moo->_symbol); MOO_ASSERT (moo, MOO_CLASSOF(moo, moo->c->cls.self_oop->modname) == moo->_symbol);
savedlen = moo->c->cls.modname.len; savedlen = moo->c->cls.modname.len;
tmp.ptr = ((moo_oop_char_t)moo->c->cls.self_oop->modname)->slot; tmp.ptr = MOO_OBJ_GET_CHAR_SLOT(moo->c->cls.self_oop->modname);
tmp.len = MOO_OBJ_GET_SIZE(moo->c->cls.self_oop->modname); tmp.len = MOO_OBJ_GET_SIZE(moo->c->cls.self_oop->modname);
if (copy_string_to (moo, &tmp, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '\0') <= -1 || if (copy_string_to (moo, &tmp, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '\0') <= -1 ||
copy_string_to (moo, &moo->c->mth.name, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '.') <= -1 || copy_string_to (moo, &moo->c->mth.name, &moo->c->cls.modname, &moo->c->cls.modname_capa, 1, '.') <= -1 ||
@ -6137,7 +6171,7 @@ static int __compile_class_definition (moo_t* moo, int extend)
if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT && is_restricted_word (TOKEN_NAME(moo))) if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT && is_restricted_word (TOKEN_NAME(moo)))
{ {
/* wrong class name */ /* wrong class name */
set_syntax_error (moo, MOO_SYNERR_CLASSNAME, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_CLASSNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
#endif #endif
@ -6253,7 +6287,7 @@ static int __compile_class_definition (moo_t* moo, int extend)
/* the object found with the name is not a class object /* the object found with the name is not a class object
* or the the class object found is a fully defined kernel * or the the class object found is a fully defined kernel
* class object */ * class object */
set_syntax_error (moo, MOO_SYNERR_CLASSDUP, &moo->c->cls.fqn_loc, &moo->c->cls.name); set_syntax_error (moo, MOO_SYNERR_CLASSDUPL, &moo->c->cls.fqn_loc, &moo->c->cls.name);
return -1; return -1;
} }
@ -6327,7 +6361,7 @@ static int __compile_class_definition (moo_t* moo, int extend)
* a period to a dash when mapping the module name to an * a period to a dash when mapping the module name to an
* actual module file. disallowing a dash lowers confusion * actual module file. disallowing a dash lowers confusion
* when loading a module. */ * when loading a module. */
set_syntax_error (moo, MOO_SYNERR_MODNAME, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_MODNAMEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -6581,7 +6615,7 @@ static int __compile_pooldic_definition (moo_t* moo)
if (moo_lookupdic (moo, moo->c->cls.ns_oop, &moo->c->cls.name)) if (moo_lookupdic (moo, moo->c->cls.ns_oop, &moo->c->cls.name))
{ {
/* a conflicting entry has been found */ /* a conflicting entry has been found */
set_syntax_error (moo, MOO_SYNERR_POOLDICDUP, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error (moo, MOO_SYNERR_POOLDICDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -6786,7 +6820,7 @@ static int compile_stream (moo_t* moo)
#endif #endif
else else
{ {
set_syntax_error(moo, MOO_SYNERR_DIRECTIVE, TOKEN_LOC(moo), TOKEN_NAME(moo)); set_syntax_error(moo, MOO_SYNERR_DIRECTIVEINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
} }

View File

@ -28,7 +28,7 @@
/* BEGIN: GENERATED WITH generr.st */ /* BEGIN: GENERATED WITH generr.moo */
static moo_ooch_t errstr_0[] = {'n','o',' ','e','r','r','o','r','\0'}; static moo_ooch_t errstr_0[] = {'n','o',' ','e','r','r','o','r','\0'};
static moo_ooch_t errstr_1[] = {'g','e','n','e','r','i','c',' ','e','r','r','o','r','\0'}; static moo_ooch_t errstr_1[] = {'g','e','n','e','r','i','c',' ','e','r','r','o','r','\0'};
@ -101,38 +101,41 @@ static moo_ooch_t synerrstr_29[] = {'c','o','n','t','r','a','d','i','c','t','o',
static moo_ooch_t synerrstr_30[] = {'w','r','o','n','g',' ','c','l','a','s','s',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_30[] = {'w','r','o','n','g',' ','c','l','a','s','s',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_31[] = {'n','o','n','-','p','o','i','n','t','e','r',' ','c','l','a','s','s',' ','i','n','h','e','r','i','t','i','n','g',' ','s','u','p','e','r','c','l','a','s','s',' ','w','i','t','h',' ','t','r','a','i','l','e','r',' ','s','i','z','e',' ','s','e','t','\0'}; static moo_ooch_t synerrstr_31[] = {'n','o','n','-','p','o','i','n','t','e','r',' ','c','l','a','s','s',' ','i','n','h','e','r','i','t','i','n','g',' ','s','u','p','e','r','c','l','a','s','s',' ','w','i','t','h',' ','t','r','a','i','l','e','r',' ','s','i','z','e',' ','s','e','t','\0'};
static moo_ooch_t synerrstr_32[] = {'d','c','l',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'}; static moo_ooch_t synerrstr_32[] = {'d','c','l',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'};
static moo_ooch_t synerrstr_33[] = {'#','n','a','t','i','v','e',' ','n','o','t',' ','a','l','l','o','w','e','d','\0'}; static moo_ooch_t synerrstr_33[] = {'m','o','d','i','f','i','e','r',' ','e','x','p','e','c','t','e','d','\0'};
static moo_ooch_t synerrstr_34[] = {'w','r','o','n','g',' ','m','e','t','h','o','d',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_34[] = {'w','r','o','n','g',' ','m','o','d','i','f','i','e','r','\0'};
static moo_ooch_t synerrstr_35[] = {'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_35[] = {'d','i','s','a','l','l','o','w','e','d',' ','m','o','d','i','f','i','e','r','\0'};
static moo_ooch_t synerrstr_36[] = {'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_36[] = {'d','u','p','l','i','c','a','t','e',' ','m','o','d','i','f','i','e','r','\0'};
static moo_ooch_t synerrstr_37[] = {'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_37[] = {'w','r','o','n','g',' ','m','e','t','h','o','d',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_38[] = {'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_38[] = {'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_39[] = {'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_39[] = {'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_40[] = {'u','n','d','e','c','l','a','r','e','d',' ','v','a','r','i','a','b','l','e','\0'}; static moo_ooch_t synerrstr_40[] = {'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_41[] = {'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_41[] = {'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_42[] = {'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_42[] = {'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_43[] = {'a','m','b','i','g','u','o','u','s',' ','v','a','r','i','a','b','l','e','\0'}; static moo_ooch_t synerrstr_43[] = {'u','n','d','e','c','l','a','r','e','d',' ','v','a','r','i','a','b','l','e','\0'};
static moo_ooch_t synerrstr_44[] = {'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_44[] = {'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_45[] = {'t','o','o',' ','m','a','n','y',' ','t','e','m','p','o','r','a','r','i','e','s','\0'}; static moo_ooch_t synerrstr_45[] = {'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_46[] = {'t','o','o',' ','m','a','n','y',' ','a','r','g','u','m','e','n','t','s','\0'}; static moo_ooch_t synerrstr_46[] = {'a','m','b','i','g','u','o','u','s',' ','v','a','r','i','a','b','l','e','\0'};
static moo_ooch_t synerrstr_47[] = {'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_47[] = {'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_48[] = {'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_48[] = {'t','o','o',' ','m','a','n','y',' ','t','e','m','p','o','r','a','r','i','e','s','\0'};
static moo_ooch_t synerrstr_49[] = {'t','o','o',' ','l','a','r','g','e',' ','b','l','o','c','k','\0'}; static moo_ooch_t synerrstr_49[] = {'t','o','o',' ','m','a','n','y',' ','a','r','g','u','m','e','n','t','s','\0'};
static moo_ooch_t synerrstr_50[] = {'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_50[] = {'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_51[] = {'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_51[] = {'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_52[] = {'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_52[] = {'t','o','o',' ','l','a','r','g','e',' ','b','l','o','c','k','\0'};
static moo_ooch_t synerrstr_53[] = {'w','r','o','n','g',' ','m','o','d','u','l','e',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_53[] = {'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_54[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'}; static moo_ooch_t synerrstr_54[] = {'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_55[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_55[] = {'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_56[] = {'w','r','o','n','g',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_56[] = {'w','r','o','n','g',' ','m','o','d','u','l','e',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_57[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'}; static moo_ooch_t synerrstr_57[] = {'#','i','n','c','l','u','d','e',' ','e','r','r','o','r','\0'};
static moo_ooch_t synerrstr_58[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'}; static moo_ooch_t synerrstr_58[] = {'w','r','o','n','g',' ','n','a','m','e','s','p','a','c','e',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_59[] = {'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_59[] = {'w','r','o','n','g',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_60[] = {'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_60[] = {'d','u','p','l','i','c','a','t','e',' ','p','o','o','l',' ','d','i','c','t','i','o','n','a','r','y',' ','n','a','m','e','\0'};
static moo_ooch_t synerrstr_61[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'}; static moo_ooch_t synerrstr_61[] = {'l','i','t','e','r','a','l',' ','e','x','p','e','c','t','e','d','\0'};
static moo_ooch_t synerrstr_62[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n',' ','k','e','y','\0'}; static moo_ooch_t synerrstr_62[] = {'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_63[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n',' ','v','a','l','u','e','\0'}; static moo_ooch_t synerrstr_63[] = {'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_64[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n','\0'}; static moo_ooch_t synerrstr_64[] = {'w','h','i','l','e',' ','e','x','p','e','c','t','e','d','\0'};
static moo_ooch_t synerrstr_65[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n',' ','k','e','y','\0'};
static moo_ooch_t synerrstr_66[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n',' ','v','a','l','u','e','\0'};
static moo_ooch_t synerrstr_67[] = {'m','i','s','s','i','n','g',' ','a','s','s','o','c','i','a','t','i','o','n','\0'};
static moo_ooch_t* synerrstr[] = static moo_ooch_t* synerrstr[] =
{ {
synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7, synerrstr_0, synerrstr_1, synerrstr_2, synerrstr_3, synerrstr_4, synerrstr_5, synerrstr_6, synerrstr_7,
@ -143,11 +146,10 @@ static moo_ooch_t* synerrstr[] =
synerrstr_40, synerrstr_41, synerrstr_42, synerrstr_43, synerrstr_44, synerrstr_45, synerrstr_46, synerrstr_47, synerrstr_40, synerrstr_41, synerrstr_42, synerrstr_43, synerrstr_44, synerrstr_45, synerrstr_46, synerrstr_47,
synerrstr_48, synerrstr_49, synerrstr_50, synerrstr_51, synerrstr_52, synerrstr_53, synerrstr_54, synerrstr_55, 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_56, synerrstr_57, synerrstr_58, synerrstr_59, synerrstr_60, synerrstr_61, synerrstr_62, synerrstr_63,
synerrstr_64 synerrstr_64, synerrstr_65, synerrstr_66, synerrstr_67
}; };
#endif #endif
/* END: GENERATED WITH generr.st */ /* END: GENERATED WITH generr.moo */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
* ERROR NUMBER TO STRING CONVERSION * ERROR NUMBER TO STRING CONVERSION

View File

@ -478,7 +478,7 @@ struct moo_compiler_t
struct struct
{ {
moo_method_type_t type; moo_method_type_t type;
int native; int primitive; /* true if method(#primitive) */
/* method source text */ /* method source text */
moo_oocs_t text; moo_oocs_t text;

View File

@ -76,7 +76,7 @@ static void fill_bigint_tables (moo_t* moo)
} }
/* safe_ndigits contains the number of digits that never /* safe_ndigits contains the number of digits that never
* cause overflow when computed normally with a native type. */ * cause overflow when computed normally with a primitive type. */
moo->bigint[radix].safe_ndigits = safe_ndigits; moo->bigint[radix].safe_ndigits = safe_ndigits;
moo->bigint[radix].multiplier = multiplier; moo->bigint[radix].multiplier = multiplier;
} }
@ -605,7 +605,7 @@ moo_pfimpl_t moo_querymod (moo_t* moo, const moo_ooch_t* pfid, moo_oow_t pfidlen
if (!sep) if (!sep)
{ {
/* i'm writing a conservative code here. the compiler should /* i'm writing a conservative code here. the compiler should
* guarantee that a period is included in an primitive identifer. * guarantee that a period is included in an primitive function identifer.
* what if the compiler is broken? imagine a buggy compiler rewritten * what if the compiler is broken? imagine a buggy compiler rewritten
* in moo itself? */ * in moo itself? */
MOO_DEBUG2 (moo, "Internal error - no period in a primitive function identifier [%.*js] - buggy compiler?\n", pfidlen, pfid); MOO_DEBUG2 (moo, "Internal error - no period in a primitive function identifier [%.*js] - buggy compiler?\n", pfidlen, pfid);
@ -674,6 +674,7 @@ int moo_genpfmethod (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class, moo_met
arg_count++; arg_count++;
} }
} }
/* TODO: check if name is a valid method name - more checks... */ /* TODO: check if name is a valid method name - more checks... */
/* TOOD: if the method name is a binary selector, it can still have an argument.. so the check below is invalid... */ /* TOOD: if the method name is a binary selector, it can still have an argument.. so the check below is invalid... */
if (arg_count > 0 && mthname[i - 1] != ':') if (arg_count > 0 && mthname[i - 1] != ':')

View File

@ -1175,70 +1175,73 @@ typedef moo_ooi_t (*moo_ioimpl_t) (
enum moo_synerrnum_t enum moo_synerrnum_t
{ {
MOO_SYNERR_NOERR, MOO_SYNERR_NOERR,
MOO_SYNERR_ILCHR, /* illegal character */ MOO_SYNERR_ILCHR, /* illegal character */
MOO_SYNERR_CMTNC, /* comment not closed */ MOO_SYNERR_CMTNC, /* comment not closed */
MOO_SYNERR_STRNC, /* string not closed */ MOO_SYNERR_STRNC, /* string not closed */
MOO_SYNERR_CLTNT, /* character literal not terminated */ MOO_SYNERR_CLTNT, /* character literal not terminated */
MOO_SYNERR_HLTNT, /* hased literal not terminated */ MOO_SYNERR_HLTNT, /* hased literal not terminated */
MOO_SYNERR_CHARLIT, /* wrong character literal */ MOO_SYNERR_CHARLITINVAL, /* wrong character literal */
MOO_SYNERR_COLON, /* : expected */ MOO_SYNERR_COLON, /* : expected */
MOO_SYNERR_STRING, /* string expected */ MOO_SYNERR_STRING, /* string expected */
MOO_SYNERR_RADIX, /* invalid radix */ MOO_SYNERR_RADIXINVAL, /* invalid radix */
MOO_SYNERR_RADNUMLIT, /* invalid numeric literal with radix */ MOO_SYNERR_RADNUMLITINVAL, /* invalid numeric literal with radix */
MOO_SYNERR_BYTERANGE, /* byte too small or too large */ MOO_SYNERR_BYTERANGE, /* byte too small or too large */
MOO_SYNERR_ERRLIT, /* wrong error literal */ MOO_SYNERR_ERRLITINVAL, /* wrong error literal */
MOO_SYNERR_LBRACE, /* { expected */ MOO_SYNERR_LBRACE, /* { expected */
MOO_SYNERR_RBRACE, /* } expected */ MOO_SYNERR_RBRACE, /* } expected */
MOO_SYNERR_LPAREN, /* ( expected */ MOO_SYNERR_LPAREN, /* ( expected */
MOO_SYNERR_RPAREN, /* ) expected */ MOO_SYNERR_RPAREN, /* ) expected */
MOO_SYNERR_RBRACK, /* ] expected */ MOO_SYNERR_RBRACK, /* ] expected */
MOO_SYNERR_PERIOD, /* . expected */ MOO_SYNERR_PERIOD, /* . expected */
MOO_SYNERR_COMMA, /* , expected */ MOO_SYNERR_COMMA, /* , expected */
MOO_SYNERR_VBAR, /* | expected */ MOO_SYNERR_VBAR, /* | expected */
MOO_SYNERR_GT, /* > expected */ MOO_SYNERR_GT, /* > expected */
MOO_SYNERR_ASSIGN, /* := expected */ MOO_SYNERR_ASSIGN, /* := expected */
MOO_SYNERR_IDENT, /* identifier expected */ MOO_SYNERR_IDENT, /* identifier expected */
MOO_SYNERR_INTEGER, /* integer expected */ MOO_SYNERR_INTEGER, /* integer expected */
MOO_SYNERR_PRIMITIVE, /* primitive: expected */ MOO_SYNERR_PRIMITIVE, /* primitive: expected */
MOO_SYNERR_DIRECTIVE, /* wrong directive */ MOO_SYNERR_DIRECTIVEINVAL, /* wrong directive */
MOO_SYNERR_CLASSUNDEF, /* undefined class */ MOO_SYNERR_CLASSUNDEF, /* undefined class */
MOO_SYNERR_CLASSDUP, /* duplicate class */ MOO_SYNERR_CLASSDUPL, /* duplicate class */
MOO_SYNERR_CLASSCONTRA, /* contradictory class */ MOO_SYNERR_CLASSCONTRA, /* contradictory class */
MOO_SYNERR_CLASSNAME, /* wrong class name */ MOO_SYNERR_CLASSNAMEINVAL, /* wrong class name */
MOO_SYNERR_CLASSTRSIZE, /* non-pointer class inheriting a superclass with trailer size set */ MOO_SYNERR_CLASSTRSIZE, /* non-pointer class inheriting a superclass with trailer size set */
MOO_SYNERR_DCLBANNED, /* #dcl not allowed */ MOO_SYNERR_DCLBANNED, /* #dcl not allowed */
MOO_SYNERR_NATIVEBANNED, /* #native not allowed */ MOO_SYNERR_MODIFIER, /* modifier expected */
MOO_SYNERR_MTHNAME, /* wrong method name */ MOO_SYNERR_MODIFIERINVAL, /* wrong modifier */
MOO_SYNERR_MTHNAMEDUP, /* duplicate method name */ MOO_SYNERR_MODIFIERBANNED, /* modifier not allowed */
MOO_SYNERR_ARGNAMEDUP, /* duplicate argument name */ MOO_SYNERR_MODIFIERDUPL, /* duplicate modifier */
MOO_SYNERR_TMPRNAMEDUP, /* duplicate temporary variable name */ MOO_SYNERR_MTHNAME, /* wrong method name */
MOO_SYNERR_VARNAMEDUP, /* duplicate variable name */ MOO_SYNERR_MTHNAMEDUPL, /* duplicate method name */
MOO_SYNERR_BLKARGNAMEDUP, /* duplicate block argument name */ MOO_SYNERR_ARGNAMEDUPL, /* duplicate argument name */
MOO_SYNERR_VARUNDCL, /* undeclared variable */ MOO_SYNERR_TMPRNAMEDUPL, /* duplicate temporary variable name */
MOO_SYNERR_VARUNUSE, /* unsuable variable in compiled code */ MOO_SYNERR_VARNAMEDUPL, /* duplicate variable name */
MOO_SYNERR_VARINACC, /* inaccessible variable - e.g. accessing an instance variable from a class method is not allowed. */ MOO_SYNERR_BLKARGNAMEDUPL, /* duplicate block argument name */
MOO_SYNERR_VARAMBIG, /* ambiguious variable - e.g. the variable is found in multiple pool dictionaries imported */ MOO_SYNERR_VARUNDCL, /* undeclared variable */
MOO_SYNERR_PRIMARY, /* wrong expression primary */ MOO_SYNERR_VARUNUSE, /* unsuable variable in compiled code */
MOO_SYNERR_TMPRFLOOD, /* too many temporaries */ MOO_SYNERR_VARINACC, /* inaccessible variable - e.g. accessing an instance variable from a class method is not allowed. */
MOO_SYNERR_ARGFLOOD, /* too many arguments */ MOO_SYNERR_VARAMBIG, /* ambiguious variable - e.g. the variable is found in multiple pool dictionaries imported */
MOO_SYNERR_BLKTMPRFLOOD, /* too many block temporaries */ MOO_SYNERR_PRIMARYINVAL, /* wrong expression primary */
MOO_SYNERR_BLKARGFLOOD, /* too many block arguments */ MOO_SYNERR_TMPRFLOOD, /* too many temporaries */
MOO_SYNERR_BLKFLOOD, /* too large block */ MOO_SYNERR_ARGFLOOD, /* too many arguments */
MOO_SYNERR_ARREXPFLOOD, /* too large array expression */ MOO_SYNERR_BLKTMPRFLOOD, /* too many block temporaries */
MOO_SYNERR_PFNUM, /* wrong primitive number */ MOO_SYNERR_BLKARGFLOOD, /* too many block arguments */
MOO_SYNERR_PFID, /* wrong primitive identifier */ MOO_SYNERR_BLKFLOOD, /* too large block */
MOO_SYNERR_MODNAME, /* wrong module name */ MOO_SYNERR_ARREXPFLOOD, /* too large array expression */
MOO_SYNERR_INCLUDE, /* #include error */ MOO_SYNERR_PFNUMINVAL, /* wrong primitive number */
MOO_SYNERR_NAMESPACE, /* wrong namespace name */ MOO_SYNERR_PFIDINVAL, /* wrong primitive identifier */
MOO_SYNERR_POOLDIC, /* wrong pool dictionary */ MOO_SYNERR_MODNAMEINVAL, /* wrong module name */
MOO_SYNERR_POOLDICDUP, /* duplicate pool dictionary */ MOO_SYNERR_INCLUDE, /* #include error */
MOO_SYNERR_LITERAL, /* literal expected */ MOO_SYNERR_NAMESPACEINVAL, /* wrong namespace name */
MOO_SYNERR_NOTINLOOP, /* break or continue not within a loop */ MOO_SYNERR_POOLDICINVAL, /* wrong pool dictionary */
MOO_SYNERR_INBLOCK, /* break or continue within a block */ MOO_SYNERR_POOLDICDUPL, /* duplicate pool dictionary */
MOO_SYNERR_WHILE, /* while expected */ MOO_SYNERR_LITERAL, /* literal expected */
MOO_SYNERR_NOASSKEY, /* missing association key */ MOO_SYNERR_NOTINLOOP, /* break or continue not within a loop */
MOO_SYNERR_NOASSVALUE, /* missing association value */ MOO_SYNERR_INBLOCK, /* break or continue within a block */
MOO_SYNERR_NOASSOC /* missing association */ MOO_SYNERR_WHILE, /* while expected */
MOO_SYNERR_NOASSKEY, /* missing association key */
MOO_SYNERR_NOASSVALUE, /* missing association value */
MOO_SYNERR_NOASSOC /* missing association */
}; };
typedef enum moo_synerrnum_t moo_synerrnum_t; typedef enum moo_synerrnum_t moo_synerrnum_t;