diff libinterp/parse-tree/pt-loop.h @ 23075:4e3d47dc7e25

move parse tree classes inside octave namespace * lex.h, lex.ll, oct-parse.in.yy, parse.h, pt-all.h, pt-arg-list.cc, pt-arg-list.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt.cc, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.cc, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-funcall.cc, pt-funcall.h, pt.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.cc, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h, pt-unop.cc, pt-unop.h, pt-walk.h, token.cc, token.h: Move classes and most functions inside octave namespace. Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Jan 2017 23:41:54 -0500
parents f75d289645ec
children ef4d915df748
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-loop.h	Thu Jan 19 14:47:19 2017 -0500
+++ b/libinterp/parse-tree/pt-loop.h	Thu Jan 19 23:41:54 2017 -0500
@@ -28,302 +28,316 @@
 class octave_value;
 class octave_lvalue;
 
-class tree_argument_list;
-class tree_expression;
-class tree_statement_list;
-
-class tree_walker;
-
 #include "comment-list.h"
 #include "pt-cmd.h"
 #include "symtab.h"
 
 class jit_info;
 
-// While.
-
-class
-tree_while_command : public tree_command
+namespace octave
 {
-public:
+  class tree_argument_list;
+  class tree_expression;
+  class tree_statement_list;
+
+  class tree_walker;
+
+  // While.
 
-  tree_while_command (int l = -1, int c = -1)
-    : tree_command (l, c), expr (0), list (0), lead_comm (0),
-      trail_comm (0)
+  class tree_while_command : public tree_command
+  {
+  public:
+
+    tree_while_command (int l = -1, int c = -1)
+      : tree_command (l, c), expr (0), list (0), lead_comm (0),
+        trail_comm (0)
 #if defined (HAVE_LLVM)
       , compiled (0)
 #endif
-  { }
+    { }
 
-  tree_while_command (tree_expression *e,
-                      octave_comment_list *lc = 0,
-                      octave_comment_list *tc = 0,
-                      int l = -1, int c = -1)
-    : tree_command (l, c), expr (e), list (0), lead_comm (lc),
-      trail_comm (tc)
+    tree_while_command (tree_expression *e,
+                        octave_comment_list *lc = 0,
+                        octave_comment_list *tc = 0,
+                        int l = -1, int c = -1)
+      : tree_command (l, c), expr (e), list (0), lead_comm (lc),
+        trail_comm (tc)
 #if defined (HAVE_LLVM)
       , compiled (0)
 #endif
-  { }
+    { }
 
-  tree_while_command (tree_expression *e, tree_statement_list *lst,
-                      octave_comment_list *lc = 0,
-                      octave_comment_list *tc = 0,
-                      int l = -1, int c = -1)
-    : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
-      trail_comm (tc)
+    tree_while_command (tree_expression *e, tree_statement_list *lst,
+                        octave_comment_list *lc = 0,
+                        octave_comment_list *tc = 0,
+                        int l = -1, int c = -1)
+      : tree_command (l, c), expr (e), list (lst), lead_comm (lc),
+        trail_comm (tc)
 #if defined (HAVE_LLVM)
       , compiled (0)
 #endif
-  { }
+    { }
 
-  // No copying!
+    // No copying!
 
-  tree_while_command (const tree_while_command&) = delete;
+    tree_while_command (const tree_while_command&) = delete;
 
-  tree_while_command& operator = (const tree_while_command&) = delete;
+    tree_while_command& operator = (const tree_while_command&) = delete;
 
-  ~tree_while_command (void);
+    ~tree_while_command (void);
 
-  tree_expression *condition (void) { return expr; }
+    tree_expression *condition (void) { return expr; }
 
-  tree_statement_list *body (void) { return list; }
+    tree_statement_list *body (void) { return list; }
 
-  octave_comment_list *leading_comment (void) { return lead_comm; }
+    octave_comment_list *leading_comment (void) { return lead_comm; }
 
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
+    octave_comment_list *trailing_comment (void) { return trail_comm; }
 
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
+    tree_command *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
 
-  void accept (tree_walker& tw);
+    void accept (tree_walker& tw);
 
 #if defined (HAVE_LLVM)
-  // some functions use by tree_jit
-  jit_info *get_info (void) const
-  {
-    return compiled;
-  }
+    // some functions use by tree_jit
+    jit_info *get_info (void) const
+    {
+      return compiled;
+    }
 
-  void stash_info (jit_info *jinfo)
-  {
-    compiled = jinfo;
-  }
+    void stash_info (jit_info *jinfo)
+    {
+      compiled = jinfo;
+    }
 #endif
 
-protected:
+  protected:
 
-  // Expression to test.
-  tree_expression *expr;
+    // Expression to test.
+    tree_expression *expr;
 
-  // List of commands to execute.
-  tree_statement_list *list;
+    // List of commands to execute.
+    tree_statement_list *list;
 
-  // Comment preceding WHILE token.
-  octave_comment_list *lead_comm;
+    // Comment preceding WHILE token.
+    octave_comment_list *lead_comm;
 
-  // Comment preceding ENDWHILE token.
-  octave_comment_list *trail_comm;
+    // Comment preceding ENDWHILE token.
+    octave_comment_list *trail_comm;
 
-private:
+  private:
 
 #if defined (HAVE_LLVM)
-  // compiled version of the loop
-  jit_info *compiled;
+    // compiled version of the loop
+    jit_info *compiled;
 #endif
-};
+  };
 
-// Do-Until.
+  // Do-Until.
 
-class
-tree_do_until_command : public tree_while_command
-{
-public:
+  class tree_do_until_command : public tree_while_command
+  {
+  public:
 
-  tree_do_until_command (int l = -1, int c = -1)
-    : tree_while_command (l, c) { }
+    tree_do_until_command (int l = -1, int c = -1)
+      : tree_while_command (l, c) { }
 
-  tree_do_until_command (tree_expression *e,
-                         octave_comment_list *lc = 0,
-                         octave_comment_list *tc = 0,
-                         int l = -1, int c = -1)
-    : tree_while_command (e, lc, tc, l, c) { }
+    tree_do_until_command (tree_expression *e,
+                           octave_comment_list *lc = 0,
+                           octave_comment_list *tc = 0,
+                           int l = -1, int c = -1)
+      : tree_while_command (e, lc, tc, l, c) { }
 
-  tree_do_until_command (tree_expression *e, tree_statement_list *lst,
-                         octave_comment_list *lc = 0,
-                         octave_comment_list *tc = 0,
-                         int l = -1, int c = -1)
-    : tree_while_command (e, lst, lc, tc, l, c) { }
+    tree_do_until_command (tree_expression *e, tree_statement_list *lst,
+                           octave_comment_list *lc = 0,
+                           octave_comment_list *tc = 0,
+                           int l = -1, int c = -1)
+      : tree_while_command (e, lst, lc, tc, l, c) { }
 
-  // No copying!
+    // No copying!
 
-  tree_do_until_command (const tree_do_until_command&) = delete;
+    tree_do_until_command (const tree_do_until_command&) = delete;
 
-  tree_do_until_command& operator = (const tree_do_until_command&) = delete;
+    tree_do_until_command& operator = (const tree_do_until_command&) = delete;
 
-  ~tree_do_until_command (void) = default;
+    ~tree_do_until_command (void) = default;
 
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
+    tree_command *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
 
-  void accept (tree_walker& tw);
-};
+    void accept (tree_walker& tw);
+  };
 
-// For.
+  // For.
 
-class
-tree_simple_for_command : public tree_command
-{
-public:
+  class tree_simple_for_command : public tree_command
+  {
+  public:
 
-  tree_simple_for_command (int l = -1, int c = -1)
-    : tree_command (l, c), parallel (false), lhs (0), expr (0),
-      maxproc (0), list (0), lead_comm (0), trail_comm (0)
+    tree_simple_for_command (int l = -1, int c = -1)
+      : tree_command (l, c), parallel (false), lhs (0), expr (0),
+        maxproc (0), list (0), lead_comm (0), trail_comm (0)
 #if defined (HAVE_LLVM)
       , compiled (0)
 #endif
-  { }
+    { }
 
-  tree_simple_for_command (bool parallel_arg, tree_expression *le,
-                           tree_expression *re,
-                           tree_expression *maxproc_arg,
-                           tree_statement_list *lst,
-                           octave_comment_list *lc = 0,
-                           octave_comment_list *tc = 0,
-                           int l = -1, int c = -1)
-    : tree_command (l, c), parallel (parallel_arg), lhs (le),
-      expr (re), maxproc (maxproc_arg), list (lst),
-      lead_comm (lc), trail_comm (tc)
+    tree_simple_for_command (bool parallel_arg, tree_expression *le,
+                             tree_expression *re,
+                             tree_expression *maxproc_arg,
+                             tree_statement_list *lst,
+                             octave_comment_list *lc = 0,
+                             octave_comment_list *tc = 0,
+                             int l = -1, int c = -1)
+      : tree_command (l, c), parallel (parallel_arg), lhs (le),
+        expr (re), maxproc (maxproc_arg), list (lst),
+        lead_comm (lc), trail_comm (tc)
 #if defined (HAVE_LLVM)
       , compiled (0)
 #endif
-  { }
+    { }
 
-  // No copying!
+    // No copying!
 
-  tree_simple_for_command (const tree_simple_for_command&) = delete;
+    tree_simple_for_command (const tree_simple_for_command&) = delete;
 
-  tree_simple_for_command& operator = (const tree_simple_for_command&) = delete;
+    tree_simple_for_command& operator = (const tree_simple_for_command&) = delete;
 
-  ~tree_simple_for_command (void);
+    ~tree_simple_for_command (void);
 
-  bool in_parallel (void) { return parallel; }
+    bool in_parallel (void) { return parallel; }
 
-  tree_expression *left_hand_side (void) { return lhs; }
+    tree_expression *left_hand_side (void) { return lhs; }
 
-  tree_expression *control_expr (void) { return expr; }
+    tree_expression *control_expr (void) { return expr; }
 
-  tree_expression *maxproc_expr (void) { return maxproc; }
+    tree_expression *maxproc_expr (void) { return maxproc; }
 
-  tree_statement_list *body (void) { return list; }
+    tree_statement_list *body (void) { return list; }
 
-  octave_comment_list *leading_comment (void) { return lead_comm; }
+    octave_comment_list *leading_comment (void) { return lead_comm; }
 
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
+    octave_comment_list *trailing_comment (void) { return trail_comm; }
 
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
+    tree_command *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
 
-  void accept (tree_walker& tw);
+    void accept (tree_walker& tw);
 
 #if defined (HAVE_LLVM)
-  // some functions use by tree_jit
-  jit_info *get_info (void) const
-  {
-    return compiled;
-  }
+    // some functions use by tree_jit
+    jit_info *get_info (void) const
+    {
+      return compiled;
+    }
 
-  void stash_info (jit_info *jinfo)
-  {
-    compiled = jinfo;
-  }
+    void stash_info (jit_info *jinfo)
+    {
+      compiled = jinfo;
+    }
 #endif
 
-private:
-  // TRUE means operate in parallel (subject to the value of the
-  // maxproc expression).
-  bool parallel;
+  private:
+    // TRUE means operate in parallel (subject to the value of the
+    // maxproc expression).
+    bool parallel;
 
-  // Expression to modify.
-  tree_expression *lhs;
+    // Expression to modify.
+    tree_expression *lhs;
+
+    // Expression to evaluate.
+    tree_expression *expr;
 
-  // Expression to evaluate.
-  tree_expression *expr;
+    // Expression to tell how many processors should be used (only valid
+    // if parallel is TRUE).
+    tree_expression *maxproc;
 
-  // Expression to tell how many processors should be used (only valid
-  // if parallel is TRUE).
-  tree_expression *maxproc;
+    // List of commands to execute.
+    tree_statement_list *list;
 
-  // List of commands to execute.
-  tree_statement_list *list;
+    // Comment preceding FOR token.
+    octave_comment_list *lead_comm;
+
+    // Comment preceding ENDFOR token.
+    octave_comment_list *trail_comm;
 
-  // Comment preceding FOR token.
-  octave_comment_list *lead_comm;
+    // compiled version of the loop
+    jit_info *compiled;
+  };
 
-  // Comment preceding ENDFOR token.
-  octave_comment_list *trail_comm;
+  class tree_complex_for_command : public tree_command
+  {
+  public:
+
+    tree_complex_for_command (int l = -1, int c = -1)
+      : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
+        trail_comm (0) { }
 
-  // compiled version of the loop
-  jit_info *compiled;
-};
+    tree_complex_for_command (tree_argument_list *le, tree_expression *re,
+                              tree_statement_list *lst,
+                              octave_comment_list *lc = 0,
+                              octave_comment_list *tc = 0,
+                              int l = -1, int c = -1)
+      : tree_command (l, c), lhs (le), expr (re), list (lst),
+        lead_comm (lc), trail_comm (tc) { }
 
-class
-tree_complex_for_command : public tree_command
-{
-public:
+    // No copying!
 
-  tree_complex_for_command (int l = -1, int c = -1)
-    : tree_command (l, c), lhs (0), expr (0), list (0), lead_comm (0),
-      trail_comm (0) { }
+    tree_complex_for_command (const tree_complex_for_command&) = delete;
+
+    tree_complex_for_command& operator = (const tree_complex_for_command&) = delete;
 
-  tree_complex_for_command (tree_argument_list *le, tree_expression *re,
-                            tree_statement_list *lst,
-                            octave_comment_list *lc = 0,
-                            octave_comment_list *tc = 0,
-                            int l = -1, int c = -1)
-    : tree_command (l, c), lhs (le), expr (re), list (lst),
-      lead_comm (lc), trail_comm (tc) { }
+    ~tree_complex_for_command (void);
+
+    tree_argument_list *left_hand_side (void) { return lhs; }
+
+    tree_expression *control_expr (void) { return expr; }
 
-  // No copying!
+    tree_statement_list *body (void) { return list; }
 
-  tree_complex_for_command (const tree_complex_for_command&) = delete;
+    octave_comment_list *leading_comment (void) { return lead_comm; }
+
+    octave_comment_list *trailing_comment (void) { return trail_comm; }
 
-  tree_complex_for_command& operator = (const tree_complex_for_command&) = delete;
+    tree_command *dup (symbol_table::scope_id scope,
+                       symbol_table::context_id context) const;
 
-  ~tree_complex_for_command (void);
-
-  tree_argument_list *left_hand_side (void) { return lhs; }
+    void accept (tree_walker& tw);
 
-  tree_expression *control_expr (void) { return expr; }
+  private:
 
-  tree_statement_list *body (void) { return list; }
+    // Expression to modify.
+    tree_argument_list *lhs;
 
-  octave_comment_list *leading_comment (void) { return lead_comm; }
+    // Expression to evaluate.
+    tree_expression *expr;
 
-  octave_comment_list *trailing_comment (void) { return trail_comm; }
-
-  tree_command *dup (symbol_table::scope_id scope,
-                     symbol_table::context_id context) const;
+    // List of commands to execute.
+    tree_statement_list *list;
 
-  void accept (tree_walker& tw);
+    // Comment preceding FOR token.
+    octave_comment_list *lead_comm;
 
-private:
-
-  // Expression to modify.
-  tree_argument_list *lhs;
+    // Comment preceding ENDFOR token.
+    octave_comment_list *trail_comm;
+  };
+}
 
-  // Expression to evaluate.
-  tree_expression *expr;
+#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
 
-  // List of commands to execute.
-  tree_statement_list *list;
+OCTAVE_DEPRECATED ("use 'octave::tree_while_command' instead")
+typedef octave::tree_while_command tree_while_command;
 
-  // Comment preceding FOR token.
-  octave_comment_list *lead_comm;
+OCTAVE_DEPRECATED ("use 'octave::tree_do_until_command' instead")
+typedef octave::tree_do_until_command tree_do_until_command;
 
-  // Comment preceding ENDFOR token.
-  octave_comment_list *trail_comm;
-};
+OCTAVE_DEPRECATED ("use 'octave::tree_simple_for_command' instead")
+typedef octave::tree_simple_for_command tree_simple_for_command;
+
+OCTAVE_DEPRECATED ("use 'octave::tree_complex_for_command' instead")
+typedef octave::tree_complex_for_command tree_complex_for_command;
 
 #endif
 
+#endif