Coverage Report

Created: 2026-09-14 06:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mosh/src/terminal/parserstate.h
Line
Count
Source
1
/*
2
    Mosh: the mobile shell
3
    Copyright 2012 Keith Winstein
4
5
    This program is free software: you can redistribute it and/or modify
6
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation, either version 3 of the License, or
8
    (at your option) any later version.
9
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
15
    You should have received a copy of the GNU General Public License
16
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
    In addition, as a special exception, the copyright holders give
19
    permission to link the code of portions of this program with the
20
    OpenSSL library under certain conditions as described in each
21
    individual source file, and distribute linked combinations including
22
    the two.
23
24
    You must obey the GNU General Public License in all respects for all
25
    of the code used other than OpenSSL. If you modify file(s) with this
26
    exception, you may extend this exception to your version of the
27
    file(s), but you are not obligated to do so. If you do not wish to do
28
    so, delete this exception statement from your version. If you delete
29
    this exception statement from all source files in the program, then
30
    also delete it here.
31
*/
32
33
#ifndef PARSERSTATE_HPP
34
#define PARSERSTATE_HPP
35
36
#include "parsertransition.h"
37
38
namespace Parser {
39
class StateFamily;
40
41
class State
42
{
43
protected:
44
  virtual Transition input_state_rule( wchar_t ch ) const = 0;
45
  StateFamily* family;
46
47
private:
48
  Transition anywhere_rule( wchar_t ch ) const;
49
50
public:
51
56
  void setfamily( StateFamily* s_family ) { family = s_family; }
52
  Transition input( wchar_t ch ) const;
53
22.0k
  virtual ActionPointer enter( void ) const { return std::make_shared<Ignore>(); }
54
829k
  virtual ActionPointer exit( void ) const { return std::make_shared<Ignore>(); }
55
56
56
  State() : family( NULL ) {};
57
0
  virtual ~State() {};
58
59
  State( const State& );
60
  State& operator=( const State& );
61
};
62
63
class Ground : public State
64
{
65
  Transition input_state_rule( wchar_t ch ) const;
66
};
67
68
class Escape : public State
69
{
70
  ActionPointer enter( void ) const;
71
  Transition input_state_rule( wchar_t ch ) const;
72
};
73
74
class Escape_Intermediate : public State
75
{
76
  Transition input_state_rule( wchar_t ch ) const;
77
};
78
79
class CSI_Entry : public State
80
{
81
  ActionPointer enter( void ) const;
82
  Transition input_state_rule( wchar_t ch ) const;
83
};
84
class CSI_Param : public State
85
{
86
  Transition input_state_rule( wchar_t ch ) const;
87
};
88
class CSI_Intermediate : public State
89
{
90
  Transition input_state_rule( wchar_t ch ) const;
91
};
92
class CSI_Ignore : public State
93
{
94
  Transition input_state_rule( wchar_t ch ) const;
95
};
96
97
class DCS_Entry : public State
98
{
99
  ActionPointer enter( void ) const;
100
  Transition input_state_rule( wchar_t ch ) const;
101
};
102
class DCS_Param : public State
103
{
104
  Transition input_state_rule( wchar_t ch ) const;
105
};
106
class DCS_Intermediate : public State
107
{
108
  Transition input_state_rule( wchar_t ch ) const;
109
};
110
class DCS_Passthrough : public State
111
{
112
  ActionPointer enter( void ) const;
113
  Transition input_state_rule( wchar_t ch ) const;
114
  ActionPointer exit( void ) const;
115
};
116
class DCS_Ignore : public State
117
{
118
  Transition input_state_rule( wchar_t ch ) const;
119
};
120
121
class OSC_String : public State
122
{
123
  ActionPointer enter( void ) const;
124
  Transition input_state_rule( wchar_t ch ) const;
125
  ActionPointer exit( void ) const;
126
};
127
class SOS_PM_APC_String : public State
128
{
129
  Transition input_state_rule( wchar_t ch ) const;
130
};
131
}
132
133
#endif