1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 00:32:49 +00:00
OpenMW/components/compiler/junkparser.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

#include "junkparser.hpp"
#include "scanner.hpp"
2022-09-22 21:26:05 +03:00
Compiler::JunkParser::JunkParser(ErrorHandler& errorHandler, const Context& context, int ignoreKeyword)
: Parser(errorHandler, context)
, mIgnoreKeyword(ignoreKeyword)
{
}
2022-09-22 21:26:05 +03:00
bool Compiler::JunkParser::parseInt(int value, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 21:26:05 +03:00
scanner.putbackInt(value, loc);
return false;
}
2022-09-22 21:26:05 +03:00
bool Compiler::JunkParser::parseFloat(float value, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 21:26:05 +03:00
scanner.putbackFloat(value, loc);
return false;
}
2022-09-22 21:26:05 +03:00
bool Compiler::JunkParser::parseName(const std::string& name, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 21:26:05 +03:00
scanner.putbackName(name, loc);
return false;
}
2022-09-22 21:26:05 +03:00
bool Compiler::JunkParser::parseKeyword(int keyword, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 21:26:05 +03:00
if (keyword == mIgnoreKeyword)
reportWarning("Ignoring found junk", loc);
else
2022-09-22 21:26:05 +03:00
scanner.putbackKeyword(keyword, loc);
return false;
}
2022-09-22 21:26:05 +03:00
bool Compiler::JunkParser::parseSpecial(int code, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 21:26:05 +03:00
if (code == Scanner::S_member)
reportWarning("Ignoring found junk", loc);
else
2022-09-22 21:26:05 +03:00
scanner.putbackSpecial(code, loc);
return false;
}