C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
exprtk::lexer::token_scanner Class Reference

#include <exprtk.hpp>

Inheritance diagram for exprtk::lexer::token_scanner:
[legend]
Collaboration diagram for exprtk::lexer::token_scanner:
[legend]

Public Member Functions

virtual ~token_scanner ()
 
 token_scanner (const std::size_t &stride)
 
std::size_t process (generator &g)
 
virtual bool operator() (const token &)
 
virtual bool operator() (const token &, const token &)
 
virtual bool operator() (const token &, const token &, const token &)
 
virtual bool operator() (const token &, const token &, const token &, const token &)
 
- Public Member Functions inherited from exprtk::lexer::helper_interface
virtual void init ()
 
virtual void reset ()
 
virtual bool result ()
 
virtual ~helper_interface ()
 

Private Attributes

const std::size_t stride_
 

Detailed Description

Definition at line 3166 of file exprtk.hpp.

Constructor & Destructor Documentation

◆ ~token_scanner()

virtual exprtk::lexer::token_scanner::~token_scanner ( )
inlinevirtual

Definition at line 3170 of file exprtk.hpp.

3171 {}

◆ token_scanner()

exprtk::lexer::token_scanner::token_scanner ( const std::size_t &  stride)
inlineexplicit

Definition at line 3173 of file exprtk.hpp.

3174 : stride_(stride)
3175 {
3176 if (stride > 4)
3177 {
3178 throw std::invalid_argument("token_scanner() - Invalid stride value");
3179 }
3180 }
const std::size_t stride_
Definition exprtk.hpp:3272

Member Function Documentation

◆ operator()() [1/4]

virtual bool exprtk::lexer::token_scanner::operator() ( const token )
inlinevirtual

Reimplemented in exprtk::lexer::helper::bracket_checker, and exprtk::lexer::helper::numeric_checker< T >.

Definition at line 3250 of file exprtk.hpp.

3251 {
3252 return false;
3253 }

◆ operator()() [2/4]

virtual bool exprtk::lexer::token_scanner::operator() ( const token ,
const token  
)
inlinevirtual

Reimplemented in exprtk::lexer::helper::sequence_validator.

Definition at line 3255 of file exprtk.hpp.

3256 {
3257 return false;
3258 }

◆ operator()() [3/4]

virtual bool exprtk::lexer::token_scanner::operator() ( const token ,
const token ,
const token  
)
inlinevirtual

Reimplemented in exprtk::lexer::helper::sequence_validator_3tokens.

Definition at line 3260 of file exprtk.hpp.

3261 {
3262 return false;
3263 }

◆ operator()() [4/4]

virtual bool exprtk::lexer::token_scanner::operator() ( const token ,
const token ,
const token ,
const token  
)
inlinevirtual

Definition at line 3265 of file exprtk.hpp.

3266 {
3267 return false;
3268 }

◆ process()

std::size_t exprtk::lexer::token_scanner::process ( generator g)
inlinevirtual

Reimplemented from exprtk::lexer::helper_interface.

Definition at line 3182 of file exprtk.hpp.

3183 {
3184 if (g.token_list_.size() >= stride_)
3185 {
3186 for (std::size_t i = 0; i < (g.token_list_.size() - stride_ + 1); ++i)
3187 {
3188 token t;
3189
3190 switch (stride_)
3191 {
3192 case 1 :
3193 {
3194 const token& t0 = g.token_list_[i];
3195
3196 if (!operator()(t0))
3197 {
3198 return 0;
3199 }
3200 }
3201 break;
3202
3203 case 2 :
3204 {
3205 const token& t0 = g.token_list_[i ];
3206 const token& t1 = g.token_list_[i + 1];
3207
3208 if (!operator()(t0, t1))
3209 {
3210 return 0;
3211 }
3212 }
3213 break;
3214
3215 case 3 :
3216 {
3217 const token& t0 = g.token_list_[i ];
3218 const token& t1 = g.token_list_[i + 1];
3219 const token& t2 = g.token_list_[i + 2];
3220
3221 if (!operator()(t0, t1, t2))
3222 {
3223 return 0;
3224 }
3225 }
3226 break;
3227
3228 case 4 :
3229 {
3230 const token& t0 = g.token_list_[i ];
3231 const token& t1 = g.token_list_[i + 1];
3232 const token& t2 = g.token_list_[i + 2];
3233 const token& t3 = g.token_list_[i + 3];
3234
3235 if (!operator()(t0, t1, t2, t3))
3236 {
3237 return 0;
3238 }
3239 }
3240 break;
3241
3242 default: continue;
3243 }
3244 }
3245 }
3246
3247 return 0;
3248 }

References stride_.

Referenced by exprtk::lexer::helper::helper_assembly::run_scanners().

Here is the caller graph for this function:

Member Data Documentation

◆ stride_

const std::size_t exprtk::lexer::token_scanner::stride_
private

Definition at line 3272 of file exprtk.hpp.

Referenced by process().


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