fixed a constness-issue

actorid
Marc Zinnschlag 10 years ago
parent 910d62e4b8
commit d213c6c36a

@ -154,7 +154,7 @@ namespace Compiler
}
}
ControlParser::ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
ControlParser::ControlParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals),
mLineParser (errorHandler, context, locals, literals, mCodeBlock),

@ -47,7 +47,7 @@ namespace Compiler
public:
ControlParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
ControlParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals);
void appendCode (std::vector<Interpreter::Type_Code>& code) const;

@ -8,7 +8,7 @@
#include "skipparser.hpp"
#include "locals.hpp"
Compiler::DeclarationParser::DeclarationParser (ErrorHandler& errorHandler, Context& context,
Compiler::DeclarationParser::DeclarationParser (ErrorHandler& errorHandler, const Context& context,
Locals& locals)
: Parser (errorHandler, context), mLocals (locals), mState (State_Begin), mType (0)
{}

@ -20,7 +20,7 @@ namespace Compiler
public:
DeclarationParser (ErrorHandler& errorHandler, Context& context, Locals& locals);
DeclarationParser (ErrorHandler& errorHandler, const Context& context, Locals& locals);
virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner);

@ -219,7 +219,7 @@ namespace Compiler
return false;
}
ExprParser::ExprParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
ExprParser::ExprParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals, bool argument)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals),
mNextOperand (true), mFirst (true), mArgument (argument), mRefOp (false), mMemberOp (false)

@ -58,7 +58,7 @@ namespace Compiler
public:
ExprParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
ExprParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals, bool argument = false);
///< constructor
/// \param argument Parser is used to parse function- or instruction-

@ -50,7 +50,7 @@ namespace Compiler
}
}
LineParser::LineParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
LineParser::LineParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
mState (BeginState), mExprParser (errorHandler, context, locals, literals),

@ -44,7 +44,7 @@ namespace Compiler
public:
LineParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
LineParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals, std::vector<Interpreter::Type_Code>& code,
bool allowExpression = false);
///< \param allowExpression Allow lines consisting of a naked expression

@ -52,7 +52,7 @@ namespace Compiler
// Return context
Context& Parser::getContext()
const Context& Parser::getContext() const
{
return mContext;
}
@ -64,7 +64,7 @@ namespace Compiler
return lowerCase;
}
Parser::Parser (ErrorHandler& errorHandler, Context& context)
Parser::Parser (ErrorHandler& errorHandler, const Context& context)
: mErrorHandler (errorHandler), mContext (context), mOptional (false), mEmpty (true)
{}

@ -17,7 +17,7 @@ namespace Compiler
class Parser
{
ErrorHandler& mErrorHandler;
Context& mContext;
const Context& mContext;
bool mOptional;
bool mEmpty;
@ -38,14 +38,14 @@ namespace Compiler
ErrorHandler& getErrorHandler();
///< Return error handler
Context& getContext();
const Context& getContext() const;
///< Return context
static std::string toLower (const std::string& name);
public:
Parser (ErrorHandler& errorHandler, Context& context);
Parser (ErrorHandler& errorHandler, const Context& context);
///< constructor
virtual ~Parser();

@ -4,7 +4,7 @@
#include "skipparser.hpp"
#include "scanner.hpp"
Compiler::QuickFileParser::QuickFileParser (ErrorHandler& errorHandler, Context& context,
Compiler::QuickFileParser::QuickFileParser (ErrorHandler& errorHandler, const Context& context,
Locals& locals)
: Parser (errorHandler, context), mDeclarationParser (errorHandler, context, locals)
{}

@ -15,7 +15,7 @@ namespace Compiler
public:
QuickFileParser (ErrorHandler& errorHandler, Context& context, Locals& locals);
QuickFileParser (ErrorHandler& errorHandler, const Context& context, Locals& locals);
virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner);

@ -7,7 +7,7 @@
namespace Compiler
{
ScriptParser::ScriptParser (ErrorHandler& errorHandler, Context& context,
ScriptParser::ScriptParser (ErrorHandler& errorHandler, const Context& context,
Locals& locals, bool end)
: Parser (errorHandler, context), mOutput (locals),
mLineParser (errorHandler, context, locals, mOutput.getLiterals(), mOutput.getCode()),

@ -12,7 +12,7 @@ namespace Compiler
class Locals;
// Script parser, to be used in dialogue scripts and as part of FileParser
class ScriptParser : public Parser
{
Output mOutput;
@ -21,14 +21,14 @@ namespace Compiler
bool mEnd;
public:
/// \param end of script is marked by end keyword.
ScriptParser (ErrorHandler& errorHandler, Context& context, Locals& locals,
ScriptParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
bool end = false);
void getCode (std::vector<Interpreter::Type_Code>& code) const;
///< store generated code in \æ code.
virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner);
///< Handle a name token.
@ -43,8 +43,8 @@ namespace Compiler
/// \return fetch another token?
virtual void parseEOF (Scanner& scanner);
///< Handle EOF token.
///< Handle EOF token.
void reset();
///< Reset parser to clean state.
};

@ -5,7 +5,7 @@
namespace Compiler
{
SkipParser::SkipParser (ErrorHandler& errorHandler, Context& context)
SkipParser::SkipParser (ErrorHandler& errorHandler, const Context& context)
: Parser (errorHandler, context)
{}
@ -34,7 +34,7 @@ namespace Compiler
{
if (code==Scanner::S_newline)
return false;
return true;
}
}

@ -8,13 +8,13 @@ namespace Compiler
// \brief Skip parser for skipping a line
//
// This parser is mainly intended for skipping the rest of a faulty line.
class SkipParser : public Parser
{
public:
SkipParser (ErrorHandler& errorHandler, Context& context);
SkipParser (ErrorHandler& errorHandler, const Context& context);
virtual bool parseInt (int value, const TokenLoc& loc, Scanner& scanner);
///< Handle an int token.
/// \return fetch another token?

@ -10,7 +10,7 @@
namespace Compiler
{
StringParser::StringParser (ErrorHandler& errorHandler, Context& context, Literals& literals)
StringParser::StringParser (ErrorHandler& errorHandler, const Context& context, Literals& literals)
: Parser (errorHandler, context), mLiterals (literals), mState (StartState), mSmashCase (false)
{

@ -10,22 +10,22 @@
namespace Compiler
{
class Literals;
class StringParser : public Parser
{
enum State
{
StartState, CommaState
};
Literals& mLiterals;
State mState;
std::vector<Interpreter::Type_Code> mCode;
bool mSmashCase;
public:
StringParser (ErrorHandler& errorHandler, Context& context, Literals& literals);
StringParser (ErrorHandler& errorHandler, const Context& context, Literals& literals);
virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner);
@ -35,15 +35,15 @@ namespace Compiler
virtual bool parseSpecial (int code, const TokenLoc& loc, Scanner& scanner);
///< Handle a special character token.
/// \return fetch another token?
void append (std::vector<Interpreter::Type_Code>& code);
///< Append code for parsed string.
void smashCase();
///< Transform all scanned strings to lower case
void reset();
///< Reset parser to clean state (this includes the smashCase function).
///< Reset parser to clean state (this includes the smashCase function).
};
}

Loading…
Cancel
Save