feat: skip newlines

This commit is contained in:
3lswear
2022-02-12 02:13:00 +03:00
parent 783b4061c0
commit 3f3d25d9c7

View File

@@ -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);
} }