libqasm
library for handling cQASM files
Public Member Functions | Public Attributes | Friends | List of all members
cqasm::v1::parser::ParseHelper Class Reference

Internal helper class for parsing cQASM files. More...

Public Member Functions

virtual ~ParseHelper ()
 Destroys the parse helper. More...
 
void push_error (const std::string &error)
 Pushes an error. More...
 

Public Attributes

FILE * fptr = nullptr
 File pointer being scanned, if no data was specified. More...
 
void * buf = nullptr
 Flex data buffer, if data was specified. More...
 
void * scanner = nullptr
 Flex reentrant scanner data. More...
 
std::string filename
 Name of the file being parsed. More...
 
ParseResult result
 The parse result. More...
 

Friends

ParseResult parse_file (const std::string &filename)
 Parse the given file. More...
 
ParseResult parse_file (FILE *file, const std::string &filename)
 Parse using the given file pointer. More...
 
ParseResult parse_string (const std::string &data, const std::string &filename)
 Parse the given string. More...
 

Detailed Description

Internal helper class for parsing cQASM files.

Definition at line 65 of file cqasm-v1-parse-helper.hpp.

#include <cqasm-v1-parse-helper.hpp>

Collaboration diagram for cqasm::v1::parser::ParseHelper:
Collaboration graph
[legend]

Constructor & Destructor Documentation

◆ ~ParseHelper()

cqasm::v1::parser::ParseHelper::~ParseHelper ( )
virtual

Destroys the parse helper.

Destroys the analyzer.

Definition at line 130 of file cqasm-v1-parse-helper.cpp.

Member Function Documentation

◆ push_error()

void cqasm::v1::parser::ParseHelper::push_error ( const std::string &  error)

Pushes an error.

Definition at line 145 of file cqasm-v1-parse-helper.cpp.

Friends And Related Function Documentation

◆ parse_file [1/2]

ParseResult parse_file ( const std::string &  filename)
friend

Parse the given file.

Throws an AnalysisError if this fails.

Definition at line 16 of file cqasm-v1-parse-helper.cpp.

◆ parse_file [2/2]

ParseResult parse_file ( FILE *  file,
const std::string &  filename 
)
friend

Parse using the given file pointer.

Throws an AnalysisError if this fails. The file is rewound back to the start when parsing completes.

Definition at line 23 of file cqasm-v1-parse-helper.cpp.

◆ parse_string

ParseResult parse_string ( const std::string &  data,
const std::string &  filename 
)
friend

Parse the given string.

A filename may be given in addition for use within error messages.

A filename may be given in addition for use within the AnalysisError thrown when version parsing fails.

Definition at line 31 of file cqasm-v1-parse-helper.cpp.

Member Data Documentation

◆ fptr

FILE* cqasm::v1::parser::ParseHelper::fptr = nullptr

File pointer being scanned, if no data was specified.

Definition at line 71 of file cqasm-v1-parse-helper.hpp.

◆ buf

void* cqasm::v1::parser::ParseHelper::buf = nullptr

Flex data buffer, if data was specified.

Definition at line 76 of file cqasm-v1-parse-helper.hpp.

◆ scanner

void* cqasm::v1::parser::ParseHelper::scanner = nullptr

Flex reentrant scanner data.

Definition at line 81 of file cqasm-v1-parse-helper.hpp.

◆ filename

std::string cqasm::v1::parser::ParseHelper::filename

Name of the file being parsed.

Definition at line 86 of file cqasm-v1-parse-helper.hpp.

◆ result

ParseResult cqasm::v1::parser::ParseHelper::result

The parse result.

Definition at line 91 of file cqasm-v1-parse-helper.hpp.


The documentation for this class was generated from the following files: