GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-idx.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_pt_idx_h)
24 #define octave_pt_idx_h 1
25 
26 #include "octave-config.h"
27 
28 #include <list>
29 
30 class tree_argument_list;
31 
32 class tree_walker;
33 
34 class octave_map;
35 class octave_value;
36 class octave_value_list;
37 class octave_lvalue;
38 
39 #include "str-vec.h"
40 
41 #include "pt-exp.h"
42 #include "symtab.h"
43 
44 // Index expressions.
45 
46 class
48 {
49 public:
50 
52  int l = -1, int c = -1, char t = '(');
53 
55  int l = -1, int c = -1);
56 
58  int l = -1, int c = -1);
59 
60  ~tree_index_expression (void);
61 
62  bool has_magic_end (void) const;
63 
64  void append (tree_argument_list *lst = 0, char t = '(');
65 
66  void append (const std::string& n);
67 
68  void append (tree_expression *df);
69 
70  bool is_index_expression (void) const { return true; }
71 
72  std::string name (void) const;
73 
74  tree_expression *expression (void) { return expr; }
75 
76  std::list<tree_argument_list *> arg_lists (void) { return args; }
77 
78  std::string type_tags (void) { return type; }
79 
80  std::list<string_vector> arg_names (void) { return arg_nm; }
81 
82  bool lvalue_ok (void) const { return expr->lvalue_ok (); }
83 
84  bool rvalue_ok (void) const { return true; }
85 
86  octave_value rvalue1 (int nargout = 1);
87 
88  octave_value_list rvalue (int nargout);
89 
90  octave_value_list rvalue (int nargout,
91  const std::list<octave_lvalue> *lvalue_list);
92 
93  octave_lvalue lvalue (void);
94 
97 
98  void accept (tree_walker& tw);
99 
100 private:
101 
102  // The LHS of this index expression.
104 
105  // The indices (only valid if type == paren || type == brace).
106  std::list<tree_argument_list *> args;
107 
108  // The type of this index expression.
110 
111  // The names of the arguments. Used for constant struct element
112  // references.
113  std::list<string_vector> arg_nm;
114 
115  // The list of dynamic field names, if any.
116  std::list<tree_expression *> dyn_field;
117 
118  tree_index_expression (int l, int c);
119 
120  octave_map make_arg_struct (void) const;
121 
123  get_struct_index
124  (std::list<string_vector>::const_iterator p_arg_nm,
125  std::list<tree_expression *>::const_iterator p_dyn_field) const;
126 
127  // No copying!
128 
130 
132 };
133 
134 #endif
std::list< tree_argument_list * > args
Definition: pt-idx.h:106
bool lvalue_ok(void) const
Definition: pt-idx.h:82
std::list< tree_expression * > dyn_field
Definition: pt-idx.h:116
std::list< string_vector > arg_nm
Definition: pt-idx.h:113
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
tree_expression * expression(void)
Definition: pt-idx.h:74
i e
Definition: data.cc:2724
std::string type_tags(void)
Definition: pt-idx.h:78
std::list< string_vector > arg_names(void)
Definition: pt-idx.h:80
JNIEnv void * args
Definition: ov-java.cc:67
tree_expression * expr
Definition: pt-idx.h:103
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
bool is_index_expression(void) const
Definition: pt-idx.h:70
std::list< tree_argument_list * > arg_lists(void)
Definition: pt-idx.h:76
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
bool append
Definition: load-save.cc:1582
idx type
Definition: ov.cc:3129
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
bool rvalue_ok(void) const
Definition: pt-idx.h:84
std::string type
Definition: pt-idx.h:109
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave_lvalue & operator=(const octave_lvalue &vr)
Definition: oct-lvalue.h:51