CBMC
Loading...
Searching...
No Matches
character_refine_preprocess.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Preprocess a goto-programs so that calls to the java Character
4 library are replaced by simple expressions.
5
6Author: Romain Brenguier
7
8Date: March 2017
9
10\*******************************************************************/
11
15
17
18#include <util/arith_tools.h>
19#include <util/bitvector_expr.h>
20#include <util/std_expr.h>
21
23
28 exprt (*expr_function)(const exprt &chr, const typet &type),
29 conversion_inputt &target)
30{
31 const code_function_callt &function_call=target;
32 PRECONDITION(function_call.arguments().size() == 1);
33 const exprt &arg=function_call.arguments()[0];
34 const exprt &result=function_call.lhs();
35 const typet &type=result.type();
36 return code_assignt(result, expr_function(arg, type));
37}
38
46 const exprt &chr,
47 const mp_integer &lower_bound,
48 const mp_integer &upper_bound)
49{
50 return and_exprt(
51 binary_relation_exprt(chr, ID_ge, from_integer(lower_bound, chr.type())),
52 binary_relation_exprt(chr, ID_le, from_integer(upper_bound, chr.type())));
53}
54
61 const exprt &chr, const std::list<mp_integer> &list)
62{
64 for(const auto &i : list)
65 ops.push_back(equal_exprt(chr, from_integer(i, chr.type())));
66 return disjunction(ops);
67}
68
81
91
95 const exprt &chr, const typet &type)
96{
97 return typecast_exprt(chr, type);
98}
99
109
114{
115 const code_function_callt &function_call=target;
116 PRECONDITION(function_call.arguments().size() == 2);
117 const exprt &char1=function_call.arguments()[0];
118 const exprt &char2=function_call.arguments()[1];
119 const exprt &result=function_call.lhs();
120 const typet &type=result.type();
123 if_exprt expr(
124 smaller,
125 from_integer(-1, type),
126 if_exprt(greater, from_integer(1, type), from_integer(0, type)));
127
128 return code_assignt(result, expr);
129}
130
139 conversion_inputt &target)
140{
141 const code_function_callt &function_call=target;
142 const std::size_t nb_args=function_call.arguments().size();
143 PRECONDITION(nb_args==1 || nb_args==2);
144 const exprt &arg=function_call.arguments()[0];
145 // If there is no radix argument we set it to 36 which is the maximum possible
146 const exprt &radix=
147 nb_args>1?function_call.arguments()[1]:from_integer(36, arg.type());
148 const exprt &result=function_call.lhs();
149 const typet &type=result.type();
150
151 // TODO: If the radix is not in the range MIN_RADIX <= radix <= MAX_RADIX or
152 // if the value of ch is not a valid digit in the specified radix,
153 // -1 is returned.
154
155 // Case 1: The method isDigit is true of the character and the Unicode
156 // decimal digit value of the character (or its single-character
157 // decomposition) is less than the specified radix.
158 exprt invalid=from_integer(-1, arg.type());
159 exprt c0=from_integer('0', arg.type());
160 exprt latin_digit=in_interval_expr(arg, '0', '9');
161 minus_exprt value1(arg, c0);
162 // TODO: this is only valid for latin digits
165
166 // Case 2: The character is one of the uppercase Latin letters 'A'
167 // through 'Z' and its code is less than radix + 'A' - 10,
168 // then ch - 'A' + 10 is returned.
169 exprt cA=from_integer('A', arg.type());
170 exprt i10=from_integer(10, arg.type());
171 exprt upper_case=in_interval_expr(arg, 'A', 'Z');
175
176 // The character is one of the lowercase Latin letters 'a' through 'z' and
177 // its code is less than radix + 'a' - 10, then ch - 'a' + 10 is returned.
178 exprt ca=from_integer('a', arg.type());
179 exprt lower_case=in_interval_expr(arg, 'a', 'z');
183
184
185 // The character is one of the fullwidth uppercase Latin letters A ('\uFF21')
186 // through Z ('\uFF3A') and its code is less than radix + '\uFF21' - 10.
187 // In this case, ch - '\uFF21' + 10 is returned.
188 exprt uFF21=from_integer(0xFF21, arg.type());
189 exprt fullwidth_upper_case=in_interval_expr(arg, 0xFF21, 0xFF3A);
193
194 // The character is one of the fullwidth lowercase Latin letters a ('\uFF41')
195 // through z ('\uFF5A') and its code is less than radix + '\uFF41' - 10.
196 // In this case, ch - '\uFF41' + 10 is returned.
197 exprt uFF41=from_integer(0xFF41, arg.type());
201
203 if_exprt expr(
205 case1,
207 typecast_exprt tc_expr(expr, type);
208
209 return code_assignt(result, tc_expr);
210}
211
219
226{
227 const code_function_callt &function_call=target;
228 PRECONDITION(function_call.arguments().size() == 2);
229 const exprt &digit=function_call.arguments()[0];
230 const exprt &result=function_call.lhs();
231 const typet &type=result.type();
233
234 exprt d10=from_integer(10, type);
238 return code_assignt(result, if_exprt(small, value1, value2));
239}
240
245 conversion_inputt &target)
246{
247 // TODO: This is unimplemented for now as it requires analyzing
248 // the UnicodeData file to find characters directionality.
249 return target;
250}
251
260
270
281
286 conversion_inputt &target)
287{
288 // TODO: This is unimplemented for now as it requires analyzing
289 // the UnicodeData file to categorize characters.
290 return target;
291}
292
301
309
317 const exprt &chr, const typet &type)
318{
319 exprt u10000=from_integer(0x010000, type);
320 exprt uD800=from_integer(0xD800, type);
321 exprt u400=from_integer(0x0400, type);
322
324 return std::move(high_surrogate);
325}
326
332 const exprt &chr, const typet &type)
333{
334 (void)type; // unused parameter
335 return in_interval_expr(chr, 'a', 'z');
336}
337
343 const exprt &chr, const typet &type)
344{
345 (void)type; // unused parameter
346 return in_interval_expr(chr, 'A', 'Z');
347}
348
364
376 const exprt &chr, const typet &type)
377{
378 return expr_of_is_letter(chr, type);
379}
380
390
398 const exprt &chr, const typet &type)
399{
400 (void)type; // unused parameter
401 return and_exprt(
404}
405
415
421 const exprt &chr, const typet &type)
422{
423 (void)type; // unused parameter
424 // The following intervals are undefined in unicode, according to
425 // the Unicode Character Database: http://www.unicode.org/Public/UCD/latest/
426 exprt::operandst intervals;
427 intervals.push_back(in_interval_expr(chr, 0x0750, 0x077F));
428 intervals.push_back(in_interval_expr(chr, 0x07C0, 0x08FF));
429 intervals.push_back(in_interval_expr(chr, 0x1380, 0x139F));
430 intervals.push_back(in_interval_expr(chr, 0x18B0, 0x18FF));
431 intervals.push_back(in_interval_expr(chr, 0x1980, 0x19DF));
432 intervals.push_back(in_interval_expr(chr, 0x1A00, 0x1CFF));
433 intervals.push_back(in_interval_expr(chr, 0x1D80, 0x1DFF));
434 intervals.push_back(in_interval_expr(chr, 0x2C00, 0x2E7F));
435 intervals.push_back(in_interval_expr(chr, 0x2FE0, 0x2FEF));
436 intervals.push_back(in_interval_expr(chr, 0x31C0, 0x31EF));
437 intervals.push_back(in_interval_expr(chr, 0x9FB0, 0x9FFF));
438 intervals.push_back(in_interval_expr(chr, 0xA4D0, 0xABFF));
439 intervals.push_back(in_interval_expr(chr, 0xD7B0, 0xD7FF));
440 intervals.push_back(in_interval_expr(chr, 0xFE10, 0xFE1F));
441 intervals.push_back(in_interval_expr(chr, 0x10140, 0x102FF));
442 intervals.push_back(in_interval_expr(chr, 0x104B0, 0x107FF));
443 intervals.push_back(in_interval_expr(chr, 0x10840, 0x1CFFF));
444 intervals.push_back(in_interval_expr(chr, 0x1D200, 0x1D2FF));
445 intervals.push_back(in_interval_expr(chr, 0x1D360, 0x1D3FF));
446 intervals.push_back(
447 binary_relation_exprt(chr, ID_ge, from_integer(0x1D800, chr.type())));
448
449 return not_exprt(disjunction(intervals));
450}
451
461
470
499
509
518
525 const exprt &chr, const typet &type)
526{
527 (void)type; // unused parameter
528 return in_interval_expr(chr, 0xD800, 0xDBFF);
529}
530
540
550 const exprt &chr, const typet &type)
551{
552 (void)type; // unused parameter
554 in_interval_expr(chr, 0x0000, 0x0008),
555 or_exprt(
556 in_interval_expr(chr, 0x000E, 0x001B),
557 in_interval_expr(chr, 0x007F, 0x009F)));
558 return std::move(ignorable);
559}
560
572
583
588 conversion_inputt &target)
589{
590 const code_function_callt &function_call=target;
591 PRECONDITION(function_call.arguments().size() == 1);
592 const exprt &arg=function_call.arguments()[0];
593 const exprt &result=function_call.lhs();
594 exprt is_ideograph=in_interval_expr(arg, 0x4E00, 0x9FFF);
595 return code_assignt(result, is_ideograph);
596}
597
602 conversion_inputt &target)
603{
604 const code_function_callt &function_call=target;
605 PRECONDITION(function_call.arguments().size() == 1);
606 const exprt &arg=function_call.arguments()[0];
607 const exprt &result=function_call.lhs();
609 in_interval_expr(arg, 0x00, 0x1F), in_interval_expr(arg, 0x7F, 0x9F));
610 return code_assignt(result, iso);
611}
612
621
634
643
657
666
675
684
694
703
713
723
732
744
755
760 conversion_inputt &target)
761{
762 const code_function_callt &function_call=target;
763 PRECONDITION(function_call.arguments().size() == 1);
764 const exprt &arg=function_call.arguments()[0];
765 const exprt &result=function_call.lhs();
766 exprt is_low_surrogate=in_interval_expr(arg, 0xDC00, 0xDFFF);
767 return code_assignt(result, is_low_surrogate);
768}
769
778 const exprt &chr, const typet &type)
779{
780 (void)type; // unused parameter
781 return in_list_expr(chr, {0x28, 0x29, 0x3C, 0x3E, 0x5B, 0x5D, 0x7B, 0x7D});
782}
783
795
806
814
821 const exprt &chr, const typet &type)
822{
823 (void)type; // unused parameter
824 std::list<mp_integer> space_characters=
825 {0x20, 0x00A0, 0x1680, 0x202F, 0x205F, 0x3000, 0x2028, 0x2029};
827 exprt condition1=in_interval_expr(chr, 0x2000, 0x200A);
829}
830
840
849
856 const exprt &chr, const typet &type)
857{
858 (void)type; // unused parameter
859 return binary_relation_exprt(chr, ID_gt, from_integer(0xFFFF, chr.type()));
860}
861
871
877 const exprt &chr, const typet &type)
878{
879 (void)type; // unused parameter
880 return in_interval_expr(chr, 0xD800, 0xDFFF);
881}
882
892
897 conversion_inputt &target)
898{
899 const code_function_callt &function_call=target;
900 PRECONDITION(function_call.arguments().size() == 2);
901 const exprt &arg0=function_call.arguments()[0];
902 const exprt &arg1=function_call.arguments()[1];
903 const exprt &result=function_call.lhs();
907}
908
914 const exprt &chr, const typet &type)
915{
916 (void)type; // unused parameter
917 std::list<mp_integer>title_case_chars=
918 {0x01C5, 0x01C8, 0x01CB, 0x01F2, 0x1FBC, 0x1FCC, 0x1FFC};
919 exprt::operandst conditions;
920 conditions.push_back(in_list_expr(chr, title_case_chars));
921 conditions.push_back(in_interval_expr(chr, 0x1F88, 0x1F8F));
922 conditions.push_back(in_interval_expr(chr, 0x1F98, 0x1F9F));
923 conditions.push_back(in_interval_expr(chr, 0x1FA8, 0x1FAF));
924 return disjunction(conditions);
925}
926
936
945
952 const exprt &chr, const typet &type)
953{
954 (void)type; // unused parameter
955 // The following set of characters is the general category "Nl" in the
956 // Unicode specification.
957 exprt cond0=in_interval_expr(chr, 0x16EE, 0x16F0);
958 exprt cond1=in_interval_expr(chr, 0x2160, 0x2188);
959 exprt cond2=in_interval_expr(chr, 0x3021, 0x3029);
960 exprt cond3=in_interval_expr(chr, 0x3038, 0x303A);
961 exprt cond4=in_interval_expr(chr, 0xA6E6, 0xA6EF);
962 exprt cond5=in_interval_expr(chr, 0x10140, 0x10174);
963 exprt cond6=in_interval_expr(chr, 0x103D1, 0x103D5);
964 exprt cond7=in_interval_expr(chr, 0x12400, 0x1246E);
965 exprt cond8=in_list_expr(chr, {0x3007, 0x10341, 0x1034A});
966 return or_exprt(
969}
970
971
980 const exprt &chr, const typet &type)
981{
982 exprt::operandst conditions;
983 conditions.push_back(expr_of_is_unicode_identifier_start(chr, type));
984 conditions.push_back(expr_of_is_digit(chr, type));
985 conditions.push_back(expr_of_is_identifier_ignorable(chr, type));
986 return disjunction(conditions);
987}
988
998
1007
1019
1029
1038
1050
1059
1066 const exprt &chr, const typet &type)
1067{
1068 (void)type; // unused parameter
1069 return binary_relation_exprt(chr, ID_le, from_integer(0x10FFFF, chr.type()));
1070}
1071
1081
1091 const exprt &chr, const typet &type)
1092{
1093 (void)type; // unused parameter
1094 exprt::operandst conditions;
1095 std::list<mp_integer> space_characters=
1096 {0x20, 0x1680, 0x205F, 0x3000, 0x2028, 0x2029};
1097 conditions.push_back(in_list_expr(chr, space_characters));
1098 conditions.push_back(in_interval_expr(chr, 0x2000, 0x2006));
1099 conditions.push_back(in_interval_expr(chr, 0x2008, 0x200A));
1100 conditions.push_back(in_interval_expr(chr, 0x09, 0x0D));
1101 conditions.push_back(in_interval_expr(chr, 0x1C, 0x1F));
1102 return disjunction(conditions);
1103}
1104
1114
1123
1131 const exprt &chr, const typet &type)
1132{
1133 exprt uDC00=from_integer(0xDC00, type);
1134 exprt u0400=from_integer(0x0400, type);
1135 return plus_exprt(uDC00, mod_exprt(chr, u0400));
1136}
1137
1150
1160
1177
1187
1196
1202 const exprt &chr, const typet &type)
1203{
1204 std::list<mp_integer> increment_list={0x01C4, 0x01C7, 0x01CA, 0x01F1};
1205 std::list<mp_integer> decrement_list={0x01C6, 0x01C9, 0x01CC, 0x01F3};
1206 exprt plus_8_interval1=in_interval_expr(chr, 0x1F80, 0x1F87);
1207 exprt plus_8_interval2=in_interval_expr(chr, 0x1F90, 0x1F97);
1208 exprt plus_8_interval3=in_interval_expr(chr, 0x1FA0, 0x1FA7);
1209 std::list<mp_integer> plus_9_list={0x1FB3, 0x1FC3, 0x1FF3};
1211 plus_exprt plus_1(chr, from_integer(1, type));
1212 plus_exprt plus_8(chr, from_integer(8, type));
1213 plus_exprt plus_9(chr, from_integer(9, type));
1216
1217 return if_exprt(
1219 plus_1,
1220 if_exprt(
1222 minus_1,
1223 if_exprt(
1224 plus_8_set,
1225 plus_8,
1227}
1228
1238
1247
1264
1274
1283
1291 const code_function_callt &code) const
1292{
1293 if(code.function().id()==ID_symbol)
1294 {
1295 const irep_idt &function_id=
1296 to_symbol_expr(code.function()).get_identifier();
1297 auto it=conversion_table.find(function_id);
1298 if(it!=conversion_table.end())
1299 return (it->second)(code);
1300 }
1301
1302 return code;
1303}
1304
1307{
1308 // All methods are listed here in alphabetic order
1309 // The ones that are not supported by this module (though they may be
1310 // supported by the string solver) have no entry in the conversion
1311 // table and are marked in this way:
1312 // Not supported "java::java.lang.Character.<init>()"
1313
1314 conversion_table["java::java.lang.Character.charCount:(I)I"]=
1316 conversion_table["java::java.lang.Character.charValue:()C"]=
1318
1319 // Not supported "java::java.lang.Character.codePointAt:([CI)I
1320 // Not supported "java::java.lang.Character.codePointAt:([CII)I"
1321 // Not supported "java::java.lang.Character.codePointAt:"
1322 // "(Ljava.lang.CharSequence;I)I"
1323 // Not supported "java::java.lang.Character.codePointBefore:([CI)I"
1324 // Not supported "java::java.lang.Character.codePointBefore:([CII)I"
1325 // Not supported "java::java.lang.Character.codePointBefore:"
1326 // "(Ljava.lang.CharSequence;I)I"
1327 // Not supported "java::java.lang.Character.codePointCount:([CII)I"
1328 // Not supported "java::java.lang.Character.codePointCount:"
1329 // "(Ljava.lang.CharSequence;II)I"
1330 // Not supported "java::java.lang.Character.compareTo:"
1331 // "(Ljava.lang.Character;)I"
1332
1333 conversion_table["java::java.lang.Character.compare:(CC)I"]=
1335 conversion_table["java::java.lang.Character.digit:(CI)I"]=
1337 conversion_table["java::java.lang.Character.digit:(II)I"]=
1339
1340 // Not supported "java::java.lang.Character.equals:(Ljava.lang.Object;)Z"
1341
1342 conversion_table["java::java.lang.Character.forDigit:(II)C"]=
1344 conversion_table["java::java.lang.Character.getDirectionality:(C)B"]=
1346 conversion_table["java::java.lang.Character.getDirectionality:(I)B"]=
1348
1349 // Not supported "java::java.lang.Character.getName:(I)Ljava.lang.String;"
1350
1351 conversion_table["java::java.lang.Character.getNumericValue:(C)I"]=
1353 conversion_table["java::java.lang.Character.getNumericValue:(I)I"]=
1355 conversion_table["java::java.lang.Character.getType:(C)I"]=
1357 conversion_table["java::java.lang.Character.getType:(I)I"]=
1359 conversion_table["java::java.lang.Character.hashCode:()I"]=
1361 conversion_table["java::java.lang.Character.isAlphabetic:(I)Z"]=
1363 conversion_table["java::java.lang.Character.isBmpCodePoint:(I)Z"]=
1365 conversion_table["java::java.lang.Character.isDefined:(C)Z"]=
1367 conversion_table["java::java.lang.Character.isDefined:(I)Z"]=
1369 conversion_table["java::java.lang.Character.isDigit:(C)Z"]=
1371 conversion_table["java::java.lang.Character.isDigit:(I)Z"]=
1373 conversion_table["java::java.lang.Character.isHighSurrogate:(C)Z"]=
1375 conversion_table["java::java.lang.Character.isIdentifierIgnorable:(C)Z"]=
1377 conversion_table["java::java.lang.Character.isIdentifierIgnorable:(I)Z"]=
1379 conversion_table["java::java.lang.Character.isIdeographic:(I)Z"]=
1381 conversion_table["java::java.lang.Character.isISOControl:(C)Z"]=
1383 conversion_table["java::java.lang.Character.isISOControl:(I)Z"]=
1385 conversion_table["java::java.lang.Character.isJavaIdentifierPart:(C)Z"]=
1387 conversion_table["java::java.lang.Character.isJavaIdentifierPart:(I)Z"]=
1389 conversion_table["java::java.lang.Character.isJavaIdentifierStart:(C)Z"]=
1391 conversion_table["java::java.lang.Character.isJavaIdentifierStart:(I)Z"]=
1393 conversion_table["java::java.lang.Character.isJavaLetter:(C)Z"]=
1395 conversion_table["java::java.lang.Character.isJavaLetterOrDigit:(C)Z"]=
1397 conversion_table["java::java.lang.Character.isLetter:(C)Z"]=
1399 conversion_table["java::java.lang.Character.isLetter:(I)Z"]=
1401 conversion_table["java::java.lang.Character.isLetterOrDigit:(C)Z"]=
1403 conversion_table["java::java.lang.Character.isLetterOrDigit:(I)Z"]=
1405 conversion_table["java::java.lang.Character.isLowerCase:(C)Z"]=
1407 conversion_table["java::java.lang.Character.isLowerCase:(I)Z"]=
1409 conversion_table["java::java.lang.Character.isLowSurrogate:(C)Z"]=
1411 conversion_table["java::java.lang.Character.isMirrored:(C)Z"]=
1413 conversion_table["java::java.lang.Character.isMirrored:(I)Z"]=
1415 conversion_table["java::java.lang.Character.isSpace:(C)Z"]=
1417 conversion_table["java::java.lang.Character.isSpaceChar:(C)Z"]=
1419 conversion_table["java::java.lang.Character.isSpaceChar:(I)Z"]=
1421 conversion_table["java::java.lang.Character.isSupplementaryCodePoint:(I)Z"]=
1423 conversion_table["java::java.lang.Character.isSurrogate:(C)Z"]=
1425 conversion_table["java::java.lang.Character.isSurrogatePair:(CC)Z"]=
1427 conversion_table["java::java.lang.Character.isTitleCase:(C)Z"]=
1429 conversion_table["java::java.lang.Character.isTitleCase:(I)Z"]=
1431 conversion_table["java::java.lang.Character.isUnicodeIdentifierPart:(C)Z"]=
1433 conversion_table["java::java.lang.Character.isUnicodeIdentifierPart:(I)Z"]=
1435 conversion_table["java::java.lang.Character.isUnicodeIdentifierStart:(C)Z"]=
1437 conversion_table["java::java.lang.Character.isUnicodeIdentifierStart:(I)Z"]=
1439 conversion_table["java::java.lang.Character.isUpperCase:(C)Z"]=
1441 conversion_table["java::java.lang.Character.isUpperCase:(I)Z"]=
1443 conversion_table["java::java.lang.Character.isValidCodePoint:(I)Z"]=
1445 conversion_table["java::java.lang.Character.isWhitespace:(C)Z"]=
1447 conversion_table["java::java.lang.Character.isWhitespace:(I)Z"]=
1449
1450 // Not supported "java::java.lang.Character.offsetByCodePoints:([CIIII)I"
1451 // Not supported "java::java.lang.Character.offsetByCodePoints:"
1452 // "(Ljava.lang.CharacterSequence;II)I"
1453
1454 conversion_table["java::java.lang.Character.reverseBytes:(C)C"]=
1456
1457 // Not supported "java::java.lang.Character.toChars:(I[CI)I"
1458
1459 conversion_table["java::java.lang.Character.toLowerCase:(C)C"]=
1461 conversion_table["java::java.lang.Character.toLowerCase:(I)I"]=
1463
1464 // Not supported "java::java.lang.Character.toString:()Ljava.lang.String;"
1465 // Not supported "java::java.lang.Character.toString:(C)Ljava.lang.String;"
1466
1467 conversion_table["java::java.lang.Character.toTitleCase:(C)C"]=
1469 conversion_table["java::java.lang.Character.toTitleCase:(I)I"]=
1471 conversion_table["java::java.lang.Character.toUpperCase:(C)C"]=
1473 conversion_table["java::java.lang.Character.toUpperCase:(I)I"]=
1475
1476 // Not supported "java::java.lang.Character.valueOf:(C)Ljava.lang.Character;"
1477}
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
API to expression classes for bitvectors.
Preprocess a goto-programs so that calls to the java Character library are replaced by simple express...
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Boolean AND.
Definition std_expr.h:2125
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition std_expr.h:762
static codet convert_is_upper_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_digit_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_lower_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_high_surrogate(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_char_function(exprt(*expr_function)(const exprt &chr, const typet &type), conversion_inputt &target)
converts based on a function on expressions
static codet convert_is_whitespace_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_letter_number(const exprt &chr, const typet &type)
Determines if the specified character is in the LETTER_NUMBER category of Unicode.
static exprt expr_of_is_alphabetic(const exprt &chr, const typet &type)
Determines if the specified character (Unicode code point) is alphabetic.
static codet convert_is_ISO_control_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_lower_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_get_numeric_value_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_identifier_ignorable(const exprt &chr, const typet &type)
Determines if the character is one of ignorable in a Java identifier, that is, it is in one of these ...
static codet convert_is_title_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_unicode_identifier_part_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_ascii_upper_case(const exprt &chr, const typet &type)
Determines if the specified character is an ASCII uppercase character.
static exprt expr_of_is_defined(const exprt &chr, const typet &type)
Determines if a character is defined in Unicode.
static exprt expr_of_is_unicode_identifier_start(const exprt &chr, const typet &type)
Determines if the specified character is permissible as the first character in a Unicode identifier.
std::unordered_map< irep_idt, conversion_functiont > conversion_table
static codet convert_is_surrogate_pair(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_to_title_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_compare(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_space_char_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_char_count(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_char_value(const exprt &chr, const typet &type)
Casts the given expression to the given type.
static exprt expr_of_is_high_surrogate(const exprt &chr, const typet &type)
Determines if the given char value is a Unicode high-surrogate code unit (also known as leading-surro...
static codet convert_is_space(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_space_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_valid_code_point(const exprt &chr, const typet &type)
Determines whether the specified code point is a valid Unicode code point value.
static exprt in_interval_expr(const exprt &chr, const mp_integer &lower_bound, const mp_integer &upper_bound)
The returned expression is true when the first argument is in the interval defined by the lower and u...
void initialize_conversion_table()
fill maps with correspondance from java method names to conversion functions
static exprt expr_of_is_letter_or_digit(const exprt &chr, const typet &type)
Determines if the specified character is a letter or digit.
static codet convert_is_unicode_identifier_part_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_mirrored(const exprt &chr, const typet &type)
Determines whether the character is mirrored according to the Unicode specification.
static codet convert_to_upper_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_mirrored_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_java_letter(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_defined_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_identifier_ignorable_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_whitespace(const exprt &chr, const typet &type)
Determines if the specified character is white space according to Java.
codet replace_character_call(const code_function_callt &call) const
replace function calls to functions of the Character by an affectation if possible,...
static codet convert_is_letter_or_digit_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_unicode_identifier_part(const exprt &chr, const typet &type)
Determines if the character may be part of a Unicode identifier.
static codet convert_is_ideographic(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_get_type_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_to_lower_case(const exprt &chr, const typet &type)
Converts the character argument to lowercase.
static codet convert_is_bmp_code_point(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_supplementary_code_point(const exprt &chr, const typet &type)
Determines whether the specified character (Unicode code point) is in the supplementary character ran...
static exprt expr_of_reverse_bytes(const exprt &chr, const typet &type)
Returns the value obtained by reversing the order of the bytes in the specified char value.
static codet convert_is_defined_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_to_title_case(const exprt &chr, const typet &type)
Converts the character argument to titlecase.
static codet convert_is_supplementary_code_point(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_surrogate(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_char_value(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_to_lower_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_mirrored_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_title_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_to_title_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_low_surrogate(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_get_directionality_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_ascii_lower_case(const exprt &chr, const typet &type)
Determines if the specified character is an ASCII lowercase character.
static codet convert_hash_code(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_unicode_identifier_start_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt in_list_expr(const exprt &chr, const std::list< mp_integer > &list)
The returned expression is true when the given character is equal to one of the element in the list.
static codet convert_is_java_identifier_start_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method isJavaIdent...
static codet convert_for_digit(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_get_type_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_high_surrogate(const exprt &chr, const typet &type)
Returns the leading surrogate (a high surrogate code unit) of the surrogate pair representing the spe...
static codet convert_is_upper_case_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_digit_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_java_identifier_part_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_java_identifier_start_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method isJavaIdent...
static codet convert_is_identifier_ignorable_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_ISO_control_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_unicode_identifier_start_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_char_count(const exprt &chr, const typet &type)
Determines the number of char values needed to represent the specified character (Unicode code point)...
static codet convert_is_java_letter_or_digit(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method isJavaLette...
static exprt expr_of_is_space_char(const exprt &chr, const typet &type)
Determines if the specified character is white space according to Unicode (SPACE_SEPARATOR,...
static exprt expr_of_is_digit(const exprt &chr, const typet &type)
Determines if the specified character is a digit.
static exprt expr_of_is_bmp_code_point(const exprt &chr, const typet &type)
Determines whether the specified character (Unicode code point) is in the Basic Multilingual Plane (B...
static codet convert_reverse_bytes(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_surrogate(const exprt &chr, const typet &type)
Determines if the given char value is a Unicode surrogate code unit.
static codet convert_get_numeric_value_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_to_upper_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_letter_or_digit_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_letter_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_digit_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_get_directionality_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_to_lower_case_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_letter_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_whitespace_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_is_letter(const exprt &chr, const typet &type)
Determines if the specified character is a letter.
static exprt expr_of_is_title_case(const exprt &chr, const typet &type)
Determines if the specified character is a titlecase character.
static codet convert_digit_char(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static exprt expr_of_to_upper_case(const exprt &chr, const typet &type)
Converts the character argument to uppercase.
static codet convert_is_valid_code_point(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_alphabetic(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method Character....
static codet convert_is_java_identifier_part_int(conversion_inputt &target)
Converts function call to an assignment of an expression corresponding to the java method isJavaIdent...
static exprt expr_of_low_surrogate(const exprt &chr, const typet &type)
Returns the trailing surrogate (a low surrogate code unit) of the surrogate pair representing the spe...
A goto_instruction_codet representing an assignment in the program.
goto_instruction_codet representation of a function call statement.
Data structure for representing an arbitrary statement in a program.
Division.
Definition std_expr.h:1157
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Equality.
Definition std_expr.h:1366
Base class for all expressions.
Definition expr.h:56
std::vector< exprt > operandst
Definition expr.h:58
typet & type()
Return the type of the expression.
Definition expr.h:84
The trinary if-then-else operator.
Definition std_expr.h:2497
const irep_idt & id() const
Definition irep.h:388
Logical right shift.
Binary minus.
Definition std_expr.h:1061
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Definition std_expr.h:1228
Boolean negation.
Definition std_expr.h:2454
Boolean OR.
Definition std_expr.h:2270
The plus expression Associativity is not specified.
Definition std_expr.h:1002
Left shift.
Semantic type conversion.
Definition std_expr.h:2073
The type of an expression, extends irept.
Definition type.h:29
BigInt mp_integer
Definition smt_terms.h:17
#define PRECONDITION(CONDITION)
Definition invariant.h:463
exprt disjunction(const exprt::operandst &op)
1) generates a disjunction for two or more operands 2) for one operand, returns the operand 3) return...
Definition std_expr.cpp:71
API to expression classes.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition std_expr.h:272
static exprt is_low_surrogate(const exprt &chr)
the output is true when the character is a low surrogate for UTF-16 encoding, see https://en....
static exprt is_high_surrogate(const exprt &chr)
the output is true when the character is a high surrogate for UTF-16 encoding, see https://en....