GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
pt-jump.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_pt_jump_h)
27#define octave_pt_jump_h 1
28
29#include "octave-config.h"
30
31#include "pt-cmd.h"
32#include "pt-walk.h"
33
35
36// Base class for jump commands
37
38class OCTINTERP_API tree_jump_command : public tree_command
39{
40public:
41
42 tree_jump_command (const token& tok) : m_token (tok) { }
43
44 OCTAVE_DISABLE_COPY_MOVE (tree_jump_command)
45
46 ~tree_jump_command () = default;
47
48 filepos beg_pos () const { return m_token.beg_pos (); }
49 filepos end_pos () const { return m_token.end_pos (); }
50
51 comment_list leading_comments () const { return m_token.leading_comments (); }
52 comment_list trailing_comments () const { return m_token.trailing_comments (); }
53
54 token jump_token () const { return m_token; }
55
56protected:
57
59};
60
61// Break.
62
63class OCTINTERP_API tree_break_command : public tree_jump_command
64{
65public:
66
68
69 OCTAVE_DISABLE_COPY_MOVE (tree_break_command)
70
71 ~tree_break_command () = default;
72
73 token break_token () const { return jump_token (); }
74
76 {
77 tw.visit_break_command (*this);
78 }
79};
80
81// Continue.
82
83class OCTINTERP_API tree_continue_command : public tree_jump_command
84{
85public:
86
88
89 OCTAVE_DISABLE_COPY_MOVE (tree_continue_command)
90
92
93 token continue_token () const { return jump_token (); }
94
96 {
97 tw.visit_continue_command (*this);
98 }
99};
100
101// Return.
102
103class OCTINTERP_API tree_return_command : public tree_jump_command
104{
105public:
106
108
109 OCTAVE_DISABLE_COPY_MOVE (tree_return_command)
110
112
113 token return_token () const { return jump_token (); }
114
116 {
117 tw.visit_return_command (*this);
118 }
119};
120
121OCTAVE_END_NAMESPACE(octave)
122
123#endif
Definition token.h:42
~tree_break_command()=default
void accept(tree_walker &tw)
Definition pt-jump.h:75
tree_break_command(const token &tok)
Definition pt-jump.h:67
token break_token() const
Definition pt-jump.h:73
tree_continue_command(const token &tok)
Definition pt-jump.h:87
token continue_token() const
Definition pt-jump.h:93
~tree_continue_command()=default
void accept(tree_walker &tw)
Definition pt-jump.h:95
comment_list leading_comments() const
Definition pt-jump.h:51
~tree_jump_command()=default
filepos beg_pos() const
Definition pt-jump.h:48
comment_list trailing_comments() const
Definition pt-jump.h:52
tree_jump_command(const token &tok)
Definition pt-jump.h:42
filepos end_pos() const
Definition pt-jump.h:49
token jump_token() const
Definition pt-jump.h:54
~tree_return_command()=default
void accept(tree_walker &tw)
Definition pt-jump.h:115
token return_token() const
Definition pt-jump.h:113
tree_return_command(const token &tok)
Definition pt-jump.h:107
virtual void visit_return_command(tree_return_command &)
Definition pt-walk.cc:547
virtual void visit_continue_command(tree_continue_command &)
Definition pt-walk.cc:193
virtual void visit_break_command(tree_break_command &)
Definition pt-walk.cc:168
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn