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

Internal helper class for parsing cQASM file versions. More...

Public Member Functions

virtual ~ParseHelper ()
 Destroys the parse helper. More...
 

Static Public Member Functions

static 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...
 
Version version
 The parse result. More...
 

Friends

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

Detailed Description

Internal helper class for parsing cQASM file versions.

Definition at line 78 of file cqasm-version.hpp.

#include <cqasm-version.hpp>

Collaboration diagram for cqasm::version::ParseHelper:
Collaboration graph
[legend]

Constructor & Destructor Documentation

◆ ~ParseHelper()

cqasm::version::ParseHelper::~ParseHelper ( )
virtual

Destroys the parse helper.

Destroys the analyzer.

Definition at line 203 of file cqasm-version.cpp.

Member Function Documentation

◆ push_error()

void cqasm::version::ParseHelper::push_error ( const std::string &  error)
static

Pushes an error.

Definition at line 218 of file cqasm-version.cpp.

Friends And Related Function Documentation

◆ parse_file [1/2]

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

Parse the given file.

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]

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

Parse using the given file pointer.

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

Version 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.

Parse the given string.

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::version::ParseHelper::fptr = nullptr

File pointer being scanned, if no data was specified.

Definition at line 84 of file cqasm-version.hpp.

◆ buf

void* cqasm::version::ParseHelper::buf = nullptr

Flex data buffer, if data was specified.

Definition at line 89 of file cqasm-version.hpp.

◆ scanner

void* cqasm::version::ParseHelper::scanner = nullptr

Flex reentrant scanner data.

Definition at line 94 of file cqasm-version.hpp.

◆ filename

std::string cqasm::version::ParseHelper::filename

Name of the file being parsed.

Definition at line 99 of file cqasm-version.hpp.

◆ version

Version cqasm::version::ParseHelper::version

The parse result.

Definition at line 104 of file cqasm-version.hpp.


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