mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
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:
parent
4b3bfc6424
commit
8974228a20
1 changed files with 8 additions and 1 deletions
|
@ -1423,6 +1423,12 @@ static int32_t isaltok(const char c)
|
||||||
c == '*' || c == '-' || c == '_' || 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)
|
static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz)
|
||||||
{
|
{
|
||||||
// find the label psz in the table pLabel.
|
// find the label psz in the table pLabel.
|
||||||
|
@ -1446,7 +1452,8 @@ static void C_GetNextLabelName(void)
|
||||||
|
|
||||||
C_SkipComments();
|
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++)] = *(textptr++);
|
||||||
label[(g_numLabels<<6)+i] = 0;
|
label[(g_numLabels<<6)+i] = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue