cprover
Loading...
Searching...
No Matches
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
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
Definition
format_strings.h:40
format_tokent::flag_typet::SIGN
@ SIGN
Definition
format_strings.h:44
format_tokent::flag_typet::ASTERISK
@ ASTERISK
Definition
format_strings.h:45
format_tokent::flag_typet::ZERO_PAD
@ ZERO_PAD
Definition
format_strings.h:41
format_tokent::flag_typet::LEFT_ADJUST
@ LEFT_ADJUST
Definition
format_strings.h:42
format_tokent::flag_typet::SIGNED_SPACE
@ SIGNED_SPACE
Definition
format_strings.h:43
format_tokent::token_typet
token_typet
Definition
format_strings.h:28
format_tokent::token_typet::CHAR
@ CHAR
Definition
format_strings.h:33
format_tokent::token_typet::INT
@ INT
Definition
format_strings.h:31
format_tokent::token_typet::TEXT
@ TEXT
Definition
format_strings.h:30
format_tokent::token_typet::STRING
@ STRING
Definition
format_strings.h:34
format_tokent::token_typet::UNKNOWN
@ UNKNOWN
Definition
format_strings.h:29
format_tokent::token_typet::POINTER
@ POINTER
Definition
format_strings.h:35
format_tokent::token_typet::FLOAT
@ FLOAT
Definition
format_strings.h:32
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
Definition
format_strings.h:54
format_tokent::length_modifierst::LEN_l
@ LEN_l
Definition
format_strings.h:53
format_tokent::length_modifierst::LEN_h
@ LEN_h
Definition
format_strings.h:51
format_tokent::length_modifierst::LEN_t
@ LEN_t
Definition
format_strings.h:57
format_tokent::length_modifierst::LEN_undef
@ LEN_undef
Definition
format_strings.h:50
format_tokent::length_modifierst::LEN_hh
@ LEN_hh
Definition
format_strings.h:52
format_tokent::length_modifierst::LEN_j
@ LEN_j
Definition
format_strings.h:56
format_tokent::length_modifierst::LEN_L
@ LEN_L
Definition
format_strings.h:55
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
Definition
format_strings.h:64
format_tokent::representationt::UNSIGNED_HEX
@ UNSIGNED_HEX
Definition
format_strings.h:66
format_tokent::representationt::UNSIGNED_OCT
@ UNSIGNED_OCT
Definition
format_strings.h:65
format_tokent::representationt::SIGNED_undef
@ SIGNED_undef
Definition
format_strings.h:62
format_tokent::representationt::SIGNED_DEC
@ SIGNED_DEC
Definition
format_strings.h:63
format_tokent::value
irep_idt value
Definition
format_strings.h:88
typet
The type of an expression, extends irept.
Definition
type.h:29
get_type
std::optional< typet > get_type(const format_tokent &)
Definition
format_strings.cpp:245
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
irep.h
mp_arith.h
mp_integer
BigInt mp_integer
Definition
smt_terms.h:17
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
ansi-c
goto-conversion
format_strings.h
Generated by
1.14.0