mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
C-style octal escapes, including 1- and 2-digit escapes
This commit is contained in:
parent
61bbf8ba7e
commit
eb0ba26f90
|
@ -57,6 +57,23 @@ static bool is_escape_char(char const *& s, unsigned& result) {
|
||||||
s += 4;
|
s += 4;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/* C-standard octal escapes: either 1, 2, or 3 octal digits,
|
||||||
|
* stopping either at 3 digits or at the first non-digit character.
|
||||||
|
*/
|
||||||
|
/* 1 octal digit */
|
||||||
|
if (is_octal_digit(*(s + 1), d1) && !is_octal_digit(*(s + 2), d2)) {
|
||||||
|
result = d1;
|
||||||
|
s += 2;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/* 2 octal digits */
|
||||||
|
if (is_octal_digit(*(s + 1), d1) && is_octal_digit(*(s + 2), d2) &&
|
||||||
|
!is_octal_digit(*(s + 3), d3)) {
|
||||||
|
result = d1 * 8 + d2;
|
||||||
|
s += 3;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/* 3 octal digits */
|
||||||
if (is_octal_digit(*(s + 1), d1) && is_octal_digit(*(s + 2), d2) &&
|
if (is_octal_digit(*(s + 1), d1) && is_octal_digit(*(s + 2), d2) &&
|
||||||
is_octal_digit(*(s + 3), d3)) {
|
is_octal_digit(*(s + 3), d3)) {
|
||||||
result = d1*64 + d2*8 + d3;
|
result = d1*64 + d2*8 + d3;
|
||||||
|
|
Loading…
Reference in a new issue