C-CON: scan label names according to stricter LunaCON rules instead of char blacklist.

These ones: http://lunatic.eduke32.com/lunacon.html#_ambiguous_lexical_elements
Seriously, defining a token kind by excluding certain characters (instead of
allowing a given set) is really, really broken.

git-svn-id: https://svn.eduke32.com/eduke32@4474 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-05-18 09:55:41 +00:00
parent 4b3bfc6424
commit 8974228a20
1 changed files with 8 additions and 1 deletions

View File

@ -1423,6 +1423,12 @@ static int32_t isaltok(const char c)
c == '*' || c == '-' || c == '_' || c == '.');
}
static int32_t C_IsLabelChar(const char c, int32_t i)
{
return (isalnum(c) || c=='_' || c=='*' || c=='?' ||
(i > 0 && (c=='+' || c=='-' || c=='.')));
}
static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz)
{
// find the label psz in the table pLabel.
@ -1446,7 +1452,8 @@ static void C_GetNextLabelName(void)
C_SkipComments();
while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r')
// while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r')
while (C_IsLabelChar(*textptr, i))
label[(g_numLabels<<6)+(i++)] = *(textptr++);
label[(g_numLabels<<6)+i] = 0;