identifiers may not contain two consecutive underscores, and a fix
This commit is contained in:
parent
92f28ae164
commit
702a73b734
1 changed files with 4 additions and 1 deletions
|
@ -348,6 +348,9 @@ again:
|
||||||
register t_idf *id;
|
register t_idf *id;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
if (ch == '_' && *tag == '_') {
|
||||||
|
lexerror("an identifier may not contain two consecutive underscores");
|
||||||
|
}
|
||||||
if (tag - buf < idfsize) *tag++ = ch;
|
if (tag - buf < idfsize) *tag++ = ch;
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
} while(in_idf(ch));
|
} while(in_idf(ch));
|
||||||
|
@ -356,7 +359,7 @@ again:
|
||||||
else PushBack();
|
else PushBack();
|
||||||
*tag = '\0';
|
*tag = '\0';
|
||||||
if (*(tag - 1) == '_') {
|
if (*(tag - 1) == '_') {
|
||||||
lexerror("last character of an identifier may not be a '_'");
|
lexerror("last character of an identifier may not be an underscore");
|
||||||
}
|
}
|
||||||
|
|
||||||
tk->TOK_IDF = id = str2idf(buf, 1);
|
tk->TOK_IDF = id = str2idf(buf, 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue