mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-21 18:30:52 +00:00
Lexer: [[ and ]] are now TOKEN_ATTRIBUTE_{OPEN,CLOSE}
This commit is contained in:
parent
949cd9bb06
commit
26a80e0868
2 changed files with 21 additions and 1 deletions
19
lexer.c
19
lexer.c
|
@ -1117,6 +1117,14 @@ int lex_do(lex_file *lex)
|
|||
switch (ch)
|
||||
{
|
||||
case '[':
|
||||
nextch = lex_getch(lex);
|
||||
if (nextch == '[') {
|
||||
lex_tokench(lex, nextch);
|
||||
lex_endtoken(lex);
|
||||
return (lex->tok.ttype = TOKEN_ATTRIBUTE_OPEN);
|
||||
}
|
||||
lex_ungetch(lex, nextch);
|
||||
/* FALL THROUGH */
|
||||
case '(':
|
||||
case ':':
|
||||
case '?':
|
||||
|
@ -1126,11 +1134,20 @@ int lex_do(lex_file *lex)
|
|||
return (lex->tok.ttype = ch);
|
||||
else
|
||||
return (lex->tok.ttype = TOKEN_OPERATOR);
|
||||
|
||||
case ']':
|
||||
nextch = lex_getch(lex);
|
||||
if (nextch == ']') {
|
||||
lex_tokench(lex, nextch);
|
||||
lex_endtoken(lex);
|
||||
return (lex->tok.ttype = TOKEN_ATTRIBUTE_CLOSE);
|
||||
}
|
||||
lex_ungetch(lex, nextch);
|
||||
/* FALL THROUGH */
|
||||
case ')':
|
||||
case ';':
|
||||
case '{':
|
||||
case '}':
|
||||
case ']':
|
||||
|
||||
case '#':
|
||||
lex_tokench(lex, ch);
|
||||
|
|
3
lexer.h
3
lexer.h
|
@ -73,6 +73,9 @@ enum {
|
|||
|
||||
TOKEN_DOTS, /* 3 dots, ... */
|
||||
|
||||
TOKEN_ATTRIBUTE_OPEN, /* [[ */
|
||||
TOKEN_ATTRIBUTE_CLOSE, /* ]] */
|
||||
|
||||
TOKEN_STRINGCONST, /* not the typename but an actual "string" */
|
||||
TOKEN_CHARCONST,
|
||||
TOKEN_VECTORCONST,
|
||||
|
|
Loading…
Reference in a new issue