comparison src/pt-stmt.h @ 3665:0689afb1d001

[project @ 2000-05-11 19:07:56 by jwe]
author jwe
date Thu, 11 May 2000 19:10:09 +0000
parents daa1ed1f5462
children 58140935c812
comparison
equal deleted inserted replaced
3664:d178e2bbd873 3665:0689afb1d001
34 class tree_command; 34 class tree_command;
35 class tree_expression; 35 class tree_expression;
36 36
37 class tree_walker; 37 class tree_walker;
38 38
39 #include "comment-list.h"
40
39 // A statement is either a command to execute or an expression to 41 // A statement is either a command to execute or an expression to
40 // evaluate. 42 // evaluate.
41 43
42 class 44 class
43 tree_statement 45 tree_statement
44 { 46 {
45 public: 47 public:
46 48
47 tree_statement (void) 49 tree_statement (void)
48 : cmd (0), expr (0), print_flag (true) { } 50 : cmd (0), expr (0), comm (0), print_flag (true) { }
49 51
50 tree_statement (tree_command *c) 52 tree_statement (tree_command *c, octave_comment_list *cl)
51 : cmd (c), expr (0), print_flag (true) { } 53 : cmd (c), expr (0), comm (cl), print_flag (true) { }
52 54
53 tree_statement (tree_expression *e) 55 tree_statement (tree_expression *e, octave_comment_list *cl)
54 : cmd (0), expr (e), print_flag (true) { } 56 : cmd (0), expr (e), comm (cl), print_flag (true) { }
55 57
56 ~tree_statement (void); 58 ~tree_statement (void);
57 59
58 void set_print_flag (bool print) 60 void set_print_flag (bool print)
59 { print_flag = print; } 61 { print_flag = print; }
75 77
76 octave_value_list eval (bool silent, int nargout, bool in_function_body); 78 octave_value_list eval (bool silent, int nargout, bool in_function_body);
77 79
78 tree_expression *expression (void) { return expr; } 80 tree_expression *expression (void) { return expr; }
79 81
82 octave_comment_list *comment_text (void) { return comm; }
83
80 void accept (tree_walker& tw); 84 void accept (tree_walker& tw);
81 85
82 private: 86 private:
83 87
84 // Only one of cmd or expr can be valid at once. 88 // Only one of cmd or expr can be valid at once.
86 // Command to execute. 90 // Command to execute.
87 tree_command *cmd; 91 tree_command *cmd;
88 92
89 // Expression to evaluate. 93 // Expression to evaluate.
90 tree_expression *expr; 94 tree_expression *expr;
95
96 // Comment associated with this statement.
97 octave_comment_list *comm;
91 98
92 // Print result of eval for this command? 99 // Print result of eval for this command?
93 bool print_flag; 100 bool print_flag;
94 101
95 // No copying! 102 // No copying!