1/*******************************************************************\
3Module: Parser utilities
5Author: Daniel Kroening, kroening@kroening.com
7\*******************************************************************/
12#ifndef CPROVER_UTIL_PARSER_H
13#define CPROVER_UTIL_PARSER_H
44 // The following are for the benefit of the scanner
70 const std::string &message,
71 const std::string &before);
88 std::filesystem::current_path().
string());
113 // Only set line number when needed, as this destroys sharing.
118 // for the case of a file with no newlines
157 #define newstack(x) _newstack(PARSER, (x))
159 #define parser_stack(x) (PARSER.stack[x])
160 #define stack_expr(x) (PARSER.stack[x])
161 #define stack_type(x) \
162 (static_cast<typet &>(static_cast<irept &>(PARSER.stack[x])))
164 #define YY_INPUT(buf, result, max_size) \
166 for(result=0; result<max_size;) \
169 if(!PARSER.read(ch)) /* NOLINT(readability/braces) */ \
176 if(ch!='\r') /* NOLINT(readability/braces) */ \
179 if(ch=='\n') /* NOLINT(readability/braces) */ \
181 PARSER.inc_line_no(); \
188// The following tracks the column of the token, and is nicely explained here:
189// http://oreilly.com/linux/excerpts/9780596155971/error-reporting-recovery.html
191 #define YY_USER_ACTION PARSER.advance_column(yyleng);
193#endif // CPROVER_UTIL_PARSER_H
virtual void clear()
Reset the abstract state.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
source_locationt & add_source_location()
Class that provides messages with a built-in verbosity 'level'.
void advance_column(unsigned token_width)
parsert(message_handlert &message_handler)
void set_column(unsigned _column)
const source_locationt & source_location()
void set_file(const irep_idt &file)
unsigned get_line_no() const
void set_source_location(exprt &e)
unsigned previous_line_no
void parse_error(const std::string &message, const std::string &before)
source_locationt _source_location
irep_idt get_file() const
std::vector< exprt > stack
void set_line_no(unsigned _line_no)
unsigned get_column() const
void set_function(const irep_idt &function)
void set_working_directory(const irep_idt &cwd)
const irep_idt & get_file() const
void set_file(const irep_idt &file)
void set_line(const irep_idt &line)
void set_function(const irep_idt &function)
exprt & _newstack(parsert &parser, unsigned &x)