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");
141 std::list<string_vector>::const_iterator p_arg_nm,
142 std::list<tree_expression *>::const_iterator p_dyn_field)
const
144 std::string fn = (*p_arg_nm)(0);
154 fn = t.
xstring_value (
"dynamic structure field names must be strings");
166 std::list<octave_value_list> idx;
170 auto p_args =
m_args.begin ();
178 const std::string& index_type,
179 const std::list<octave_value_list>& index_list)
188 for (
int i = 0; i <
n; i++)
197 idx.push_back (tidx);
206 idx.push_back (tidx);
215 idx.push_back (tidx);
223 if (idx.back ().empty ())
224 error (
"invalid empty index list");
244 std::list<tree_argument_list *> new_args;
247 new_args.push_back (elt ? elt->dup (scope) :
nullptr);
249 new_idx_expr->
m_args = new_args;
255 std::list<tree_expression *> new_dyn_field;
258 new_dyn_field.push_back (elt ? elt->dup (scope) :
nullptr);
343 assert (!
m_args.empty ());
345 auto p_args =
m_args.begin ();
360 std::string nm =
id->name ();
363 error (
"%s used as variable and later as function", nm.c_str ());
371 if (al && al->
length () > 0)
373 unwind_action act ([&tw] (
const std::list<octave_lvalue> *lvl)
419 if (
retval.length () == 0)
420 error (
"indexing undefined value");
422 base_expr_val =
retval(0);
453 std::list<octave_value_list> idx_list;
462 const std::string& index_type,
463 const std::list<octave_value_list>& index_list)
474 bool indexing_object = (base_expr_val.
isobject ()
475 || base_expr_val.
isjava ()
481 for (
int i = beg; i <
n; i++)
485 if (! indexing_object)
500 base_expr_val = partial_expr_val;
505 retval = partial_expr_val;
512 || partial_expr_val.
isjava ()
527 indexing_object =
true;
545 idx_list.push_back (tmp);
553 idx_list.push_back (tmp);
561 idx_list.push_back (tmp);
578 if (! idx_list.empty ())
613 if (idx_list.size () != 1)
614 error (
"unexpected extra index at end of expression");
617 error (
"invalid index type '%c' for function call",
620 final_args = idx_list.front ();
649 if (! idx_list.empty ())
652 error (
"unexpected extra index at end of expression");
655 error (
"invalid index type '%c' for function call",
658 final_args = idx_list.front ();
size_t length(void) const
symbol_table & get_symbol_table(void)
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope())
string_vector get_arg_names(void) const
bool has_magic_tilde(void) const
void set_lvalue_list(const std::list< octave_lvalue > *lst)
bool is_variable(const std::string &name) const
void set_index_list(const std::string &index_type, const std::list< octave_value_list > &index_list)
const std::list< octave_lvalue > * lvalue_list(void) const
void append_index_list(char type, const octave_value_list &idx)
void final_index_error(index_exception &e, const tree_expression *expr)
void set_indexed_object(const octave_value &obj=octave_value())
void clear_index_list(void)
const std::list< octave_value_list > & index_list(void) const
const std::string & index_type(void) const
octave_value_list convert_to_const_vector(tree_argument_list *arg_list)
octave_value indexed_object(void) const
octave_value_list make_value_list(tree_argument_list *args, const string_vector &arg_nm)
interpreter & get_interpreter(void)
virtual bool is_identifier(void) const
virtual void copy_base(const tree_expression &e)
virtual tree_expression * dup(symbol_scope &scope) const =0
virtual octave_lvalue lvalue(tree_evaluator &)
virtual std::string name(void) const
virtual octave_value evaluate(tree_evaluator &tw, int nargout=1)=0
bool is_word_list_cmd(void) const
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(tree_expression *e=nullptr, tree_argument_list *lst=nullptr, int l=-1, int c=-1, char t='(')
octave_lvalue lvalue(tree_evaluator &tw)
std::list< tree_expression * > m_dyn_field
std::string name(void) const
~tree_index_expression(void)
octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)
std::list< tree_argument_list * > m_args
std::list< string_vector > m_arg_nm
void append(tree_argument_list *lst=nullptr, char t='(')
virtual int column(void) const
virtual octave_value_list call(octave::tree_evaluator &tw, int nargout=0, const octave_value_list &args=octave_value_list())
void stash_name_tags(const string_vector &nm)
octave_idx_type length(void) const
bool is_function(void) const
bool is_package(void) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
bool is_cs_list(void) const
bool is_classdef_meta(void) const
octave_function * function_value(bool silent=false) const
bool isobject(void) const
std::string xstring_value(const char *fmt,...) const
bool is_undefined(void) const
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()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval