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 28793 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 28795 of file exprtk.hpp.

28796 {
28797 expression_node_ptr branch[NumberOfParameters];
28799
28800 std::fill_n(branch, NumberOfParameters, reinterpret_cast<expression_node_ptr>(0));
28801
28802 scoped_delete<expression_node_t,NumberOfParameters> sd(p,branch);
28803
28804 p.next_token();
28805
28806 if (!p.token_is(token_t::e_lbracket))
28807 {
28808 p.set_error(make_error(
28810 p.current_token(),
28811 "ERR144 - Expected '(' for special function '" + sf_name + "'",
28813
28814 return error_node();
28815 }
28816
28817 for (std::size_t i = 0; i < NumberOfParameters; ++i)
28818 {
28819 branch[i] = p.parse_expression();
28820
28821 if (0 == branch[i])
28822 {
28823 return p.error_node();
28824 }
28825 else if (i < (NumberOfParameters - 1))
28826 {
28827 if (!p.token_is(token_t::e_comma))
28828 {
28829 p.set_error(make_error(
28831 p.current_token(),
28832 "ERR145 - Expected ',' before next parameter of special function '" + sf_name + "'",
28834
28835 return p.error_node();
28836 }
28837 }
28838 }
28839
28840 if (!p.token_is(token_t::e_rbracket))
28841 {
28842 p.set_error(make_error(
28844 p.current_token(),
28845 "ERR146 - Invalid number of parameters for special function '" + sf_name + "'",
28847
28848 return p.error_node();
28849 }
28850 else
28851 result = p.expression_generator_.special_function(opt_type,branch);
28852
28853 sd.delete_ptr = (0 == result);
28854
28855 return result;
28856 }
expression_node_t * expression_node_ptr
Definition exprtk.hpp:22253
static expression_node_ptr error_node()
Definition exprtk.hpp:25405
#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:22071

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: