diff --git a/src/stringparser.cpp b/src/stringparser.cpp index b8cbf4f..92c98f7 100644 --- a/src/stringparser.cpp +++ b/src/stringparser.cpp @@ -21,6 +21,11 @@ void StringParser::Warning(const string &msg, int line_unused, int col) error->Warning(msg + " inside string", this->line, col); } +void StringParser::Deprecated(const string &msg, const string &suggestion, int line_unused, int col) +{ + error->Warning(msg + " inside string, which may stop working in the future; " + suggestion, this->line, col); +} + int StringParser::acceptbyte() { string s = ""; @@ -92,6 +97,16 @@ Value StringParser::Evaluate(SymbolTable* scope, EvalContext& context) docodes = true; } else { + if(current == ']') { + Deprecated(string("lone \"]\" character"), + string("if this was intentional, please replace it with [8D]"), + 0,0); + } + else if(current == '}') { + Deprecated(string("lone \"}\" character"), + string("if this was intentional, please replace it with [AD]"), + 0,0); + } // Default: output->Char(current); } diff --git a/src/stringparser.h b/src/stringparser.h index 6766182..01531e9 100644 --- a/src/stringparser.h +++ b/src/stringparser.h @@ -36,6 +36,8 @@ class StringParser : public ErrorReceiver void Warning(const std::string& msg, int line, int col); private: + // One-off warning method because `Warning` adds " inside string" to the end of the string every time + void Deprecated(const std::string& msg, const std::string& suggestion, int line, int col); int acceptbyte(); bool expect(char c); void next();