Mercurial > octave
comparison libinterp/parse-tree/pt-exp.h @ 30181:667b868861ba
maint: use "m_" prefix for protected member variables in class tree_expression.
* pt-exp.h: Use "m_" prefix for protected member variables in class
tree_expression.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 14 Sep 2021 20:23:41 -0700 |
parents | 0a5b15007766 |
children | 91c6288781ba 796f54d4ddbf |
comparison
equal
deleted
inserted
replaced
30180:721bad540858 | 30181:667b868861ba |
---|---|
46 class tree_expression : public tree | 46 class tree_expression : public tree |
47 { | 47 { |
48 public: | 48 public: |
49 | 49 |
50 tree_expression (int l = -1, int c = -1) | 50 tree_expression (int l = -1, int c = -1) |
51 : tree (l, c), num_parens (0), postfix_index_type ('\0'), | 51 : tree (l, c), m_num_parens (0), m_postfix_index_type ('\0'), |
52 for_cmd_expr (false), print_flag (false) { } | 52 m_for_cmd_expr (false), m_print_flag (false) { } |
53 | 53 |
54 // No copying! | 54 // No copying! |
55 | 55 |
56 tree_expression (const tree_expression&) = delete; | 56 tree_expression (const tree_expression&) = delete; |
57 | 57 |
85 | 85 |
86 virtual bool rvalue_ok (void) const { return false; } | 86 virtual bool rvalue_ok (void) const { return false; } |
87 | 87 |
88 virtual octave_lvalue lvalue (tree_evaluator&); | 88 virtual octave_lvalue lvalue (tree_evaluator&); |
89 | 89 |
90 int paren_count (void) const { return num_parens; } | 90 int paren_count (void) const { return m_num_parens; } |
91 | 91 |
92 bool is_postfix_indexed (void) const { return (postfix_index_type != '\0'); } | 92 bool is_postfix_indexed (void) const { return (m_postfix_index_type != '\0'); } |
93 | 93 |
94 char postfix_index (void) const { return postfix_index_type; } | 94 char postfix_index (void) const { return m_postfix_index_type; } |
95 | 95 |
96 // Check if the result of the expression should be printed. | 96 // Check if the result of the expression should be printed. |
97 // Should normally be used in conjunction with | 97 // Should normally be used in conjunction with |
98 // tree_evaluator::statement_printing_enabled. | 98 // tree_evaluator::statement_printing_enabled. |
99 bool print_result (void) const { return print_flag; } | 99 bool print_result (void) const { return m_print_flag; } |
100 | 100 |
101 virtual std::string oper (void) const { return "<unknown>"; } | 101 virtual std::string oper (void) const { return "<unknown>"; } |
102 | 102 |
103 virtual std::string name (void) const { return "<unknown>"; } | 103 virtual std::string name (void) const { return "<unknown>"; } |
104 | 104 |
105 virtual std::string original_text (void) const; | 105 virtual std::string original_text (void) const; |
106 | 106 |
107 virtual void mark_braindead_shortcircuit (void) { } | 107 virtual void mark_braindead_shortcircuit (void) { } |
108 | 108 |
109 void mark_as_for_cmd_expr (void) { for_cmd_expr = true; } | 109 void mark_as_for_cmd_expr (void) { m_for_cmd_expr = true; } |
110 | 110 |
111 bool is_for_cmd_expr (void) const { return for_cmd_expr; } | 111 bool is_for_cmd_expr (void) const { return m_for_cmd_expr; } |
112 | 112 |
113 tree_expression * mark_in_parens (void) | 113 tree_expression * mark_in_parens (void) |
114 { | 114 { |
115 num_parens++; | 115 m_num_parens++; |
116 return this; | 116 return this; |
117 } | 117 } |
118 | 118 |
119 tree_expression * set_postfix_index (char type) | 119 tree_expression * set_postfix_index (char type) |
120 { | 120 { |
121 postfix_index_type = type; | 121 m_postfix_index_type = type; |
122 return this; | 122 return this; |
123 } | 123 } |
124 | 124 |
125 tree_expression * set_print_flag (bool print) | 125 tree_expression * set_print_flag (bool print) |
126 { | 126 { |
127 print_flag = print; | 127 m_print_flag = print; |
128 return this; | 128 return this; |
129 } | 129 } |
130 | 130 |
131 virtual void copy_base (const tree_expression& e) | 131 virtual void copy_base (const tree_expression& e) |
132 { | 132 { |
133 num_parens = e.num_parens; | 133 m_num_parens = e.m_num_parens; |
134 postfix_index_type = e.postfix_index_type; | 134 m_postfix_index_type = e.m_postfix_index_type; |
135 print_flag = e.print_flag; | 135 m_print_flag = e.m_print_flag; |
136 } | 136 } |
137 | 137 |
138 virtual octave_value evaluate (tree_evaluator& tw, int nargout = 1) = 0; | 138 virtual octave_value evaluate (tree_evaluator& tw, int nargout = 1) = 0; |
139 | 139 |
140 virtual octave_value_list | 140 virtual octave_value_list |
146 // inside a set of parentheses. | 146 // inside a set of parentheses. |
147 // | 147 // |
148 // (((e1)) + e2) ==> 2 for expression e1 | 148 // (((e1)) + e2) ==> 2 for expression e1 |
149 // ==> 1 for expression ((e1)) + e2 | 149 // ==> 1 for expression ((e1)) + e2 |
150 // ==> 0 for expression e2 | 150 // ==> 0 for expression e2 |
151 int num_parens; | 151 int m_num_parens; |
152 | 152 |
153 // The first index type associated with this expression. This field | 153 // The first index type associated with this expression. This field |
154 // is 0 (character '\0') if the expression has no associated index. | 154 // is 0 (character '\0') if the expression has no associated index. |
155 // See the code in tree_identifier::rvalue for the rationale. | 155 // See the code in tree_identifier::rvalue for the rationale. |
156 char postfix_index_type; | 156 char m_postfix_index_type; |
157 | 157 |
158 // TRUE if this expression is the EXPR in for loop: | 158 // TRUE if this expression is the EXPR in for loop: |
159 // FOR i = EXPR ... END | 159 // FOR i = EXPR ... END |
160 bool for_cmd_expr; | 160 bool m_for_cmd_expr; |
161 | 161 |
162 // Print result of rvalue for this expression? | 162 // Print result of rvalue for this expression? |
163 bool print_flag; | 163 bool m_print_flag; |
164 }; | 164 }; |
165 } | 165 } |
166 | 166 |
167 #endif | 167 #endif |