Elementa v8.0.0
Minimalistic library for any C++ application (C++11 and up)
Loading...
Searching...
No Matches
elementa::parsing::FSMLexer::Recognizers Class Reference

Several recognizers. More...

Description

Several recognizers.

Definition at line 306 of file lexer.h.

#include "lexer.h"

Inheritance diagram for elementa::parsing::FSMLexer::Recognizers:
Collaboration diagram for elementa::parsing::FSMLexer::Recognizers:

Public Types

using BaseVector = std::vector< TermRecog >
 Shortcut. More...
 
using ListOfInds = std::list< size_type >
 A list with indexes into some recognizers of the vector. More...
 

Public Attributes

elements
 STL member.
 

Public Member Functions

 Recognizers (const Recognizers &)=delete
 
 Recognizers (Recognizers &&)=delete
 
Recognizersoperator= (const Recognizers &)=delete
 
Recognizersoperator= (Recognizers &&)=delete
 
FSMClass::Ptr find (TokenId tid) const
 Return one of the recognizers, or a false (null) one if not found. More...
 
const ListOfIndsactive (void) const noexcept
 Return the indexes of FSMs that are active right now. More...
 
void reset (void)
 Initiate the recognition through all the FSMs, all becoming active. More...
 
void feed (char o)
 Feed FSMs with the given observation O. More...
 
size_type whoWins (void) const
 Return the recognizer that has recognized all characters fed so far. More...
 
void debug (void) const
 Print in console the state of recognizers.
 

Member Typedef Documentation

◆ BaseVector

Shortcut.

Definition at line 311 of file lexer.h.

◆ ListOfInds

A list with indexes into some recognizers of the vector.

Definition at line 317 of file lexer.h.

Member Function Documentation

◆ find()

FSMClass::Ptr elementa::parsing::FSMLexer::Recognizers::find ( TokenId  tid) const
inline

Return one of the recognizers, or a false (null) one if not found.

This is O(n) in the length of RS.

Definition at line 326 of file lexer.h.

◆ active()

const ListOfInds & elementa::parsing::FSMLexer::Recognizers::active ( void  ) const
inlinenoexcept

Return the indexes of FSMs that are active right now.

Definition at line 333 of file lexer.h.

◆ reset()

void elementa::parsing::FSMLexer::Recognizers::reset ( void  )

Initiate the recognition through all the FSMs, all becoming active.

It must be called before starting feeding characters, and it can be called again at any time to restart the process or when the FSMs are changed.

◆ feed()

void elementa::parsing::FSMLexer::Recognizers::feed ( char  o)

Feed FSMs with the given observation O.

Those FSMs that do not consume it become deactivated. This is O(n), being n the current number of active FSMs.

◆ whoWins()

size_type elementa::parsing::FSMLexer::Recognizers::whoWins ( void  ) const

Return the recognizer that has recognized all characters fed so far.

Return >= size of the recognizers vector if none.


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