diff src/pt-cmd.h @ 2764:2c0f259cf83d

[project @ 1997-03-01 02:30:26 by jwe]
author jwe
date Sat, 01 Mar 1997 02:30:29 +0000
parents 5c773d4745d6
children 52e7c4509983
line wrap: on
line diff
--- a/src/pt-cmd.h
+++ b/src/pt-cmd.h
@@ -34,6 +34,7 @@
 class tree_statement_list;
 class tree_global_init_list;
 class tree_if_command_list;
+class tree_switch_case_list;
 class tree_expression;
 class tree_index_expression;
 class tree_identifier;
@@ -46,6 +47,7 @@
 class tree_while_command;
 class tree_for_command;
 class tree_if_command;
+class tree_switch_command;
 class tree_try_catch_command;
 class tree_unwind_protect_command;
 class tree_no_op_command;
@@ -212,8 +214,6 @@
 
   void eval (void);
 
-  void eval_error (void);
-
   tree_if_command_list *cmd_list (void) { return list; }
 
   void accept (tree_walker& tw);
@@ -224,6 +224,41 @@
   tree_if_command_list *list;
 };
 
+// Switch.
+
+class
+tree_switch_command : public tree_command
+{
+public:
+
+  tree_switch_command (int l = -1, int c = -1)
+    : tree_command (l, c), expr (0), list (0) { }
+
+  tree_switch_command (tree_expression *e, tree_switch_case_list *lst,
+		       int l = -1, int c = -1)
+    : tree_command (l, c), expr (e), list (lst) { }
+
+  ~tree_switch_command (void);
+
+  void eval (void);
+
+  void eval_error (void);
+
+  tree_expression *switch_value (void) { return expr; }
+
+  tree_switch_case_list *case_list (void) { return list; }
+
+  void accept (tree_walker& tw);
+
+private:
+
+  // Value on which to switch.
+  tree_expression *expr;
+
+  // List of cases (case 1, case 2, ..., default)
+  tree_switch_case_list *list;
+};
+
 // Simple exception handling.
 
 class