openMSX
events
AdhocCliCommParser.hh
Go to the documentation of this file.
1
#ifndef ADHOCCLICOMMPARSER_HH
2
#define ADHOCCLICOMMPARSER_HH
3
4
#include <cstdint>
5
#include <functional>
6
#include <span>
7
#include <string>
8
9
class
AdhocCliCommParser
10
{
11
public
:
12
explicit
AdhocCliCommParser
(std::function<
void
(
const
std::string&)> callback);
13
void
parse
(std::span<const char> buf);
14
15
private
:
16
void
parse
(
char
c);
17
18
std::function<void(
const
std::string&)> callback;
19
std::string command;
20
uint32_t unicode;
21
enum
State {
22
O0,
// no tag char matched yet
23
O1,
// matched <
24
O2,
// <c
25
O3,
// <co
26
O4,
// <com
27
O5,
// <comm
28
O6,
// <comma
29
O7,
// <comman
30
O8,
// <command
31
C0,
// matched <command>, now parsing xml entities and </command>
32
C1,
// matched <
33
C2,
// </
34
C3,
// </c
35
C4,
// </co
36
C5,
// </com
37
C6,
// </comm
38
C7,
// </comma
39
C8,
// </comman
40
C9,
// </command
41
A1,
// matched &
42
A2,
// &a
43
A3,
// &am
44
A4,
// &
45
P3,
// matched &ap
46
P4,
// &apo
47
P5,
// &apos
48
Q2,
// matched &q
49
Q3,
// &qu
50
Q4,
// &quo
51
Q5,
// "
52
G2,
// matched &g
53
G3,
// >
54
L2,
// matched &l
55
L3,
// <
56
H2,
// matched &#
57
H3,
// &#x
58
} state = O0;
59
};
60
61
#endif
AdhocCliCommParser
Definition
AdhocCliCommParser.hh:10
AdhocCliCommParser::parse
void parse(std::span< const char > buf)
Definition
AdhocCliCommParser.cc:11
Generated on Sat Oct 5 2024 20:13:56 for openMSX by
1.9.8