1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/components/compiler/quickfileparser.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.3 KiB
C++
Raw Normal View History

#include "quickfileparser.hpp"
#include "scanner.hpp"
2022-09-22 18:26:05 +00:00
#include "skipparser.hpp"
2022-09-22 18:26:05 +00:00
Compiler::QuickFileParser::QuickFileParser(ErrorHandler& errorHandler, const Context& context, Locals& locals)
: Parser(errorHandler, context)
, mDeclarationParser(errorHandler, context, locals)
{
}
2022-09-22 18:26:05 +00:00
bool Compiler::QuickFileParser::parseName(const std::string& name, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 18:26:05 +00:00
SkipParser skip(getErrorHandler(), getContext());
scanner.scan(skip);
return true;
}
2022-09-22 18:26:05 +00:00
bool Compiler::QuickFileParser::parseKeyword(int keyword, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 18:26:05 +00:00
if (keyword == Scanner::K_end)
return false;
2022-09-22 18:26:05 +00:00
if (keyword == Scanner::K_short || keyword == Scanner::K_long || keyword == Scanner::K_float)
{
mDeclarationParser.reset();
2022-09-22 18:26:05 +00:00
scanner.putbackKeyword(keyword, loc);
scanner.scan(mDeclarationParser);
return true;
}
2022-09-22 18:26:05 +00:00
SkipParser skip(getErrorHandler(), getContext());
scanner.scan(skip);
return true;
}
2022-09-22 18:26:05 +00:00
bool Compiler::QuickFileParser::parseSpecial(int code, const TokenLoc& loc, Scanner& scanner)
{
2022-09-22 18:26:05 +00:00
if (code != Scanner::S_newline)
{
2022-09-22 18:26:05 +00:00
SkipParser skip(getErrorHandler(), getContext());
scanner.scan(skip);
}
return true;
}
2022-09-22 18:26:05 +00:00
void Compiler::QuickFileParser::parseEOF(Scanner& scanner) {}