The parser handles correctly the ERROR keyword again.

[COMPILER]
* BUG: The parser handles correctly the ERROR keyword again.
This commit is contained in:
Benoît Minisini 2022-12-05 13:32:39 +01:00
parent bff79700f3
commit 39bf786af9
3 changed files with 8 additions and 3 deletions

View file

@ -84,7 +84,8 @@ enum {
RSJ_READ,
RSJ_DATATYPE,
RSJ_OPTIONAL,
RSJ_BYREF
RSJ_BYREF,
RSJ_ERROR
};
#define RES_is_operator(value) (COMP_res_info[value].flag & RSF_OP)

View file

@ -105,7 +105,7 @@ COMP_INFO COMP_res_info[] =
{ "Stop" },
{ "Quit" },
{ "Raise", RSF_IDENT|RSF_EVENT },
{ "Error" },
{ "Error", 0, 0, RSJ_ERROR },
{ "Super", 0, 0, RSJ_ME },
{ "Enum", 0, 0, RSJ_CONST },
{ "Let" },

View file

@ -318,7 +318,7 @@ static void add_identifier()
{
static void *jump[] = {
&&__OTHERS, &&__ME_NEW_LAST_SUPER, &&__CLASS, &&__STRUCT, &&__SUB_PROCEDURE_FUNCTION, &&__CONST_EXTERN_ENUM, &&__READ,
&&__DATATYPE, &&__OPTIONAL, &&__BYREF
&&__DATATYPE, &&__OPTIONAL, &&__BYREF, &&__ERROR
};
last_next_ident = (flag & RSF_IDENT) != 0;
@ -379,6 +379,10 @@ static void add_identifier()
can_be_reserved = FALSE;
break;
__ERROR:
can_be_reserved = canres_car[car] && !last_next_ident;
break;
__OTHERS:
if (!canres_car[car])
can_be_reserved = FALSE;