Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/stringparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/stringparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down