CBMC
format_strings.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Format String Parser
4
5
Author: CM Wintersteiger
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_GOTO_PROGRAMS_FORMAT_STRINGS_H
13
#define CPROVER_GOTO_PROGRAMS_FORMAT_STRINGS_H
14
15
#include <
util/irep.h
>
16
#include <
util/mp_arith.h
>
17
18
#include <list>
19
#include <optional>
20
#include <string>
21
22
class
typet
;
23
24
class
format_tokent
25
{
26
public
:
27
enum class
token_typet
28
{
29
UNKNOWN
,
30
TEXT
,
31
INT
,
// d, i, o, u, x
32
FLOAT
,
// a, e, f, g
33
CHAR
,
// c
34
STRING
,
// s
35
POINTER
// p
36
};
37
38
enum class
flag_typet
39
{
40
ALTERNATE
,
41
ZERO_PAD
,
42
LEFT_ADJUST
,
43
SIGNED_SPACE
,
44
SIGN
,
45
ASTERISK
46
};
47
48
enum class
length_modifierst
49
{
50
LEN_undef
,
51
LEN_h
,
52
LEN_hh
,
53
LEN_l
,
54
LEN_ll
,
55
LEN_L
,
56
LEN_j
,
57
LEN_t
58
};
59
60
enum class
representationt
61
{
62
SIGNED_undef
,
63
SIGNED_DEC
,
64
UNSIGNED_DEC
,
65
UNSIGNED_OCT
,
66
UNSIGNED_HEX
67
};
68
69
explicit
format_tokent
(
token_typet
_type)
70
:
type
(_type),
71
length_modifier
(
length_modifierst
::LEN_undef),
72
representation
(
representationt
::SIGNED_undef)
73
{
74
}
75
format_tokent
()
76
:
type
(
token_typet
::
UNKNOWN
),
77
length_modifier
(
length_modifierst
::LEN_undef),
78
representation
(
representationt
::SIGNED_undef)
79
{
80
}
81
82
token_typet
type
;
83
std::list<flag_typet>
flags
;
84
mp_integer
field_width
;
85
mp_integer
precision
;
86
length_modifierst
length_modifier
;
87
representationt
representation
;
88
irep_idt
value
;
// for text and pattern matching
89
};
90
91
typedef
std::list<format_tokent>
format_token_listt
;
92
93
format_token_listt
parse_format_string
(
const
std::string &);
94
95
std::optional<typet>
get_type
(
const
format_tokent
&);
96
97
#endif
// CPROVER_GOTO_PROGRAMS_FORMAT_STRINGS_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition:
dstring.h:38
format_tokent
Definition:
format_strings.h:25
format_tokent::precision
mp_integer precision
Definition:
format_strings.h:85
format_tokent::type
token_typet type
Definition:
format_strings.h:82
format_tokent::field_width
mp_integer field_width
Definition:
format_strings.h:84
format_tokent::representation
representationt representation
Definition:
format_strings.h:87
format_tokent::flag_typet
flag_typet
Definition:
format_strings.h:39
format_tokent::flag_typet::ALTERNATE
@ ALTERNATE
format_tokent::flag_typet::SIGN
@ SIGN
format_tokent::flag_typet::ASTERISK
@ ASTERISK
format_tokent::flag_typet::ZERO_PAD
@ ZERO_PAD
format_tokent::flag_typet::LEFT_ADJUST
@ LEFT_ADJUST
format_tokent::flag_typet::SIGNED_SPACE
@ SIGNED_SPACE
format_tokent::token_typet
token_typet
Definition:
format_strings.h:28
format_tokent::token_typet::CHAR
@ CHAR
format_tokent::token_typet::INT
@ INT
format_tokent::token_typet::TEXT
@ TEXT
format_tokent::token_typet::STRING
@ STRING
format_tokent::token_typet::UNKNOWN
@ UNKNOWN
format_tokent::token_typet::POINTER
@ POINTER
format_tokent::token_typet::FLOAT
@ FLOAT
format_tokent::format_tokent
format_tokent()
Definition:
format_strings.h:75
format_tokent::length_modifier
length_modifierst length_modifier
Definition:
format_strings.h:86
format_tokent::format_tokent
format_tokent(token_typet _type)
Definition:
format_strings.h:69
format_tokent::length_modifierst
length_modifierst
Definition:
format_strings.h:49
format_tokent::length_modifierst::LEN_ll
@ LEN_ll
format_tokent::length_modifierst::LEN_l
@ LEN_l
format_tokent::length_modifierst::LEN_h
@ LEN_h
format_tokent::length_modifierst::LEN_t
@ LEN_t
format_tokent::length_modifierst::LEN_undef
@ LEN_undef
format_tokent::length_modifierst::LEN_hh
@ LEN_hh
format_tokent::length_modifierst::LEN_j
@ LEN_j
format_tokent::length_modifierst::LEN_L
@ LEN_L
format_tokent::flags
std::list< flag_typet > flags
Definition:
format_strings.h:83
format_tokent::representationt
representationt
Definition:
format_strings.h:61
format_tokent::representationt::UNSIGNED_DEC
@ UNSIGNED_DEC
format_tokent::representationt::UNSIGNED_HEX
@ UNSIGNED_HEX
format_tokent::representationt::UNSIGNED_OCT
@ UNSIGNED_OCT
format_tokent::representationt::SIGNED_undef
@ SIGNED_undef
format_tokent::representationt::SIGNED_DEC
@ SIGNED_DEC
format_tokent::value
irep_idt value
Definition:
format_strings.h:88
typet
The type of an expression, extends irept.
Definition:
type.h:29
parse_format_string
format_token_listt parse_format_string(const std::string &)
Definition:
format_strings.cpp:202
format_token_listt
std::list< format_tokent > format_token_listt
Definition:
format_strings.h:91
get_type
std::optional< typet > get_type(const format_tokent &)
Definition:
format_strings.cpp:245
irep.h
mp_arith.h
mp_integer
BigInt mp_integer
Definition:
smt_terms.h:17
ai_verifier_statust::UNKNOWN
@ UNKNOWN
src
ansi-c
goto-conversion
format_strings.h
Generated by
1.9.1