Make "%>" a keyword for syntax analyze of gambas code embedded into a WebPage. Some other fixes in the interpreter and the compiler.

[INTERPRETER]
* BUG: A global class find does now a global class lookup. It seems more logical.
* BUG: When loading a class fails, display an accurate error message.

[COMPILER]
* BUG: Embedded arrays do not raise warnings on being uninitialized anymore.
* NEW: Make "%>" a keyword for syntax analyze of gambas code embedded into a WebPage.
This commit is contained in:
Benoît Minisini 2023-10-24 04:29:01 +02:00
parent 72417abe78
commit ac0f2ba85e
5 changed files with 18 additions and 2 deletions

View file

@ -731,7 +731,16 @@ void CLASS_init_global_declaration(CLASS *class, TRANS_DECL *decl, CLASS_SYMBOL
bool is_static; bool is_static;
if (!TRANS_has_init_var(decl)) if (!TRANS_has_init_var(decl))
{
if (decl->is_embedded)
{
if (sym->local.value)
sym->local_assigned = TRUE;
else
sym->global_assigned = TRUE;
}
return; return;
}
is_static = TYPE_is_static(decl->type); is_static = TYPE_is_static(decl->type);
prev_func = CLASS_set_current_init_function(class, is_static ? FUNC_INIT_STATIC : FUNC_INIT_DYNAMIC); prev_func = CLASS_set_current_init_function(class, is_static ? FUNC_INIT_STATIC : FUNC_INIT_DYNAMIC);

View file

@ -518,9 +518,14 @@ CLASS *CLASS_find_do(const char *name, bool global)
fprintf(stderr, "CLASS_find: %s (%d)\n", name, global); fprintf(stderr, "CLASS_find: %s (%d)\n", name, global);
#endif #endif
class = CLASS_look(name, len); class = CLASS_look_do(name, len, global);
if (class) if (class)
{
#if DEBUG_LOAD
fprintf(stderr, "--> %p\n", class);
#endif
return class; return class;
}
//if (CP && CP->component && CP->component->archive) //if (CP && CP->component && CP->component->archive)
if (!global && !ARCHIVE_get_current(&arch)) if (!global && !ARCHIVE_get_current(&arch))

View file

@ -1047,7 +1047,7 @@ static void load_without_inits(CLASS *class)
CATCH CATCH
{ {
COMPONENT_current = save; COMPONENT_current = save;
THROW_CLASS(class, ERROR_last.msg, ""); THROW_CLASS(class, ERROR_current->info.msg, "");
} }
END_TRY END_TRY
} }

View file

@ -225,6 +225,7 @@ COMP_INFO COMP_res_info[] =
{ "&=", RSF_ASGN, RS_AMP }, { "&=", RSF_ASGN, RS_AMP },
{ "&/=", RSF_ASGN, RS_FILE }, { "&/=", RSF_ASGN, RS_FILE },
{ "^=", RSF_ASGN, RS_FLEX }, { "^=", RSF_ASGN, RS_FLEX },
{ "%>" }, // Webpage delimiter
{ NULL } { NULL }
}; };

View file

@ -184,6 +184,7 @@ __24:
return -1; return -1;
__25: __25:
if (len == 2 && word[1] == '=') return 190; if (len == 2 && word[1] == '=') return 190;
if (len == 2 && word[1] == '>') return 194;
return -1; return -1;
__26: __26:
if (len == 2 && word[1] == '/') return 151; if (len == 2 && word[1] == '/') return 151;