cprover
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/expr.h
>
19
#include <
util/mp_arith.h
>
20
21
class
format_tokent
22
{
23
public
:
24
enum class
token_typet
25
{
26
UNKNOWN
,
27
TEXT
,
28
INT
,
// d, i, o, u, x
29
FLOAT
,
// a, e, f, g
30
CHAR
,
// c
31
STRING
,
// s
32
POINTER
// p
33
};
34
35
enum class
flag_typet
36
{
37
ALTERNATE
,
38
ZERO_PAD
,
39
LEFT_ADJUST
,
40
SIGNED_SPACE
,
41
SIGN
,
42
ASTERISK
43
};
44
45
enum class
length_modifierst
46
{
47
LEN_undef
,
48
LEN_h
,
49
LEN_hh
,
50
LEN_l
,
51
LEN_ll
,
52
LEN_L
,
53
LEN_j
,
54
LEN_t
55
};
56
57
enum class
representationt
58
{
59
SIGNED_undef
,
60
SIGNED_DEC
,
61
UNSIGNED_DEC
,
62
UNSIGNED_OCT
,
63
UNSIGNED_HEX
64
};
65
66
explicit
format_tokent
(
token_typet
_type)
67
:
type
(_type),
68
length_modifier
(
length_modifierst
::LEN_undef),
69
representation
(
representationt
::SIGNED_undef)
70
{ }
71
format_tokent
():
72
type
(
token_typet
::
UNKNOWN
),
73
length_modifier
(
length_modifierst
::LEN_undef),
74
representation
(
representationt
::SIGNED_undef)
75
{ }
76
77
78
token_typet
type
;
79
std::list<flag_typet>
flags
;
80
mp_integer
field_width
;
81
mp_integer
precision
;
82
length_modifierst
length_modifier
;
83
representationt
representation
;
84
irep_idt
value
;
// for text and pattern matching
85
};
86
87
typedef
std::list<format_tokent>
format_token_listt
;
88
89
format_token_listt
parse_format_string
(
const
std::string &);
90
91
optionalt<typet>
get_type
(
const
format_tokent
&);
92
93
#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:37
format_tokent::representationt::SIGNED_undef
@ SIGNED_undef
format_tokent::token_typet
token_typet
Definition:
format_strings.h:25
mp_arith.h
format_tokent::value
irep_idt value
Definition:
format_strings.h:84
format_tokent::token_typet::STRING
@ STRING
format_tokent::representationt::UNSIGNED_OCT
@ UNSIGNED_OCT
mp_integer
BigInt mp_integer
Definition:
mp_arith.h:19
format_tokent::representationt
representationt
Definition:
format_strings.h:58
format_tokent::precision
mp_integer precision
Definition:
format_strings.h:81
format_tokent::length_modifierst::LEN_undef
@ LEN_undef
format_tokent::field_width
mp_integer field_width
Definition:
format_strings.h:80
format_tokent::length_modifier
length_modifierst length_modifier
Definition:
format_strings.h:82
format_tokent::format_tokent
format_tokent(token_typet _type)
Definition:
format_strings.h:66
format_tokent::length_modifierst::LEN_h
@ LEN_h
format_tokent::representationt::SIGNED_DEC
@ SIGNED_DEC
expr.h
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:87
format_tokent::length_modifierst::LEN_hh
@ LEN_hh
file_typet::UNKNOWN
@ UNKNOWN
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:79
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:71
format_tokent::flag_typet::SIGN
@ SIGN
get_type
optionalt< typet > get_type(const format_tokent &)
Definition:
format_strings.cpp:229
format_tokent::length_modifierst
length_modifierst
Definition:
format_strings.h:46
parse_format_string
format_token_listt parse_format_string(const std::string &)
Definition:
format_strings.cpp:187
format_tokent::flag_typet
flag_typet
Definition:
format_strings.h:36
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:78
format_tokent::representation
representationt representation
Definition:
format_strings.h:83
format_tokent
Definition:
format_strings.h:22
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
format_tokent::length_modifierst::LEN_ll
@ LEN_ll
goto-programs
format_strings.h
Generated by
1.8.20