Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/pt-exp.h @ 19589:b39cbe9f3bb0
allow ranges to be disabled
* ov.cc, ov.h: Allow creation of range object to be disabled.
Also allow range objects to be forced, even when generally disabled.
* pt-exp.h (tree_expression::for_cmd_expr): New member variable.
(tree_expression::mark_as_for_cmd_expr,
tree_expression::is_for_cmd_expr): New functions.
* oct-parse.in.yy: Mark for command expressions.
* pt-colon.cc (tree_colon_expression::make_range): Force creation of
range if expression is a for command expression.
* basics.txi, numbers.txi: Document changes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 08 Dec 2014 12:59:47 -0500 |
parents | c7b68a11074b |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
19588:9464cfeede2b | 19589:b39cbe9f3bb0 |
---|---|
39 { | 39 { |
40 public: | 40 public: |
41 | 41 |
42 tree_expression (int l = -1, int c = -1) | 42 tree_expression (int l = -1, int c = -1) |
43 : tree (l, c), num_parens (0), postfix_index_type ('\0'), | 43 : tree (l, c), num_parens (0), postfix_index_type ('\0'), |
44 print_flag (false) { } | 44 for_cmd_expr (false), print_flag (false) { } |
45 | 45 |
46 virtual ~tree_expression (void) { } | 46 virtual ~tree_expression (void) { } |
47 | 47 |
48 virtual bool has_magic_end (void) const = 0; | 48 virtual bool has_magic_end (void) const = 0; |
49 | 49 |
102 | 102 |
103 virtual std::string original_text (void) const; | 103 virtual std::string original_text (void) const; |
104 | 104 |
105 virtual void mark_braindead_shortcircuit (void) { } | 105 virtual void mark_braindead_shortcircuit (void) { } |
106 | 106 |
107 void mark_as_for_cmd_expr (void) { for_cmd_expr = true; } | |
108 | |
109 bool is_for_cmd_expr (void) const { return for_cmd_expr; } | |
110 | |
107 tree_expression *mark_in_parens (void) | 111 tree_expression *mark_in_parens (void) |
108 { | 112 { |
109 num_parens++; | 113 num_parens++; |
110 return this; | 114 return this; |
111 } | 115 } |
142 // The first index type associated with this expression. This field | 146 // The first index type associated with this expression. This field |
143 // is 0 (character '\0') if the expression has no associated index. | 147 // is 0 (character '\0') if the expression has no associated index. |
144 // See the code in tree_identifier::rvalue for the rationale. | 148 // See the code in tree_identifier::rvalue for the rationale. |
145 char postfix_index_type; | 149 char postfix_index_type; |
146 | 150 |
151 // TRUE if this expression is the EXPR in for loop: | |
152 // FOR i = EXPR ... END | |
153 bool for_cmd_expr; | |
154 | |
147 // Print result of rvalue for this expression? | 155 // Print result of rvalue for this expression? |
148 bool print_flag; | 156 bool print_flag; |
149 | 157 |
150 private: | 158 private: |
151 | 159 |