User Guide
nmodl::parser::CDriver Class Reference

Class that binds all pieces together for parsing C verbatim blocks. More...

Detailed Description

Class that binds all pieces together for parsing C verbatim blocks.

Definition at line 37 of file c11_driver.hpp.

#include <c11_driver.hpp>

Public Member Functions

 CDriver ()
 
 CDriver (bool strace, bool ptrace)
 
 ~CDriver ()
 
bool parse_stream (std::istream &in)
 parse c file provided as istream More...
 
bool parse_string (const std::string &input)
 parser c provided as string (used for testing) More...
 
bool parse_file (const std::string &filename)
 
void scan_string (const std::string &text)
 
void add_token (const std::string &)
 
void set_verbose (bool b) noexcept
 
bool is_verbose () const noexcept
 
bool is_typedef (const std::string &type) const noexcept
 
bool is_enum_constant (const std::string &constant) const noexcept
 
const std::vector< std::string > & all_tokens () const noexcept
 
bool has_token (const std::string &token) const noexcept
 

Static Public Member Functions

static void error (const std::string &m)
 
static void error (const std::string &m, const location &l)
 

Public Attributes

std::string streamname
 file or input stream name (used by scanner for position), see todo More...
 

Private Attributes

std::map< std::string, std::string > typedefs
 all typedefs More...
 
std::vector< std::string > enum_constants
 constants defined in enum More...
 
std::vector< std::string > tokens
 all tokens encountered More...
 
bool trace_scanner = false
 enable debug output in the flex scanner More...
 
bool trace_parser = false
 enable debug output in the bison parser More...
 
std::unique_ptr< CLexerlexer
 pointer to the lexer instance being used More...
 
std::unique_ptr< CParser > parser
 pointer to the parser instance being used More...
 
bool verbose = false
 print messages from lexer/parser More...
 

Constructor & Destructor Documentation

◆ CDriver() [1/2]

nmodl::parser::CDriver::CDriver ( )
default

◆ CDriver() [2/2]

nmodl::parser::CDriver::CDriver ( bool  strace,
bool  ptrace 
)

Definition at line 19 of file c11_driver.cpp.

◆ ~CDriver()

nmodl::parser::CDriver::~CDriver ( )
default

Member Function Documentation

◆ add_token()

void nmodl::parser::CDriver::add_token ( const std::string &  text)

Definition at line 56 of file c11_driver.cpp.

◆ all_tokens()

const std::vector<std::string>& nmodl::parser::CDriver::all_tokens ( ) const
inlinenoexcept

Definition at line 98 of file c11_driver.hpp.

◆ error() [1/2]

void nmodl::parser::CDriver::error ( const std::string &  m)
static

Definition at line 52 of file c11_driver.cpp.

◆ error() [2/2]

void nmodl::parser::CDriver::error ( const std::string &  m,
const location &  l 
)
static

Definition at line 61 of file c11_driver.cpp.

◆ has_token()

bool nmodl::parser::CDriver::has_token ( const std::string &  token) const
inlinenoexcept

Definition at line 102 of file c11_driver.hpp.

◆ is_enum_constant()

bool nmodl::parser::CDriver::is_enum_constant ( const std::string &  constant) const
inlinenoexcept

Definition at line 93 of file c11_driver.hpp.

◆ is_typedef()

bool nmodl::parser::CDriver::is_typedef ( const std::string &  type) const
inlinenoexcept

Definition at line 89 of file c11_driver.hpp.

◆ is_verbose()

bool nmodl::parser::CDriver::is_verbose ( ) const
inlinenoexcept

Definition at line 85 of file c11_driver.hpp.

◆ parse_file()

bool nmodl::parser::CDriver::parse_file ( const std::string &  filename)

Definition at line 36 of file c11_driver.cpp.

◆ parse_stream()

bool nmodl::parser::CDriver::parse_stream ( std::istream &  in)

parse c file provided as istream

Definition at line 26 of file c11_driver.cpp.

◆ parse_string()

bool nmodl::parser::CDriver::parse_string ( const std::string &  input)

parser c provided as string (used for testing)

Definition at line 47 of file c11_driver.cpp.

◆ scan_string()

void nmodl::parser::CDriver::scan_string ( const std::string &  text)

Definition at line 65 of file c11_driver.cpp.

◆ set_verbose()

void nmodl::parser::CDriver::set_verbose ( bool  b)
inlinenoexcept

Definition at line 81 of file c11_driver.hpp.

Member Data Documentation

◆ enum_constants

std::vector<std::string> nmodl::parser::CDriver::enum_constants
private

constants defined in enum

Definition at line 43 of file c11_driver.hpp.

◆ lexer

std::unique_ptr<CLexer> nmodl::parser::CDriver::lexer
private

pointer to the lexer instance being used

Definition at line 55 of file c11_driver.hpp.

◆ parser

std::unique_ptr<CParser> nmodl::parser::CDriver::parser
private

pointer to the parser instance being used

Definition at line 58 of file c11_driver.hpp.

◆ streamname

std::string nmodl::parser::CDriver::streamname

file or input stream name (used by scanner for position), see todo

Definition at line 65 of file c11_driver.hpp.

◆ tokens

std::vector<std::string> nmodl::parser::CDriver::tokens
private

all tokens encountered

Definition at line 46 of file c11_driver.hpp.

◆ trace_parser

bool nmodl::parser::CDriver::trace_parser = false
private

enable debug output in the bison parser

Definition at line 52 of file c11_driver.hpp.

◆ trace_scanner

bool nmodl::parser::CDriver::trace_scanner = false
private

enable debug output in the flex scanner

Definition at line 49 of file c11_driver.hpp.

◆ typedefs

std::map<std::string, std::string> nmodl::parser::CDriver::typedefs
private

all typedefs

Definition at line 40 of file c11_driver.hpp.

◆ verbose

bool nmodl::parser::CDriver::verbose = false
private

print messages from lexer/parser

Definition at line 61 of file c11_driver.hpp.


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