This repository was archived by the owner on Apr 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlexeme.h
More file actions
127 lines (111 loc) · 3.05 KB
/
Copy pathlexeme.h
File metadata and controls
127 lines (111 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#pragma once
#include <boost/variant.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <iosfwd>
namespace sap
{
struct lex
{
enum class type : uint8_t
{ SYMBOL
, INDENT
, DEDENT
, NEWLINE
, D_CONST
, B_CONST
, S_CONST
, RESERVED
, IDENTIFIER
, RULE
, EPS
, COUNT
}; // enum class type
enum class symbol : uint8_t
{ COMMA // ,
, DOT // .
, L_PARENTHESIS // (
, R_PARENTHESIS // )
, PLUS // +
, MINUS // -
, STAR // *
, SLASH // /
, EQUAL // ==
, ASSIGN // =
, LESS // <
, GREATER // >
, NOT_EQUAL // !=
, COLON // :
, COUNT
}; // enum class symbol
enum class reserved_word : uint8_t
{ DEF
, CLASS
, IF
, ELSE
, WHILE
, BREAK
, RETURN
, PRINT
, INPUT
, COUNT
}; // enum class reserved_words
enum class rule : uint8_t
{ APPLICABLE
, ASSIGNMENT
, CLASS_DECL
, CLASS_LIST
, CLASSES
, COMPARATOR_EQ
, COMPARATOR_INT
, ELSELINE
, EXPR_INT
, FCALL
, IFLINE
, INPUT
, LOGIC_BOOL
, LOGIC_INT
, LOGIC_STR
, LOGIC
, MCALL
, METHOD_DECL
, METHOD_LIST
, METHODS
, MPARAMS
, MPARAM_LIST
, OPERAND_INT
, OPERAND_BOOL
, OPERAND_STR
, OPERATOR_INT
, PARAM_LIST
, PARAMS
, RIGHTSIDE
, SLINE_LIST
, SLINES
, SLINE
, START
, WHILELINE
, NEW_IDENTIFIER
, BREAKLINE
, RETURNLINE
, PRINTLINE
, COUNT
}; // enum class rule
type type_;
typedef boost::variant< rule, symbol, reserved_word, std::string, uint, double, bool > value;
value value_;
static const char* const type_STRINGS [ static_cast< uint8_t >( lex::type::COUNT ) ];
static const char* const symbol_STRINGS [ static_cast< uint8_t >( lex::symbol::COUNT ) ];
static const char* const reserved_STRINGS [ static_cast< uint8_t >( lex::reserved_word::COUNT ) ];
static const char* const rule_STRINGS [ static_cast< uint8_t >( lex::rule::COUNT ) ];
}; // struct lex
std::ostream& operator<<( std::ostream& out, lex::type rhs );
std::ostream& operator<<( std::ostream& out, lex::symbol rhs );
std::ostream& operator<<( std::ostream& out, lex::reserved_word rhs );
std::ostream& operator<<( std::ostream& out, lex::rule rhs );
std::ostream& operator<<( std::ostream& out, lex rhs );
} // namespace sap
BOOST_FUSION_ADAPT_STRUCT(
sap::lex,
(sap::lex::type, type_)
(sap::lex::value, value_)
)