forked from teamnwah/openmw-tes3coop
instead of using pre-compiled variable lists for remote member access get the variable list from the remote script on the fly
parent
e76ef92669
commit
451e1f413b
@ -0,0 +1,52 @@
|
||||
|
||||
#include "quickfileparser.hpp"
|
||||
|
||||
#include "skipparser.hpp"
|
||||
#include "scanner.hpp"
|
||||
|
||||
Compiler::QuickFileParser::QuickFileParser (ErrorHandler& errorHandler, Context& context,
|
||||
Locals& locals)
|
||||
: Parser (errorHandler, context), mDeclarationParser (errorHandler, context, locals)
|
||||
{}
|
||||
|
||||
bool Compiler::QuickFileParser::parseName (const std::string& name, const TokenLoc& loc,
|
||||
Scanner& scanner)
|
||||
{
|
||||
SkipParser skip (getErrorHandler(), getContext());
|
||||
scanner.scan (skip);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Compiler::QuickFileParser::parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (keyword==Scanner::K_end)
|
||||
return false;
|
||||
|
||||
if (keyword==Scanner::K_short || keyword==Scanner::K_long || keyword==Scanner::K_float)
|
||||
{
|
||||
mDeclarationParser.reset();
|
||||
scanner.putbackKeyword (keyword, loc);
|
||||
scanner.scan (mDeclarationParser);
|
||||
return true;
|
||||
}
|
||||
|
||||
SkipParser skip (getErrorHandler(), getContext());
|
||||
scanner.scan (skip);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Compiler::QuickFileParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner)
|
||||
{
|
||||
if (code!=Scanner::S_newline)
|
||||
{
|
||||
SkipParser skip (getErrorHandler(), getContext());
|
||||
scanner.scan (skip);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Compiler::QuickFileParser::parseEOF (Scanner& scanner)
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
#ifndef COMPILER_QUICKFILEPARSER_H_INCLUDED
|
||||
#define COMPILER_QUICKFILEPARSER_H_INCLUDED
|
||||
|
||||
#include "parser.hpp"
|
||||
#include "declarationparser.hpp"
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Locals;
|
||||
|
||||
/// \brief File parser variant that ignores everything but variable declarations
|
||||
class QuickFileParser : public Parser
|
||||
{
|
||||
DeclarationParser mDeclarationParser;
|
||||
|
||||
public:
|
||||
|
||||
QuickFileParser (ErrorHandler& errorHandler, Context& context, Locals& locals);
|
||||
|
||||
virtual bool parseName (const std::string& name, const TokenLoc& loc,
|
||||
Scanner& scanner);
|
||||
///< Handle a name token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner);
|
||||
///< Handle a keyword token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual bool parseSpecial (int code, const TokenLoc& loc, Scanner& scanner);
|
||||
///< Handle a special character token.
|
||||
/// \return fetch another token?
|
||||
|
||||
virtual void parseEOF (Scanner& scanner);
|
||||
///< Handle EOF token.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue