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 
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,
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  {
60  SIGNED_DEC,
64  };
65 
66  explicit format_tokent(token_typet _type)
67  : type(_type),
69  representation(representationt::SIGNED_undef)
70  { }
74  representation(representationt::SIGNED_undef)
75  { }
76 
77 
79  std::list<flag_typet> flags;
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 
92 
93 #endif // CPROVER_GOTO_PROGRAMS_FORMAT_STRINGS_H
The type of an expression.
Definition: type.h:22
BigInt mp_integer
Definition: mp_arith.h:22
format_tokent(token_typet _type)
format_token_listt parse_format_string(const std::string &)
irep_idt value
mp_integer precision
length_modifierst length_modifier
token_typet type
typet get_type(const format_tokent &)
std::list< flag_typet > flags
mp_integer field_width
std::list< format_tokent > format_token_listt
representationt representation