GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
settings.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2018-2022 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 (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include "defun.h"
31#include "interpreter.h"
32#include "ov.h"
33#include "ovl.h"
34#include "settings.h"
35#include "variables.h"
36
37OCTAVE_NAMESPACE_BEGIN
38
40 : m_display_tokens (false), m_token_count (0),
41 m_lexer_debug_flag (false)
42 { }
43
45 int nargout)
46 {
47 return set_internal_variable (m_display_tokens, args, nargout,
48 "__display_tokens__");
49 }
50
52 int nargout)
53 {
54 return set_internal_variable (m_lexer_debug_flag, args, nargout,
55 "__lexer_debug_flag__");
56 }
57
58DEFMETHOD (__display_tokens__, interp, args, nargout,
59 doc: /* -*- texinfo -*-
60@deftypefn {} {} __display_tokens__ ()
61Query or set the internal variable that determines whether Octave's
62lexer displays tokens as they are read.
63@seealso{__lexer_debug_flag__, __token_count__}
64@end deftypefn */)
65{
66 settings& stgs = interp.get_settings ();
67
68 return stgs.display_tokens (args, nargout);
69}
70
71DEFMETHOD (__token_count__, interp, , ,
72 doc: /* -*- texinfo -*-
73@deftypefn {} {} __token_count__ ()
74Return the number of language tokens processed since Octave startup.
75@seealso{__lexer_debug_flag__, __display_tokens__}
76@end deftypefn */)
77{
78 settings& stgs = interp.get_settings ();
79
80 return octave_value (stgs.token_count ());
81}
82
83DEFMETHOD (__lexer_debug_flag__, interp, args, nargout,
84 doc: /* -*- texinfo -*-
85@deftypefn {} {@var{val} =} __lexer_debug_flag__ ()
86@deftypefnx {} {@var{old_val} =} __lexer_debug_flag__ (@var{new_val})
87Query or set the internal flag that determines whether Octave's lexer prints
88debug information as it processes an expression.
89@seealso{__display_tokens__, __token_count__, __parse_debug_flag__}
90@end deftypefn */)
91{
92 settings& stgs = interp.get_settings ();
93
94 return stgs.lexer_debug_flag (args, nargout);
95}
96
97OCTAVE_NAMESPACE_END
bool m_lexer_debug_flag
Definition: settings.h:92
octave_value lexer_debug_flag(const octave_value_list &args, int nargout)
Definition: settings.cc:51
std::size_t token_count(void) const
Definition: settings.h:68
bool lexer_debug_flag(void) const
Definition: settings.h:74
octave_value display_tokens(const octave_value_list &args, int nargout)
Definition: settings.cc:44
bool display_tokens(void) const
Definition: settings.h:58
bool m_display_tokens
Definition: settings.h:86
settings(void)
Definition: settings.cc:39
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:111
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)
Definition: variables.cc:587