Move Lexer to u16string handling, for unicode support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-15 17:20:27 +02:00
parent f73bd2003c
commit 3dc67ec8a0
21 changed files with 189 additions and 145 deletions

View File

@@ -9,10 +9,10 @@
using namespace std;
class StringEvalValue : public EvalValue{
string _value;
u16string _value;
size_t _hash;
public:
explicit StringEvalValue(string s){
explicit StringEvalValue(u16string s){
_value = move(s);
_hash = HashedString::ConstHash (_value.c_str());
}
@@ -27,7 +27,7 @@ public:
return this->_hash == b->GetHashCode();
};
const string* EvaluateString() const final{
const u16string* EvaluateString() const final{
return &_value;
}
@@ -38,7 +38,7 @@ public:
shared_ptr<EvalValue> IndexValue(EvalValue* val) final{
// Porygon is 1-indexed, so we convert to that.
auto l = val->EvaluateInteger() - 1;
return make_shared<StringEvalValue>(string(1, _value[l]));
return make_shared<StringEvalValue>(u16string(1, _value[l]));
}
std::size_t GetHashCode() final{