Loading...
Searching...
No Matches
genericRagelLemonDriver Class Reference

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

#include <genericRagelLemonDriver.H>

Inheritance diagram for genericRagelLemonDriver:

Public Types

typedef size_t location_type
 Type for linear addressing within parse content.

Public Member Functions

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

Protected Attributes

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

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 55 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 91 of file genericRagelLemonDriver.H.

Constructor & Destructor Documentation

◆ genericRagelLemonDriver() [1/3]

◆ genericRagelLemonDriver() [2/3]

genericRagelLemonDriver ( const genericRagelLemonDriver & rhs)
default

Copy construct.

References genericRagelLemonDriver(), and Foam::rhs().

Here is the call graph for this function:

◆ genericRagelLemonDriver() [3/3]

genericRagelLemonDriver ( genericRagelLemonDriver && rhs)
default

Move construct.

References genericRagelLemonDriver(), and Foam::rhs().

Here is the call graph for this function:

◆ ~genericRagelLemonDriver()

virtual ~genericRagelLemonDriver ( )
virtualdefault

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Reset references.

Definition at line 38 of file genericRagelLemonDriver.C.

References content_, length_, string::null, position_, and start_.

◆ content() [1/2]

const std::string & content ( ) const
inline

Get reference to the input buffer content.

Definition at line 128 of file genericRagelLemonDriver.H.

References 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 47 of file genericRagelLemonDriver.C.

References content_, length_, Foam::pos(), position_, s(), and start_.

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 62 of file genericRagelLemonDriver.C.

References content_, s(), and start_.

Referenced by printBuffer(), and reportFatal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cend()

std::string::const_iterator cend ( ) const

Iterator to end of content (sub)string.

Definition at line 76 of file genericRagelLemonDriver.C.

References content_, length_, s(), and start_.

Referenced by printBuffer(), and reportFatal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parsePosition() [1/2]

size_t parsePosition ( ) const
inline

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

Definition at line 157 of file genericRagelLemonDriver.H.

References position_.

◆ parsePosition() [2/2]

size_t & parsePosition ( )
inline

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

Definition at line 165 of file genericRagelLemonDriver.H.

References position_.

◆ printBuffer()

Foam::Ostream & printBuffer ( Ostream & os) const

Output the input buffer string content.

Definition at line 96 of file genericRagelLemonDriver.C.

References cbegin(), cend(), and os().

Referenced by reportFatal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reportFatal() [1/2]

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

Report FatalError.

Definition at line 124 of file genericRagelLemonDriver.C.

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

Referenced by reportFatal().

Here is the call graph for this function:
Here is the caller 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 153 of file genericRagelLemonDriver.C.

References cbegin(), cend(), 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 64 of file genericRagelLemonDriver.H.

Referenced by cbegin(), cend(), clear(), content(), content(), and genericRagelLemonDriver().

◆ start_

size_t start_
protected

Start position within input string.

Definition at line 69 of file genericRagelLemonDriver.H.

Referenced by cbegin(), cend(), clear(), content(), and genericRagelLemonDriver().

◆ length_

size_t length_
protected

Length of input (sub)string.

Definition at line 74 of file genericRagelLemonDriver.H.

Referenced by cend(), clear(), content(), and genericRagelLemonDriver().

◆ position_

size_t position_
protected

The last known parser position.

Definition at line 79 of file genericRagelLemonDriver.H.

Referenced by clear(), content(), genericRagelLemonDriver(), parsePosition(), parsePosition(), and reportFatal().


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