BashSpark
Loading...
Searching...
No Matches
bs::test_parser Struct Reference

Structure to help class command_test parse it's parameters. More...

Classes

struct  depth_guard
 Manages depth of a test_parser instance during its lifetime. More...
 

Public Member Functions

 test_parser (const std::span< const std::string > &vTokens) noexcept
 
bool do_toplevel (std::size_t &nPos)
 Evaluate a full expression (top-level entry point).
 
void increase_depth ()
 Increases the current recursion/evaluation depth. Ensures that the depth does not exceed MAX_DEPTH.
 
void decrease_depth ()
 Decreases the current recursion/evaluation depth. Will not decrement below zero.
 

Static Public Attributes

static constexpr std::size_t MAX_DEPTH = 512
 Maximum depth of the shell parser.
 
static std::map< std::string_view, test_operatorOPERATORS
 Map containing operator expressions and codes.
 

Detailed Description

Structure to help class command_test parse it's parameters.

Constructor & Destructor Documentation

◆ test_parser()

bs::test_parser::test_parser ( const std::span< const std::string > &  vTokens)
inlineexplicitnoexcept

Contstructs a test_parser

Parameters
vTokensTokens to parse

Member Function Documentation

◆ do_toplevel()

bool bs::test_parser::do_toplevel ( std::size_t &  nPos)

Evaluate a full expression (top-level entry point).

Parameters
nPosToken positon
Returns
Operation result

◆ increase_depth()

void bs::test_parser::increase_depth ( )
inline

Increases the current recursion/evaluation depth. Ensures that the depth does not exceed MAX_DEPTH.

Exceptions
math_errorIf increasing the depth would exceed MAX_DEPTH.

Member Data Documentation

◆ OPERATORS

std::map< std::string_view, test_operator > bs::test_parser::OPERATORS
static
Initial value:
= {
}
@ TO_EMPTY
Represents an empty condition.
@ TO_MATCHES
Represents matching condition.
@ TO_PARENTHESIS_CLOSE
Represents a closing parenthesis.
@ TO_PARENTHESIS_OPEN
Represents an opening parenthesis.
@ TO_AND
Represents logical AND operation.
@ TO_NON_EMPTY
Represents a non-empty condition.
@ TO_LESS_THAN
Represents less than comparison.
@ TO_OR
Represents logical OR operation.
@ TO_NOT_EQUALS
Represents not equal comparison.
@ TO_EQUALS
Represents equality comparison.
@ TO_GREATER_THAN_OR_EQUALS
Represents greater than or equal to comparison.
@ TO_LESS_THAN_OR_EQUALS
Represents less than or equal to comparison.
@ TO_GREATER_THAN
Represents greater than comparison.

Map containing operator expressions and codes.


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