GNU Octave
10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Loading...
Searching...
No Matches
pt-delimiter-list.h
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 2024-2025 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_tree_delimiter_list_h)
27
#define octave_tree_delimiter_list_h 1
28
29
#include "octave-config.h"
30
31
#include <stack>
32
33
#include "
filepos.h
"
34
#include "
token.h
"
35
36
OCTAVE_BEGIN_NAMESPACE
(octave)
37
38
class
tree_delimiter_list
39
{
40
public
:
41
42
typedef
std::pair<token, token>
element_type
;
43
44
OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE (
tree_delimiter_list
)
45
46
size_t count ()
const
{
return
m_delimiters.size (); }
47
48
bool
empty
()
const
{
return
m_delimiters.empty (); }
49
50
void
push
(
const
token
& open_delim,
const
token
& close_delim)
51
{
52
m_delimiters.push (
element_type
(open_delim, close_delim));
53
}
54
55
filepos
beg_pos
()
const
56
{
57
if
(m_delimiters.empty ())
58
return
filepos
();
59
60
const
element_type
& elt = m_delimiters.top ();
61
return
elt.first.beg_pos ();
62
}
63
64
filepos
end_pos
()
const
65
{
66
if
(m_delimiters.empty ())
67
return
filepos
();
68
69
const
element_type
& elt = m_delimiters.top ();
70
return
elt.second.end_pos ();
71
}
72
73
private
:
74
75
std::stack<element_type> m_delimiters;
76
};
77
78
OCTAVE_END_NAMESPACE(octave)
79
80
#endif
filepos
Definition
filepos.h:34
token
Definition
token.h:42
tree_delimiter_list
Definition
pt-delimiter-list.h:39
tree_delimiter_list::push
void push(const token &open_delim, const token &close_delim)
Definition
pt-delimiter-list.h:50
tree_delimiter_list::beg_pos
filepos beg_pos() const
Definition
pt-delimiter-list.h:55
tree_delimiter_list::end_pos
filepos end_pos() const
Definition
pt-delimiter-list.h:64
tree_delimiter_list::empty
bool empty() const
Definition
pt-delimiter-list.h:48
tree_delimiter_list::element_type
std::pair< token, token > element_type
Definition
pt-delimiter-list.h:42
OCTAVE_BEGIN_NAMESPACE
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
filepos.h
token.h
libinterp
parse-tree
pt-delimiter-list.h
Generated on Sat Aug 2 2025 06:52:13 for GNU Octave by
1.9.8