mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 05:17:59 +03:00
feat: skip newlines
This commit is contained in:
@@ -134,26 +134,16 @@ namespace config
|
|||||||
{
|
{
|
||||||
token.type = NEWLINE;
|
token.type = NEWLINE;
|
||||||
|
|
||||||
std::streampos prev_pos;
|
do
|
||||||
file.get(c);
|
file.get(c);
|
||||||
if (c != '\n')
|
while (c == '\n' && !file.eof());
|
||||||
{
|
if (file.eof())
|
||||||
file.seekg(-1, std::ios_base::cur);
|
|
||||||
}
|
|
||||||
else if (file.eof())
|
|
||||||
{
|
{
|
||||||
file.clear();
|
file.clear();
|
||||||
DBOUT << "cleared" <<ENDL;
|
DBOUT << "cleared" <<ENDL;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
{
|
file.seekg(-1, std::ios_base::cur);
|
||||||
DBOUT << "no" <<ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// while (c == '\n')
|
|
||||||
// file.get(c);
|
|
||||||
// if (c != '\n')
|
|
||||||
// file.seekg(-1, std::ios_base::cur);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (c == '-' || isdigit(c))
|
else if (c == '-' || isdigit(c))
|
||||||
@@ -207,6 +197,8 @@ namespace config
|
|||||||
}
|
}
|
||||||
else if (c == ',')
|
else if (c == ',')
|
||||||
token.type = COMMA;
|
token.type = COMMA;
|
||||||
|
else if (c == '#')
|
||||||
|
token.type = COMMENT;
|
||||||
last_token = token.type;
|
last_token = token.type;
|
||||||
return (token);
|
return (token);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user