diff --git a/source/compiler/sc.h b/source/compiler/sc.h index 664ca3c..234c11b 100644 --- a/source/compiler/sc.h +++ b/source/compiler/sc.h @@ -402,8 +402,13 @@ typedef struct s_valuepair { #define tSYMBOL 336 #define tLABEL 337 #define tSTRING 338 -#define tEXPR 339 /* for assigment to "lastst" only (see SC1.C) */ -#define tENDLESS 340 /* endless loop, for assigment to "lastst" only */ +/* argument types for emit/__emit */ +#define teNUMBER 339 /* integer/rational number */ +#define teDATA 340 /* data (variable name or address) */ +#define teLOCAL 341 /* local variable (name or offset) */ +/* for assigment to "lastst" only (see SC1.C) */ +#define tEXPR 342 +#define tENDLESS 343 /* endless loop */ /* (reversed) evaluation of staging buffer */ #define sSTARTREORDER 0x01 diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index a641e44..366fe3d 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -5828,16 +5828,18 @@ static void dolabel(void) sym->usage|=uDEFINE; /* label is now defined */ } -static void emit_invalid_token(int need_token,int current_token) +static void emit_invalid_token(int expected_token,int found_token) { - char s[sNAMEMAX+2]; + char s[2]; extern char *sc_tokens[]; - if (current_token=tFIRST); + if (found_tokenvclass!=sSTATIC && sym->ident!=iCONSTEXPR) { - error(17,str); /* undefined symbol */ + emit_invalid_token(teDATA,teLOCAL); break; } } else { @@ -5922,7 +5924,7 @@ static void emit_param_data(ucell *p,int size) p[curp]=sym->addr; break; default: - emit_invalid_token(tSYMBOL,tok); + emit_invalid_token(teDATA,tok); } /* switch */ } while (++curpvclass==sSTATIC) { + emit_invalid_token(teLOCAL,teDATA); + break; + } /* if */ + } else { sym=findglb(str,sSTATEVAR); - if (sym==NULL || sym->ident!=iCONSTEXPR) + if (sym==NULL || sym->ident!=iCONSTEXPR) { error(17,str); /* undefined symbol */ - } else if (sym->vclass==sSTATIC) { - error(17,str); /* undefined symbol */ - break; + break; + } /* if */ } /* if */ markusage(sym,uREAD|uWRITTEN); p[curp]=sym->addr; diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 38e5f6f..b693eaa 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -2096,7 +2096,8 @@ char *sc_tokens[] = { "#endscript", "#error", "#file", "#if", "#include", "#line", "#pragma", "#tryinclude", "#undef", "#warning", ";", ";", "-integer value-", "-rational value-", "-identifier-", - "-label-", "-string-" + "-label-", "-string-", + "-numeric value-", "-data offset-", "-local variable-" }; SC_FUNC int lex(cell *lexvalue,char **lexsym)