ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
yaml_parser.h
Go to the documentation of this file.
1#pragma once
2
4#include <string>
5#include <vector>
6#include <yaml-cpp/yaml.h>
7
9{
10public:
11 static std::vector<invariant> read_invariants(const std::string &path);
16 static std::vector<waypoint> &get_waypoints(const std::string &path);
19 static bool get_target_waypoint(const std::string &path, waypoint &out);
20
24 static void
25 fill_columns(const std::string &src_path, std::vector<waypoint> &waypoints);
26
27 // Reads the source file at `source_path` and returns a new source string
28 // with witness intrinsic calls inserted before each annotated line.
29 // `#line` directives after each injection refer to `original_path` so that
30 // Clang source locations point back to the real file.
31 static std::string build_injected_source(
32 const std::string &source_path,
33 const std::string &original_path,
34 const std::vector<invariant> &invariants);
35
36 // Reads the source file at `source_path` and returns a new source string
37 // with `__ESBMC_witness_assume` calls injected before each assumption
38 // waypoint line. Multiple assumptions at the same line are injected in
39 // order so that a stateful queue in symex can drain them correctly.
40 static std::string build_violation_witness_source(
41 const std::string &source_path,
42 const std::string &original_path,
43 const std::vector<waypoint> &waypoints);
44
45private:
46 static invariant parse_invariant(const YAML::Node &node);
47 static invariant::Type type_from_string(const std::string &s);
48
49 static waypoint parse_waypoint(const YAML::Node &node);
50 static waypoint::Type waypoint_type_from_string(const std::string &s);
51 static waypoint::Action action_from_string(const std::string &s);
52};
Definition witnesses.h:80
Type
Definition witnesses.h:83
Definition waypoint.h:11
Action
Definition waypoint.h:24
Type
Definition waypoint.h:14
Definition yaml_parser.h:9
static bool get_target_waypoint(const std::string &path, waypoint &out)
Returns true and sets out to the target waypoint if the witness has one; otherwise returns false.
Definition yaml_parser.cpp:220
static std::string build_injected_source(const std::string &source_path, const std::string &original_path, const std::vector< invariant > &invariants)
Definition yaml_parser.cpp:397
static std::string build_violation_witness_source(const std::string &source_path, const std::string &original_path, const std::vector< waypoint > &waypoints)
Definition yaml_parser.cpp:341
static void fill_columns(const std::string &src_path, std::vector< waypoint > &waypoints)
Fills in missing column numbers for waypoints that need it by scanning the source file at src_path.
Definition yaml_parser.cpp:229
static std::vector< invariant > read_invariants(const std::string &path)
Definition yaml_parser.cpp:7
static std::vector< waypoint > & get_waypoints(const std::string &path)
Returns a mutable reference into the shared parse cache for path.
Definition yaml_parser.cpp:154
Definition path.py:1