Mercurial > octave
annotate libinterp/parse-tree/pt-spmd.h @ 33634:4a70f390c85e default tip @
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 28 May 2024 15:25:54 +0200 |
parents | d422992b5483 |
children |
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 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31855
diff
changeset
|
3 // Copyright (C) 2020-2024 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 "pt-cmd.h" |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include "pt-walk.h" |
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
34 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
35 |
33296
70b7f1c285c7
refactor comment handling in the lexer and parser
John W. Eaton <jwe@octave.org>
parents:
32936
diff
changeset
|
36 class comment_list; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
37 class tree_statement_list; |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
39 // Spmd. |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
41 class tree_spmd_command : public tree_command |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
42 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
43 public: |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
33309
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
45 tree_spmd_command (const token& spmd_tok, tree_statement_list *body, const token& end_tok) |
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
46 : m_spmd_tok (spmd_tok), m_body (body), m_end_tok (end_tok) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
47 { } |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31837
diff
changeset
|
49 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_spmd_command) |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
51 ~tree_spmd_command (); |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 |
33309
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
53 filepos beg_pos () const { return m_spmd_tok.beg_pos (); } |
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
54 filepos end_pos () const { return m_end_tok.end_pos (); } |
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
55 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
56 tree_statement_list * body () { return m_body; } |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 void accept (tree_walker& tw) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 tw.visit_spmd_command (*this); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
61 } |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 private: |
28518
b8ab8b58547d
accept spmd command blocks as language elements (bug #58676)
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
33309
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
65 token m_spmd_tok; |
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
66 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
67 // List of commands. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
68 tree_statement_list *m_body; |
33309
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
69 |
d422992b5483
refactor position tracking in the parser
John W. Eaton <jwe@octave.org>
parents:
33296
diff
changeset
|
70 token m_end_tok; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
71 }; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
72 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
73 OCTAVE_END_NAMESPACE(octave) |
28518
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 #endif |