buffalo
Loading...
Searching...
No Matches
bf::Terminal< G > Class Template Reference

#include <buffalo.h>

Inheritance diagram for bf::Terminal< G >:
bf::DefineTerminal< G, regex, SemanticType >

Public Types

using ReasonerType = typename G::ValueType(*)(Token< G > const &)
 

Public Member Functions

G::ValueType Reason (Token< G > const &token) const
 
virtual std::optional< Token< G > > Lex (std::string_view input) const
 
char constGetName () const noexcept
 
 Terminal (Terminal< G > &&)=delete
 
 Terminal (Terminal< G > const &)=delete
 

Public Attributes

std::size_t precedence = Terminal::counter_++
 
Associativity associativity = Associativity::None
 
G::UserDataType user_data
 

Protected Member Functions

 Terminal ()=default
 

Protected Attributes

std::string name_ = "\"UNKNOWN\""
 
ReasonerType reasoner_ = nullptr
 

Static Protected Attributes

static std::size_t counter_ = 0
 

Friends

class Grammar< G >
 

Detailed Description

template<IGrammar G>
class bf::Terminal< G >

TERMINAL

Definition at line 406 of file buffalo.h.

Member Typedef Documentation

◆ ReasonerType

template<IGrammar G>
using bf::Terminal< G >::ReasonerType = typename G::ValueType(*)(Token<G> const&)

Definition at line 411 of file buffalo.h.

Constructor & Destructor Documentation

◆ Terminal() [1/3]

template<IGrammar G>
bf::Terminal< G >::Terminal ( )
protecteddefault

◆ Terminal() [2/3]

template<IGrammar G>
bf::Terminal< G >::Terminal ( Terminal< G > &&  )
delete

◆ Terminal() [3/3]

template<IGrammar G>
bf::Terminal< G >::Terminal ( Terminal< G > const )
delete

Member Function Documentation

◆ GetName()

template<IGrammar G>
char const * bf::Terminal< G >::GetName ( ) const
inlinenoexcept

Definition at line 447 of file buffalo.h.

◆ Lex()

template<IGrammar G>
virtual std::optional< Token< G > > bf::Terminal< G >::Lex ( std::string_view  input) const
inlinevirtual

Reimplemented in bf::DefineTerminal< G, regex, SemanticType >.

Definition at line 442 of file buffalo.h.

◆ Reason()

template<IGrammar G>
G::ValueType bf::Terminal< G >::Reason ( Token< G > const token) const
inline

Takes a token and turns it into a value. Default constructs the value if no reasoner is defined.

Parameters
tokenToken to turn into a value
Returns
Value

Definition at line 432 of file buffalo.h.

Friends And Related Symbol Documentation

◆ Grammar< G >

template<IGrammar G>
friend class Grammar< G >
friend

Definition at line 373 of file buffalo.h.

Member Data Documentation

◆ associativity

template<IGrammar G>
Associativity bf::Terminal< G >::associativity = Associativity::None

Definition at line 424 of file buffalo.h.

◆ counter_

template<IGrammar G>
std::size_t bf::Terminal< G >::counter_ = 0
inlinestaticprotected

Definition at line 416 of file buffalo.h.

◆ name_

template<IGrammar G>
std::string bf::Terminal< G >::name_ = "\"UNKNOWN\""
protected

Definition at line 414 of file buffalo.h.

◆ precedence

template<IGrammar G>
std::size_t bf::Terminal< G >::precedence = Terminal::counter_++

Definition at line 423 of file buffalo.h.

◆ reasoner_

template<IGrammar G>
ReasonerType bf::Terminal< G >::reasoner_ = nullptr
protected

Definition at line 418 of file buffalo.h.

◆ user_data

template<IGrammar G>
G::UserDataType bf::Terminal< G >::user_data

Definition at line 425 of file buffalo.h.


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