cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
lispexpr.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
// THIS HEADER IS DEPRECATED (since 2015-06-30) AND WILL GO AWAY
10
11
#ifndef CPROVER_UTIL_LISPEXPR_H
12
#define CPROVER_UTIL_LISPEXPR_H
13
14
#if defined(_WIN32) && !defined(__MINGW32__)
15
#include <cstring>
16
#define strcasecmp _strcmpi
17
#else
18
#include <strings.h>
19
#endif
20
21
#include <string>
22
#include <vector>
23
#include <iosfwd>
24
25
class
lispsymbolt
:
public
std::string
26
{
27
public
:
28
// NOLINTNEXTLINE(runtime/explicit)
29
lispsymbolt
(
const
char
*a):
std
::string(a)
30
{
31
}
32
33
lispsymbolt
():
std
::string()
34
{
35
}
36
37
// NOLINTNEXTLINE(runtime/explicit)
38
lispsymbolt
(
const
std::string &a):
std
::string(a)
39
{
40
}
41
42
bool
operator==
(
const
lispsymbolt
&b)
const
43
{
return
strcasecmp(c_str(), b.c_str())==0; }
44
45
bool
operator!=
(
const
lispsymbolt
&b)
const
46
{
return
strcasecmp(c_str(), b.c_str())!=0; }
47
48
bool
operator==
(
const
char
*b)
const
49
{
return
strcasecmp(c_str(), b)==0; }
50
51
bool
operator!=
(
const
char
*b)
const
52
{
return
strcasecmp(c_str(), b)!=0; }
53
};
54
55
inline
bool
operator==
(
const
char
*a,
const
lispsymbolt
&b)
56
{
return
strcasecmp(a, b.c_str())==0; }
57
58
inline
bool
operator!=
(
const
char
*a,
const
lispsymbolt
&b)
59
{
return
strcasecmp(a, b.c_str())!=0; }
60
61
inline
bool
operator==
(
const
lispsymbolt
&a,
const
std::string &b)
62
{
return
strcasecmp(a.c_str(), b.c_str())==0; }
63
64
inline
bool
operator!=
(
const
lispsymbolt
&a,
const
std::string &b)
65
{
return
strcasecmp(a.c_str(), b.c_str())!=0; }
66
67
inline
bool
operator==
(
const
std::string &a,
const
lispsymbolt
&b)
68
{
return
strcasecmp(a.c_str(), b.c_str())==0; }
69
70
inline
bool
operator!=
(
const
std::string &a,
const
lispsymbolt
&b)
71
{
return
strcasecmp(a.c_str(), b.c_str())!=0; }
72
73
class
lispexprt
:
public
std::vector<lispexprt>
74
{
75
public
:
76
enum
{
String
,
Symbol
,
Number
,
List
}
type
;
77
lispsymbolt
value
;
78
std::string
expr2string
()
const
;
79
bool
parse
(
const
std::string &s);
80
bool
is_nil
()
const
81
{
return
type
==
Symbol
&&
value
==
"nil"
; }
82
83
void
make_nil
()
84
{
85
clear();
86
type
=
Symbol
;
87
value
=
"nil"
;
88
}
89
90
protected
:
91
bool
parse
(
const
std::string &s, std::string::size_type &ptr);
92
};
93
94
inline
std::ostream &
operator<<
(
95
std::ostream &out,
96
const
lispexprt
&expr)
97
{
98
return
out << expr.
expr2string
();
99
}
100
101
int
test_lispexpr
();
102
103
#endif
// CPROVER_UTIL_LISPEXPR_H
lispexprt
Definition
lispexpr.h:74
lispexprt::value
lispsymbolt value
Definition
lispexpr.h:77
lispexprt::make_nil
void make_nil()
Definition
lispexpr.h:83
lispexprt::is_nil
bool is_nil() const
Definition
lispexpr.h:80
lispexprt::type
enum lispexprt::@241113047332130242052373076371317162003003255220 type
lispexprt::expr2string
std::string expr2string() const
Definition
lispexpr.cpp:15
lispexprt::parse
bool parse(const std::string &s)
Definition
lispexpr.cpp:54
lispexprt::List
@ List
Definition
lispexpr.h:76
lispexprt::Number
@ Number
Definition
lispexpr.h:76
lispexprt::String
@ String
Definition
lispexpr.h:76
lispexprt::Symbol
@ Symbol
Definition
lispexpr.h:76
lispsymbolt
Definition
lispexpr.h:26
lispsymbolt::lispsymbolt
lispsymbolt()
Definition
lispexpr.h:33
lispsymbolt::operator!=
bool operator!=(const lispsymbolt &b) const
Definition
lispexpr.h:45
lispsymbolt::operator==
bool operator==(const lispsymbolt &b) const
Definition
lispexpr.h:42
lispsymbolt::lispsymbolt
lispsymbolt(const char *a)
Definition
lispexpr.h:29
lispsymbolt::lispsymbolt
lispsymbolt(const std::string &a)
Definition
lispexpr.h:38
test_lispexpr
int test_lispexpr()
Definition
lispexpr.cpp:152
operator!=
bool operator!=(const char *a, const lispsymbolt &b)
Definition
lispexpr.h:58
operator<<
std::ostream & operator<<(std::ostream &out, const lispexprt &expr)
Definition
lispexpr.h:94
operator==
bool operator==(const char *a, const lispsymbolt &b)
Definition
lispexpr.h:55
std
STL namespace.
util
lispexpr.h
Generated by
1.17.0