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 <string>
16
#include <list>
17
18
#include <
util/irep.h
>
19
#include <
util/mp_arith.h
>
20
#include <
util/optional.h
>
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
format_tokent
():
75
type
(
token_typet
::
UNKNOWN
),
76
length_modifier
(
length_modifierst
::LEN_undef),
77
representation
(
representationt
::SIGNED_undef)
78
{ }
79
80
81
token_typet
type
;
82
std::list<flag_typet>
flags
;
83
mp_integer
field_width
;
84
mp_integer
precision
;
85
length_modifierst
length_modifier
;
86
representationt
representation
;
87
irep_idt
value
;
// for text and pattern matching
88
};
89
90
typedef
std::list<format_tokent>
format_token_listt
;
91
92
format_token_listt
parse_format_string
(
const
std::string &);
93
94
optionalt<typet>
get_type
(
const
format_tokent
&);
95
96
#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:36
ai_verifier_statust::UNKNOWN
@ UNKNOWN
mp_integer
BigInt mp_integer
Definition:
smt_terms.h:17
format_tokent::representationt::SIGNED_undef
@ SIGNED_undef
format_tokent::token_typet
token_typet
Definition:
format_strings.h:27
mp_arith.h
format_tokent::value
irep_idt value
Definition:
format_strings.h:87
format_tokent::token_typet::STRING
@ STRING
typet
The type of an expression, extends irept.
Definition:
type.h:28
format_tokent::representationt::UNSIGNED_OCT
@ UNSIGNED_OCT
optional.h
format_tokent::representationt
representationt
Definition:
format_strings.h:60
format_tokent::precision
mp_integer precision
Definition:
format_strings.h:84
format_tokent::length_modifierst::LEN_undef
@ LEN_undef
format_tokent::field_width
mp_integer field_width
Definition:
format_strings.h:83
format_tokent::length_modifier
length_modifierst length_modifier
Definition:
format_strings.h:85
format_tokent::format_tokent
format_tokent(token_typet _type)
Definition:
format_strings.h:69
format_tokent::length_modifierst::LEN_h
@ LEN_h
format_tokent::representationt::SIGNED_DEC
@ SIGNED_DEC
format_tokent::token_typet::POINTER
@ POINTER
format_tokent::representationt::UNSIGNED_DEC
@ UNSIGNED_DEC
format_token_listt
std::list< format_tokent > format_token_listt
Definition:
format_strings.h:90
format_tokent::length_modifierst::LEN_hh
@ LEN_hh
format_tokent::token_typet::INT
@ INT
format_tokent::length_modifierst::LEN_t
@ LEN_t
format_tokent::flag_typet::ZERO_PAD
@ ZERO_PAD
format_tokent::flags
std::list< flag_typet > flags
Definition:
format_strings.h:82
format_tokent::flag_typet::LEFT_ADJUST
@ LEFT_ADJUST
format_tokent::representationt::UNSIGNED_HEX
@ UNSIGNED_HEX
format_tokent::length_modifierst::LEN_L
@ LEN_L
format_tokent::length_modifierst::LEN_j
@ LEN_j
format_tokent::flag_typet::ALTERNATE
@ ALTERNATE
optionalt
nonstd::optional< T > optionalt
Definition:
optional.h:35
format_tokent::format_tokent
format_tokent()
Definition:
format_strings.h:74
format_tokent::flag_typet::SIGN
@ SIGN
get_type
optionalt< typet > get_type(const format_tokent &)
Definition:
format_strings.cpp:228
format_tokent::length_modifierst
length_modifierst
Definition:
format_strings.h:48
parse_format_string
format_token_listt parse_format_string(const std::string &)
Definition:
format_strings.cpp:186
format_tokent::flag_typet
flag_typet
Definition:
format_strings.h:38
format_tokent::token_typet::CHAR
@ CHAR
format_tokent::token_typet::UNKNOWN
@ UNKNOWN
format_tokent::length_modifierst::LEN_l
@ LEN_l
format_tokent::type
token_typet type
Definition:
format_strings.h:81
format_tokent::representation
representationt representation
Definition:
format_strings.h:86
format_tokent
Definition:
format_strings.h:24
format_tokent::token_typet::FLOAT
@ FLOAT
format_tokent::token_typet::TEXT
@ TEXT
format_tokent::flag_typet::SIGNED_SPACE
@ SIGNED_SPACE
format_tokent::flag_typet::ASTERISK
@ ASTERISK
irep.h
format_tokent::length_modifierst::LEN_ll
@ LEN_ll
src
goto-programs
format_strings.h
Generated by
1.8.17