mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 08:28:44 +00:00
Added 16 bit string-encoding (#5540)
This commit is contained in:
parent
e70f501932
commit
47fdd6c060
7 changed files with 74 additions and 35 deletions
|
@ -42,9 +42,7 @@ bool zstring::is_escape_char(char const *& s, unsigned& result) {
|
|||
result = 16*result + d;
|
||||
}
|
||||
else if (*(s+3+i) == '}') {
|
||||
if (result > 255 && !uses_unicode())
|
||||
return false;
|
||||
if (result > unicode_max_char())
|
||||
if (result > max_char())
|
||||
return false;
|
||||
s += 4 + i;
|
||||
return true;
|
||||
|
@ -65,7 +63,7 @@ bool zstring::is_escape_char(char const *& s, unsigned& result) {
|
|||
result = 16*result + d2;
|
||||
result = 16*result + d3;
|
||||
result = 16*result + d4;
|
||||
if (result > unicode_max_char())
|
||||
if (result > max_char())
|
||||
return false;
|
||||
s += 6;
|
||||
return true;
|
||||
|
@ -87,14 +85,22 @@ zstring::zstring(char const* s) {
|
|||
SASSERT(well_formed());
|
||||
}
|
||||
|
||||
|
||||
bool zstring::uses_unicode() const {
|
||||
return gparams::get_value("unicode") != "false";
|
||||
string_encoding zstring::get_encoding() {
|
||||
if (gparams::get_value("encoding") == "unicode") {
|
||||
return unicode;
|
||||
}
|
||||
if (gparams::get_value("encoding") == "bmp") {
|
||||
return bmp;
|
||||
}
|
||||
if (gparams::get_value("encoding") == "ascii") {
|
||||
return ascii;
|
||||
}
|
||||
return unicode;
|
||||
}
|
||||
|
||||
bool zstring::well_formed() const {
|
||||
for (unsigned ch : m_buffer) {
|
||||
if (ch > unicode_max_char()) {
|
||||
if (ch > max_char()) {
|
||||
IF_VERBOSE(0, verbose_stream() << "large character: " << ch << "\n";);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue