annotate libinterp/parse-tree/pt-spmd.h @ 29359:7854d5752dd2

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 10:10:40 -0500
parents b8ab8b58547d
children 796f54d4ddbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28518
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 ////////////////////////////////////////////////////////////////////////
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 //
29359
7854d5752dd2 maint: merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 28518
diff changeset
3 // Copyright (C) 2020-2021 The Octave Project Developers
28518
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 // distribution or <https://octave.org/copyright/>.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 // This file is part of Octave.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 // under the terms of the GNU General Public License as published by
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 // (at your option) any later version.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 // GNU General Public License for more details.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 // along with Octave; see the file COPYING. If not, see
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 // <https://www.gnu.org/licenses/>.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 //
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 ////////////////////////////////////////////////////////////////////////
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if ! defined (octave_pt_spmd_command_h)
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #define octave_pt_spmd_command_h 1
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include "octave-config.h"
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 #include "base-list.h"
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "pt-cmd.h"
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "pt-walk.h"
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 namespace octave
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 {
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 class tree_comment_list;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 class tree_statement_list;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 // Spmd.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 class tree_spmd_command : public tree_command
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 {
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 public:
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 tree_spmd_command (tree_statement_list *body, comment_list *lc,
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 comment_list *tc, int l = -1, int c = -1)
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 : tree_command (l, c), m_body (body), m_lead_comm (lc), m_trail_comm (tc)
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 { }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 // No copying!
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 tree_spmd_command (const tree_spmd_command&) = delete;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 tree_spmd_command& operator = (const tree_spmd_command&) = delete;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 ~tree_spmd_command (void);
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 tree_statement_list * body (void) { return m_body; }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 comment_list * leading_comment (void) { return m_lead_comm; }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 comment_list * trailing_comment (void) { return m_trail_comm; }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 void accept (tree_walker& tw)
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 {
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 tw.visit_spmd_command (*this);
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 private:
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 // List of commands.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 tree_statement_list *m_body;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 // Comment preceding SPMD token.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 comment_list *m_lead_comm;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 // Comment preceding ENDSPMD token.
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 comment_list *m_trail_comm;
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 };
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 }
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
b8ab8b58547d accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 #endif