20 if (without_defaults) {
21 a = std::unique_ptr<v1::analyzer::Analyzer>(
22 new v1::analyzer::Analyzer(max_version)
24 a->register_default_functions_and_mappings();
26 a = std::unique_ptr<v1::analyzer::Analyzer>(
37 const std::string &name,
38 const std::string ¶m_types,
39 bool allow_conditional,
41 bool allow_reused_qubits,
42 bool allow_different_index_sizes
44 a->register_instruction(
50 allow_different_index_sizes
59 const std::string &name,
60 const std::string ¶m_types
62 a->register_error_model(name, param_types);
72 const std::string &filename
75 std::vector<std::string> retval{
""};
76 if (result.errors.empty()) {
79 retval.insert(retval.end(), result.errors.begin(), result.errors.end());
88 const std::string &data,
89 const std::string &filename
92 std::vector<std::string> retval{
""};
93 if (result.errors.empty()) {
96 retval.insert(retval.end(), result.errors.begin(), result.errors.end());
109 const std::string &filename
111 auto result = a->analyze(filename);
112 std::vector<std::string> retval{
""};
113 if (result.errors.empty()) {
116 retval.insert(retval.end(), result.errors.begin(), result.errors.end());
125 const std::string &data,
126 const std::string &filename
128 auto result = a->analyze_string(data, filename);
129 std::vector<std::string> retval{
""};
130 if (result.errors.empty()) {
133 retval.insert(retval.end(), result.errors.begin(), result.errors.end());
analyzer::Analyzer default_analyzer(const std::string &api_version)
Constructs an Analyzer object with the defaults for cQASM 1.0 already loaded into it...
std::vector< std::string > analyze_string(const std::string &data, const std::string &filename="<unknown>") const
Same as analyze_file(), but instead receives the file contents directly.
std::vector< std::string > analyze_file(const std::string &filename) const
Parses and analyzes the given file.
void serialize(const error_model::ErrorModelRef &obj, ::tree::cbor::MapWriter &map)
Defines SWIG'd things for the Python interface.
Main include file for parsing v1 files.
Namespace for the "new" cQASM 1.x API.
static std::vector< std::string > parse_string(const std::string &data, const std::string &filename="<unknown>")
Same as parse_file(), but instead receives the file contents directly.
static std::vector< std::string > parse_file(const std::string &filename)
Only parses the given file.
void register_instruction(const std::string &name, const std::string ¶m_types="", bool allow_conditional=true, bool allow_parallel=true, bool allow_reused_qubits=false, bool allow_different_index_sizes=false)
Registers an instruction type.
void register_error_model(const std::string &name, const std::string ¶m_types="")
Registers an error model.
ParseResult parse_string(const std::string &data, const std::string &filename)
Parse the given string.
V1Analyzer(const std::string &max_version="1.0", bool without_defaults=false)
Creates a new 1.x semantic analyzer.
ParseResult parse_file(const std::string &filename)
Parse the given file.