CBMC
parser.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
10
#include "
parser.h
"
11
12
#ifdef _WIN32
13
int
isatty(
int
)
14
{
15
return
0;
16
}
17
#endif
18
19
exprt
&
_newstack
(
parsert
&parser,
unsigned
&x)
20
{
21
x=(unsigned)parser.
stack
.size();
22
23
if
(x>=parser.
stack
.capacity())
24
parser.
stack
.reserve(x*2);
25
26
parser.
stack
.push_back(
static_cast<
const
exprt
&
>
(
get_nil_irep
()));
27
return
parser.
stack
.back();
28
}
29
30
void
parsert::parse_error
(
31
const
std::string &message,
32
const
std::string &before)
33
{
34
std::string tmp=message;
35
if
(!before.empty())
36
tmp +=
" before '"
+ before +
"'"
;
37
38
#if 0
39
source_locationt
tmp_source_location=
source_location
;
40
tmp_source_location.
set_column
(
column
-before.size());
41
print(1, tmp, -1, tmp_source_location);
42
#else
43
error
().
source_location
=
source_location
;
44
error
() << tmp <<
eom
;
45
#endif
46
}
parsert::source_location
source_locationt source_location
Definition:
parser.h:135
parsert::column
unsigned column
Definition:
parser.h:137
exprt
Base class for all expressions.
Definition:
expr.h:55
messaget::eom
static eomt eom
Definition:
message.h:297
source_locationt::set_column
void set_column(const irep_idt &column)
Definition:
source_location.h:110
messaget::error
mstreamt & error() const
Definition:
message.h:399
messaget::mstreamt::source_location
source_locationt source_location
Definition:
message.h:247
_newstack
exprt & _newstack(parsert &parser, unsigned &x)
Definition:
parser.cpp:19
parsert::stack
std::vector< exprt > stack
Definition:
parser.h:30
parsert
Definition:
parser.h:23
parsert::parse_error
void parse_error(const std::string &message, const std::string &before)
Definition:
parser.cpp:30
source_locationt
Definition:
source_location.h:18
parser.h
get_nil_irep
const irept & get_nil_irep()
Definition:
irep.cpp:20
src
util
parser.cpp
Generated by
1.8.17