mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
add octal escape to seq_decl_plugin
This commit is contained in:
parent
c67cf1653c
commit
61bbf8ba7e
|
@ -38,8 +38,16 @@ static bool is_hex_digit(char ch, unsigned& d) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_octal_digit(char ch, unsigned& d) {
|
||||||
|
if ('0' <= ch && ch <= '7') {
|
||||||
|
d = ch - '0';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool is_escape_char(char const *& s, unsigned& result) {
|
static bool is_escape_char(char const *& s, unsigned& result) {
|
||||||
unsigned d1, d2;
|
unsigned d1, d2, d3;
|
||||||
if (*s != '\\' || *(s + 1) == 0) {
|
if (*s != '\\' || *(s + 1) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +57,12 @@ static bool is_escape_char(char const *& s, unsigned& result) {
|
||||||
s += 4;
|
s += 4;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (is_octal_digit(*(s + 1), d1) && is_octal_digit(*(s + 2), d2) &&
|
||||||
|
is_octal_digit(*(s + 3), d3)) {
|
||||||
|
result = d1*64 + d2*8 + d3;
|
||||||
|
s += 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
switch (*(s + 1)) {
|
switch (*(s + 1)) {
|
||||||
case 'a':
|
case 'a':
|
||||||
result = '\a';
|
result = '\a';
|
||||||
|
|
Loading…
Reference in a new issue