26 #if defined (HAVE_CONFIG_H)
51 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false) { }
57 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
66 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
75 m_arg_nm (), m_dyn_field (), m_word_list_cmd (false)
89 error (
"invalid use of empty argument (~) in index expression");
147 std::list<string_vector>::const_iterator p_arg_nm,
148 std::list<tree_expression *>::const_iterator p_dyn_field)
const
150 std::string fn = (*p_arg_nm)(0);
160 fn = t.
xstring_value (
"dynamic structure field names must be strings");
172 std::list<octave_value_list> idx;
176 auto p_args =
m_args.begin ();
184 const std::string& index_type,
185 const std::list<octave_value_list>& index_list)
194 for (
int i = 0; i <
n; i++)
203 idx.push_back (tidx);
212 idx.push_back (tidx);
221 idx.push_back (tidx);
229 if (idx.back ().empty ())
230 error (
"invalid empty index list");
250 std::list<tree_argument_list *> new_args;
253 new_args.push_back (elt ? elt->dup (scope) :
nullptr);
255 new_idx_expr->
m_args = new_args;
261 std::list<tree_expression *> new_dyn_field;
264 new_dyn_field.push_back (elt ? elt->dup (scope) :
nullptr);
351 auto p_args =
m_args.begin ();
366 std::string nm =
id->name ();
370 bool maybe_binary_op =
false;
371 if ((*p_args) && (*p_args)->length () > 0)
375 std::string ops =
"+-*/\\.^|&";
378 && (ops.find (arg_list(0)[1]) != std::string::npos))
379 maybe_binary_op =
true;
384 advice =
"\nCheck whitespace around potential binary operator.";
386 error (
"variable \"%s\" used as function in command style expression%s",
387 nm.c_str (), advice.c_str ());
396 if (al && al->
length () > 0)
398 unwind_action act ([&tw] (
const std::list<octave_lvalue> *lvl)
427 retval = fcn->
call (tw, nargout, first_args);
444 if (retval.
length () == 0)
445 error (
"indexing undefined value");
447 base_expr_val = retval(0);
478 std::list<octave_value_list> idx_list;
487 const std::string& index_type,
488 const std::list<octave_value_list>& index_list)
499 bool indexing_object = (base_expr_val.
isobject ()
500 || base_expr_val.
isjava ()
506 for (
int i = beg; i <
n; i++)
510 if (! indexing_object)
525 base_expr_val = partial_expr_val;
530 retval = partial_expr_val;
537 || partial_expr_val.
isjava ()
552 indexing_object =
true;
570 idx_list.push_back (tmp);
578 idx_list.push_back (tmp);
586 idx_list.push_back (tmp);
603 if (! idx_list.empty ())
638 if (idx_list.size () != 1)
639 error (
"unexpected extra index at end of expression");
642 error (
"invalid index type '%c' for function call",
645 final_args = idx_list.front ();
650 retval = fcn->
call (tw, nargout, final_args);
674 if (! idx_list.empty ())
677 error (
"unexpected extra index at end of expression");
680 error (
"invalid index type '%c' for function call",
683 final_args = idx_list.front ();
686 retval = fcn->
call (tw, nargout, final_args);
std::size_t length(void) const
symbol_table & get_symbol_table(void)
virtual octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
octave_value value(void) const
void set_index(const std::string &t, const std::list< octave_value_list > &i)
void stash_name_tags(const string_vector &nm)
octave_idx_type length(void) const
bool is_function(void) const
bool is_package(void) const
OCTINTERP_API octave_function * function_value(bool silent=false) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
bool is_cs_list(void) const
bool is_classdef_meta(void) const
bool isobject(void) const
bool is_undefined(void) const
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
bool has_magic_tilde(void) const
string_vector get_arg_names(void) const
void set_indexed_object(const octave_value &obj=octave_value())
void final_index_error(index_exception &ie, const tree_expression *expr)
octave_value indexed_object(void) const
const std::string & index_type(void) const
octave_value_list convert_to_const_vector(tree_argument_list *arg_list)
octave_value_list make_value_list(tree_argument_list *args, const string_vector &arg_nm)
const std::list< octave_lvalue > * lvalue_list(void) const
bool is_variable(const std::string &name) const
interpreter & get_interpreter(void)
void clear_index_list(void)
void set_lvalue_list(const std::list< octave_lvalue > *lst)
void append_index_list(char type, const octave_value_list &idx)
void set_index_list(const std::string &index_type, const std::list< octave_value_list > &index_list)
const std::list< octave_value_list > & index_list(void) const
virtual octave_value evaluate(tree_evaluator &tw, int nargout=1)=0
virtual std::string name(void) const
virtual tree_expression * dup(symbol_scope &scope) const =0
virtual void copy_base(const tree_expression &e)
virtual octave_lvalue lvalue(tree_evaluator &)
virtual bool is_identifier(void) const
std::list< tree_expression * > m_dyn_field
std::string name(void) const
octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)
bool is_word_list_cmd(void) const
std::list< string_vector > m_arg_nm
std::list< tree_argument_list * > m_args
tree_index_expression(tree_expression *e=nullptr, tree_argument_list *lst=nullptr, int l=-1, int c=-1, char t='(')
tree_index_expression * dup(symbol_scope &scope) const
std::string get_struct_index(tree_evaluator &tw, std::list< string_vector >::const_iterator p_arg_nm, std::list< tree_expression * >::const_iterator p_dyn_field) const
~tree_index_expression(void)
octave_lvalue lvalue(tree_evaluator &tw)
tree_index_expression * append(tree_argument_list *lst=nullptr, char t='(')
virtual int column(void) const
virtual int line(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void error(const char *fmt,...)
#define panic_impossible()
void err_indexed_cs_list(void)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))