cprover
Loading...
Searching...
No Matches
parser.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#include "parser.h"
11
12#ifdef _WIN32
13int isatty(int)
14{
15 return 0;
16}
17#endif
18
19exprt &_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
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
44 error() << tmp << eom;
45#endif
46}
Base class for all expressions.
Definition expr.h:54
source_locationt source_location
Definition message.h:247
mstreamt & error() const
Definition message.h:399
static eomt eom
Definition message.h:297
source_locationt source_location
Definition parser.h:135
unsigned column
Definition parser.h:137
void parse_error(const std::string &message, const std::string &before)
Definition parser.cpp:30
std::vector< exprt > stack
Definition parser.h:30
void set_column(const irep_idt &column)
const irept & get_nil_irep()
Definition irep.cpp:20
exprt & _newstack(parsert &parser, unsigned &x)
Definition parser.cpp:19
Parser utilities.