GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
settings.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-2021 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_settings_h)
27 #define octave_settings_h 1
28 
29 #include "octave-config.h"
30 
31 #include <cstddef>
32 
33 class octave_value;
34 class octave_value_list;
35 
36 namespace octave
37 {
38  // Most settings for the interpreter are stored in the classes which
39  // they affect (intput_system, output_system, load_path, etc. Some
40  // don't really fit anywhere else. For example, there is no single
41  // lexer or parser object, so we store settings for those things
42  // here.
43 
44  class settings
45  {
46  public:
47 
48  settings (void);
49 
50  settings (const settings&) = delete;
51 
52  settings& operator = (const settings&) = delete;
53 
54  ~settings (void) = default;
55 
56  octave_value display_tokens (const octave_value_list& args, int nargout);
57 
58  bool display_tokens (void) const { return m_display_tokens; }
59 
60  bool display_tokens (bool flag)
61  {
62  bool val = m_display_tokens;
63  m_display_tokens = flag;
64  return val;
65  }
66 
67  // Read only.
68  size_t token_count (void) const { return m_token_count; }
69 
71 
72  octave_value lexer_debug_flag (const octave_value_list& args, int nargout);
73 
74  bool lexer_debug_flag (void) const { return m_lexer_debug_flag; }
75 
76  bool lexer_debug_flag (bool flag)
77  {
78  bool val = m_lexer_debug_flag;
79  m_lexer_debug_flag = flag;
80  return val;
81  }
82 
83  private:
84 
85  // Display tokens as they are processed, for debugging.
86  bool m_display_tokens = false;
87 
88  // Number of tokens processed since interpreter startup.
89  size_t m_token_count = 0;
90 
91  // Internal variable for lexer debugging state.
92  bool m_lexer_debug_flag = false;
93  };
94 }
95 
96 #endif
bool m_display_tokens
Definition: settings.h:86
size_t token_count(void) const
Definition: settings.h:68
bool lexer_debug_flag(void) const
Definition: settings.h:74
bool lexer_debug_flag(bool flag)
Definition: settings.h:76
bool display_tokens(void) const
Definition: settings.h:58
settings & operator=(const settings &)=delete
~settings(void)=default
void increment_token_count(void)
Definition: settings.h:70
size_t m_token_count
Definition: settings.h:89
settings(const settings &)=delete
bool m_lexer_debug_flag
Definition: settings.h:92
bool display_tokens(bool flag)
Definition: settings.h:60