mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Added support for comments
This commit is contained in:
parent
07cd150677
commit
6a9adafa8d
1 changed files with 12 additions and 2 deletions
|
@ -17,9 +17,14 @@ BOOL isspace (string x)
|
|||
return (x == " " || x == "\t" || x == "\n" || x == "\r");
|
||||
}
|
||||
|
||||
BOOL isjunk (string x)
|
||||
{
|
||||
return isspace (x) || x == ";";
|
||||
}
|
||||
|
||||
BOOL issymbol (string x)
|
||||
{
|
||||
return (x != "" && x != "(" && x !=")" && !isspace (x));
|
||||
return (x != "" && x != "(" && x !=")" && !isjunk (x));
|
||||
}
|
||||
|
||||
@implementation Lexer
|
||||
|
@ -47,7 +52,12 @@ BOOL issymbol (string x)
|
|||
local String str;
|
||||
local Boolean bl;
|
||||
|
||||
for (len = 0; isspace(str_mid(source, len, len+1)); len++) {
|
||||
for (len = 0; isjunk(str_mid(source, len, len+1)); len++) {
|
||||
if (str_mid(source, len, len+1) == ";") {
|
||||
while (str_mid(source, len, len+1) != "\n") {
|
||||
len++;
|
||||
}
|
||||
}
|
||||
if (str_mid(source, len, len+1) == "\n") {
|
||||
linenum++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue