fixed a constness-issue

actorid
Marc Zinnschlag 11 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) Literals& literals)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), : Parser (errorHandler, context), mLocals (locals), mLiterals (literals),
mLineParser (errorHandler, context, locals, literals, mCodeBlock), mLineParser (errorHandler, context, locals, literals, mCodeBlock),

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

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

@ -20,7 +20,7 @@ namespace Compiler
public: 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, virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner); Scanner& scanner);

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

@ -58,7 +58,7 @@ namespace Compiler
public: public:
ExprParser (ErrorHandler& errorHandler, Context& context, Locals& locals, ExprParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
Literals& literals, bool argument = false); Literals& literals, bool argument = false);
///< constructor ///< constructor
/// \param argument Parser is used to parse function- or instruction- /// \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) Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code), : Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
mState (BeginState), mExprParser (errorHandler, context, locals, literals), mState (BeginState), mExprParser (errorHandler, context, locals, literals),

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

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

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

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

@ -15,7 +15,7 @@ namespace Compiler
public: 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, virtual bool parseName (const std::string& name, const TokenLoc& loc,
Scanner& scanner); Scanner& scanner);

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

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

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

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

@ -10,7 +10,7 @@
namespace Compiler 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) : Parser (errorHandler, context), mLiterals (literals), mState (StartState), mSmashCase (false)
{ {

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