genericRagelLemonDriver Class Reference

Generic interface code for Ragel/Lemon combination Subclasses should implement one or more process() methods. More...

Inheritance diagram for genericRagelLemonDriver:
[legend]

Public Types

typedef size_t location_type
 Type for linear addressing within parse content. More...
 

Public Member Functions

 genericRagelLemonDriver ()
 Construct null. More...
 
 genericRagelLemonDriver (const genericRagelLemonDriver &rhs)=default
 Copy construct. More...
 
 genericRagelLemonDriver (genericRagelLemonDriver &&rhs)=default
 Move construct. More...
 
virtual ~genericRagelLemonDriver ()=default
 Destructor. More...
 
void clear ()
 Reset references. More...
 
const std::string & content () const
 Get reference to the input buffer content. More...
 
void content (const std::string &s, size_t pos=0, size_t len=std::string::npos)
 
std::string::const_iterator cbegin () const
 Iterator to begin of content (sub)string. More...
 
std::string::const_iterator cend () const
 Iterator to end of content (sub)string. More...
 
size_t parsePosition () const
 The relative parse position with the content (sub)string. More...
 
size_t & parsePosition ()
 The relative parse position with the content (sub)string. More...
 
OstreamprintBuffer (Ostream &os) const
 Output the input buffer string content. More...
 
void reportFatal (const std::string &msg) const
 Report FatalError. More...
 
void reportFatal (const std::string &msg, size_t pos) const
 Report FatalError at parser position. More...
 

Protected Attributes

std::reference_wrapper< const std::string > content_
 Reference to the input string. More...
 
size_t start_
 Start position within input string. More...
 
size_t length_
 Length of input (sub)string. More...
 
size_t position_
 The last known parser position. More...
 

Detailed Description

Generic interface code for Ragel/Lemon combination Subclasses should implement one or more process() methods.

The scanner will often be implemented as localized lexer class. The parser may be embedded into the scanner as file-scope, or use a separate interface class.

Source files

Definition at line 59 of file genericRagelLemonDriver.H.

Member Typedef Documentation

◆ location_type

typedef size_t location_type

Type for linear addressing within parse content.

Naming as per bison

Definition at line 84 of file genericRagelLemonDriver.H.

Constructor & Destructor Documentation

◆ genericRagelLemonDriver() [1/3]

Construct null.

Definition at line 34 of file genericRagelLemonDriver.C.

◆ genericRagelLemonDriver() [2/3]

Copy construct.

◆ genericRagelLemonDriver() [3/3]

Move construct.

◆ ~genericRagelLemonDriver()

virtual ~genericRagelLemonDriver ( )
virtualdefault

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Reset references.

Definition at line 45 of file genericRagelLemonDriver.C.

◆ content() [1/2]

const std::string & content ( ) const
inline

Get reference to the input buffer content.

Definition at line 109 of file genericRagelLemonDriver.H.

References genericRagelLemonDriver::content_.

◆ content() [2/2]

void content ( const std::string &  s,
size_t  pos = 0,
size_t  len = std::string::npos 
)

Set reference to the input buffer content, which acts like a std::string_view

Definition at line 54 of file genericRagelLemonDriver.C.

References Foam::pos(), and s().

Here is the call graph for this function:

◆ cbegin()

std::string::const_iterator cbegin ( ) const

Iterator to begin of content (sub)string.

Definition at line 69 of file genericRagelLemonDriver.C.

References s().

Here is the call graph for this function:

◆ cend()

std::string::const_iterator cend ( ) const

Iterator to end of content (sub)string.

Definition at line 83 of file genericRagelLemonDriver.C.

References s().

Here is the call graph for this function:

◆ parsePosition() [1/2]

size_t parsePosition ( ) const
inline

The relative parse position with the content (sub)string.

Definition at line 130 of file genericRagelLemonDriver.H.

References genericRagelLemonDriver::position_.

◆ parsePosition() [2/2]

size_t & parsePosition ( )
inline

The relative parse position with the content (sub)string.

Definition at line 136 of file genericRagelLemonDriver.H.

References genericRagelLemonDriver::position_.

◆ printBuffer()

Foam::Ostream & printBuffer ( Ostream os) const

Output the input buffer string content.

Definition at line 103 of file genericRagelLemonDriver.C.

References os().

Here is the call graph for this function:

◆ reportFatal() [1/2]

void reportFatal ( const std::string &  msg) const

Report FatalError.

Definition at line 131 of file genericRagelLemonDriver.C.

References Foam::exit(), Foam::FatalIOError, FUNCTION_NAME, Foam::nl, and os().

Here is the call graph for this function:

◆ reportFatal() [2/2]

void reportFatal ( const std::string &  msg,
size_t  pos 
) const

Report FatalError at parser position.

Definition at line 160 of file genericRagelLemonDriver.C.

References Foam::exit(), Foam::FatalIOError, FUNCTION_NAME, Foam::nl, os(), and Foam::pos().

Here is the call graph for this function:

Member Data Documentation

◆ content_

std::reference_wrapper<const std::string> content_
protected

Reference to the input string.

Definition at line 66 of file genericRagelLemonDriver.H.

Referenced by genericRagelLemonDriver::content().

◆ start_

size_t start_
protected

Start position within input string.

Definition at line 69 of file genericRagelLemonDriver.H.

◆ length_

size_t length_
protected

Length of input (sub)string.

Definition at line 72 of file genericRagelLemonDriver.H.

◆ position_

size_t position_
protected

The last known parser position.

Definition at line 75 of file genericRagelLemonDriver.H.

Referenced by genericRagelLemonDriver::parsePosition().


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