C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
exprtk::parser< T >::parse_special_function_impl< Type, NumberOfParameters > Struct Template Reference

Static Public Member Functions

static expression_node_ptr process (parser< Type > &p, const details::operator_type opt_type, const std::string &sf_name)
 

Detailed Description

template<typename T>
template<typename Type, std::size_t NumberOfParameters>
struct exprtk::parser< T >::parse_special_function_impl< Type, NumberOfParameters >

Definition at line 29155 of file exprtk.hpp.

Member Function Documentation

◆ process()

template<typename T >
template<typename Type , std::size_t NumberOfParameters>
static expression_node_ptr exprtk::parser< T >::parse_special_function_impl< Type, NumberOfParameters >::process ( parser< Type > &  p,
const details::operator_type  opt_type,
const std::string &  sf_name 
)
inlinestatic

Definition at line 29157 of file exprtk.hpp.

29158 {
29159 expression_node_ptr branch[NumberOfParameters];
29161
29162 std::fill_n(branch, NumberOfParameters, reinterpret_cast<expression_node_ptr>(0));
29163
29164 scoped_delete<expression_node_t,NumberOfParameters> sd(p,branch);
29165
29166 p.next_token();
29167
29168 if (!p.token_is(token_t::e_lbracket))
29169 {
29170 p.set_error(make_error(
29172 p.current_token(),
29173 "ERR146 - Expected '(' for special function '" + sf_name + "'",
29175
29176 return error_node();
29177 }
29178
29179 for (std::size_t i = 0; i < NumberOfParameters; ++i)
29180 {
29181 branch[i] = p.parse_expression();
29182
29183 if (0 == branch[i])
29184 {
29185 return p.error_node();
29186 }
29187 else if (i < (NumberOfParameters - 1))
29188 {
29189 if (!p.token_is(token_t::e_comma))
29190 {
29191 p.set_error(make_error(
29193 p.current_token(),
29194 "ERR147 - Expected ',' before next parameter of special function '" + sf_name + "'",
29196
29197 return p.error_node();
29198 }
29199 }
29200 }
29201
29202 if (!p.token_is(token_t::e_rbracket))
29203 {
29204 p.set_error(make_error(
29206 p.current_token(),
29207 "ERR148 - Invalid number of parameters for special function '" + sf_name + "'",
29209
29210 return p.error_node();
29211 }
29212 else
29213 result = p.expression_generator_.special_function(opt_type,branch);
29214
29215 sd.delete_ptr = (0 == result);
29216
29217 return result;
29218 }
expression_node_t * expression_node_ptr
Definition exprtk.hpp:22518
static expression_node_ptr error_node()
Definition exprtk.hpp:25761
#define exprtk_error_location
Definition exprtk.hpp:67
type make_error(const error_mode mode, const std::string &diagnostic="", const std::string &src_location="")
Definition exprtk.hpp:22336

References exprtk::lexer::parser_helper::current_token(), exprtk::parser< T >::scoped_delete< Type, N >::delete_ptr, exprtk::lexer::token::e_comma, exprtk::lexer::token::e_lbracket, exprtk::lexer::token::e_rbracket, exprtk::parser_error::e_syntax, exprtk::parser< T >::error_node(), exprtk::parser< T >::expression_generator_, exprtk_error_location, exprtk::lexer::parser_helper::next_token(), exprtk::parser< T >::parse_expression(), exprtk::parser< T >::set_error(), exprtk::parser< T >::expression_generator< Type >::special_function(), and exprtk::lexer::parser_helper::token_is().

Referenced by exprtk::parser< T >::parse_special_function().

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

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