plcopen
0.22.0
载入中...
搜索中...
未找到
token.h
浏览该文件的文档.
1
#pragma once
2
3
#include <cstdint>
4
#include <string_view>
5
6
#include "
st/types.h
"
7
8
namespace
plcopen::core::st
9
{
10
11
enum class
TokenKind
: std::uint8_t
12
{
13
end_of_input
= 0,
14
error
,
15
16
identifier
,
17
int_literal
,
// decimal or based; value in Token::unsigned_value
18
real_literal
,
// value in Token::real_value
19
time_literal
,
// nanoseconds in Token::signed_value
20
bool_literal
,
// TRUE/FALSE; value in Token::unsigned_value (0/1)
21
typed_literal
,
// TYPE#... ; type in Token::literal_type (L1a 3.4)
22
string_literal
,
23
wstring_literal
,
24
date_literal
,
25
tod_literal
,
26
dt_literal
,
27
located_address
,
// %I/%Q/%M followed by X/B/W/D/L address
28
29
// punctuation
30
assign
,
// :=
31
colon
,
32
semicolon
,
33
comma
,
34
dot
,
35
dotdot
,
// ..
36
hash
,
// user type qualifier: Type#Member
37
lparen
,
38
rparen
,
39
lbracket
,
40
rbracket
,
41
plus
,
42
minus
,
43
star
,
44
star_star
,
// ** power operator (L1a 5.2)
45
slash
,
46
ampersand
,
// & (alias of AND)
47
equal
,
// =
48
not_equal
,
// <>
49
less
,
50
greater
,
51
less_equal
,
52
greater_equal
,
53
54
// keywords (subset; unsupported IEC keywords are classified separately)
55
kw_program
,
56
kw_end_program
,
57
kw_var
,
58
kw_end_var
,
59
kw_if
,
60
kw_then
,
61
kw_elsif
,
62
kw_else
,
63
kw_end_if
,
64
kw_case
,
65
kw_of
,
66
kw_end_case
,
67
kw_for
,
68
kw_to
,
69
kw_by
,
70
kw_do
,
71
kw_end_for
,
72
kw_while
,
73
kw_end_while
,
74
kw_repeat
,
75
kw_until
,
76
kw_end_repeat
,
77
kw_exit
,
78
kw_continue
,
79
kw_return
,
80
kw_and
,
81
kw_or
,
82
kw_xor
,
83
kw_not
,
84
kw_mod
,
85
86
// textual SFC (L6)
87
kw_sfc
,
88
kw_end_sfc
,
89
kw_initial_step
,
90
kw_step
,
91
kw_end_step
,
92
kw_transition
,
93
kw_end_transition
,
94
kw_from
,
95
kw_action
,
96
kw_end_action
,
97
kw_simultaneous
,
98
kw_terminal
,
99
100
// declaration qualifiers
101
kw_constant
,
102
kw_retain
,
103
kw_persistent
,
104
kw_at
,
105
kw_type
,
106
kw_end_type
,
107
kw_array
,
108
kw_struct
,
109
kw_end_struct
,
110
111
// type keywords
112
kw_bool
,
113
kw_int
,
114
kw_dint
,
115
kw_real
,
116
kw_lreal
,
117
kw_time
,
118
kw_sint
,
119
kw_lint
,
120
kw_usint
,
121
kw_uint
,
122
kw_udint
,
123
kw_ulint
,
124
kw_byte
,
125
kw_word
,
126
kw_dword
,
127
kw_lword
,
128
kw_char
,
129
kw_wchar
,
130
kw_string
,
131
kw_wstring
,
132
kw_date
,
133
kw_tod
,
134
kw_dt
,
135
136
// recognized-but-unsupported IEC keyword; payload in Token::diag_code
137
unsupported_keyword
,
138
};
139
140
struct
Token
141
{
142
TokenKind
kind
=
TokenKind::end_of_input
;
143
std::int32_t
line
= 1;
144
std::int32_t
column
= 1;
145
std::string_view
text
;
// slice of the source buffer
146
std::uint64_t
unsigned_value
= 0;
// int/bool literals (magnitude / 0-1)
147
std::int64_t
signed_value
= 0;
// time ns / typed-literal sign marker
148
double
real_value
= 0.0;
// real literals
149
bool
based
=
false
;
// int literal written in 2#/8#/16#
150
bool
real_form
=
false
;
// typed literal carries a real payload
151
Type
literal_type
=
Type::bool_
;
// typed_literal target type
152
std::uint16_t
diag_payload
= 0;
// DiagCode value for error/unsupported
153
bool
debug_provenance
=
false
;
154
std::string_view
debug_pou
;
155
std::string_view
debug_call_path
;
156
std::int32_t
debug_line
= 0;
157
std::int32_t
debug_column
= 0;
158
std::uint16_t
debug_call_depth
= 0;
159
};
160
161
}
// namespace plcopen::core::st
plcopen::core::st
定义
ast.h:15
plcopen::core::st::Type
Type
定义
types.h:20
plcopen::core::st::Type::bool_
@ bool_
定义
types.h:21
plcopen::core::st::StmtKind::assign
@ assign
定义
ast.h:108
plcopen::core::st::TokenKind
TokenKind
定义
token.h:12
plcopen::core::st::TokenKind::kw_transition
@ kw_transition
定义
token.h:92
plcopen::core::st::TokenKind::kw_do
@ kw_do
定义
token.h:70
plcopen::core::st::TokenKind::kw_xor
@ kw_xor
定义
token.h:82
plcopen::core::st::TokenKind::hash
@ hash
定义
token.h:36
plcopen::core::st::TokenKind::kw_udint
@ kw_udint
定义
token.h:122
plcopen::core::st::TokenKind::kw_at
@ kw_at
定义
token.h:104
plcopen::core::st::TokenKind::kw_time
@ kw_time
定义
token.h:117
plcopen::core::st::TokenKind::unsupported_keyword
@ unsupported_keyword
定义
token.h:137
plcopen::core::st::TokenKind::kw_by
@ kw_by
定义
token.h:69
plcopen::core::st::TokenKind::lparen
@ lparen
定义
token.h:37
plcopen::core::st::TokenKind::typed_literal
@ typed_literal
定义
token.h:21
plcopen::core::st::TokenKind::real_literal
@ real_literal
定义
token.h:18
plcopen::core::st::TokenKind::kw_end_if
@ kw_end_if
定义
token.h:63
plcopen::core::st::TokenKind::kw_of
@ kw_of
定义
token.h:65
plcopen::core::st::TokenKind::kw_for
@ kw_for
定义
token.h:67
plcopen::core::st::TokenKind::kw_uint
@ kw_uint
定义
token.h:121
plcopen::core::st::TokenKind::kw_sint
@ kw_sint
定义
token.h:118
plcopen::core::st::TokenKind::kw_and
@ kw_and
定义
token.h:80
plcopen::core::st::TokenKind::kw_to
@ kw_to
定义
token.h:68
plcopen::core::st::TokenKind::kw_end_var
@ kw_end_var
定义
token.h:58
plcopen::core::st::TokenKind::kw_continue
@ kw_continue
定义
token.h:78
plcopen::core::st::TokenKind::located_address
@ located_address
定义
token.h:27
plcopen::core::st::TokenKind::kw_sfc
@ kw_sfc
定义
token.h:87
plcopen::core::st::TokenKind::kw_simultaneous
@ kw_simultaneous
定义
token.h:97
plcopen::core::st::TokenKind::kw_ulint
@ kw_ulint
定义
token.h:123
plcopen::core::st::TokenKind::kw_program
@ kw_program
定义
token.h:55
plcopen::core::st::TokenKind::kw_while
@ kw_while
定义
token.h:72
plcopen::core::st::TokenKind::kw_type
@ kw_type
定义
token.h:105
plcopen::core::st::TokenKind::equal
@ equal
定义
token.h:47
plcopen::core::st::TokenKind::kw_initial_step
@ kw_initial_step
定义
token.h:89
plcopen::core::st::TokenKind::kw_end_sfc
@ kw_end_sfc
定义
token.h:88
plcopen::core::st::TokenKind::kw_persistent
@ kw_persistent
定义
token.h:103
plcopen::core::st::TokenKind::kw_usint
@ kw_usint
定义
token.h:120
plcopen::core::st::TokenKind::rbracket
@ rbracket
定义
token.h:40
plcopen::core::st::TokenKind::greater_equal
@ greater_equal
定义
token.h:52
plcopen::core::st::TokenKind::kw_date
@ kw_date
定义
token.h:132
plcopen::core::st::TokenKind::kw_step
@ kw_step
定义
token.h:90
plcopen::core::st::TokenKind::lbracket
@ lbracket
定义
token.h:39
plcopen::core::st::TokenKind::time_literal
@ time_literal
定义
token.h:19
plcopen::core::st::TokenKind::kw_elsif
@ kw_elsif
定义
token.h:61
plcopen::core::st::TokenKind::dot
@ dot
定义
token.h:34
plcopen::core::st::TokenKind::kw_exit
@ kw_exit
定义
token.h:77
plcopen::core::st::TokenKind::kw_string
@ kw_string
定义
token.h:130
plcopen::core::st::TokenKind::kw_struct
@ kw_struct
定义
token.h:108
plcopen::core::st::TokenKind::kw_lreal
@ kw_lreal
定义
token.h:116
plcopen::core::st::TokenKind::less_equal
@ less_equal
定义
token.h:51
plcopen::core::st::TokenKind::semicolon
@ semicolon
定义
token.h:32
plcopen::core::st::TokenKind::wstring_literal
@ wstring_literal
定义
token.h:23
plcopen::core::st::TokenKind::kw_char
@ kw_char
定义
token.h:128
plcopen::core::st::TokenKind::kw_mod
@ kw_mod
定义
token.h:84
plcopen::core::st::TokenKind::greater
@ greater
定义
token.h:50
plcopen::core::st::TokenKind::kw_until
@ kw_until
定义
token.h:75
plcopen::core::st::TokenKind::kw_array
@ kw_array
定义
token.h:107
plcopen::core::st::TokenKind::kw_or
@ kw_or
定义
token.h:81
plcopen::core::st::TokenKind::kw_end_type
@ kw_end_type
定义
token.h:106
plcopen::core::st::TokenKind::kw_if
@ kw_if
定义
token.h:59
plcopen::core::st::TokenKind::kw_wstring
@ kw_wstring
定义
token.h:131
plcopen::core::st::TokenKind::kw_bool
@ kw_bool
定义
token.h:112
plcopen::core::st::TokenKind::star
@ star
定义
token.h:43
plcopen::core::st::TokenKind::not_equal
@ not_equal
定义
token.h:48
plcopen::core::st::TokenKind::kw_wchar
@ kw_wchar
定义
token.h:129
plcopen::core::st::TokenKind::kw_from
@ kw_from
定义
token.h:94
plcopen::core::st::TokenKind::kw_terminal
@ kw_terminal
定义
token.h:98
plcopen::core::st::TokenKind::slash
@ slash
定义
token.h:45
plcopen::core::st::TokenKind::ampersand
@ ampersand
定义
token.h:46
plcopen::core::st::TokenKind::kw_action
@ kw_action
定义
token.h:95
plcopen::core::st::TokenKind::star_star
@ star_star
定义
token.h:44
plcopen::core::st::TokenKind::kw_end_program
@ kw_end_program
定义
token.h:56
plcopen::core::st::TokenKind::tod_literal
@ tod_literal
定义
token.h:25
plcopen::core::st::TokenKind::dotdot
@ dotdot
定义
token.h:35
plcopen::core::st::TokenKind::kw_word
@ kw_word
定义
token.h:125
plcopen::core::st::TokenKind::kw_byte
@ kw_byte
定义
token.h:124
plcopen::core::st::TokenKind::kw_tod
@ kw_tod
定义
token.h:133
plcopen::core::st::TokenKind::kw_end_action
@ kw_end_action
定义
token.h:96
plcopen::core::st::TokenKind::comma
@ comma
定义
token.h:33
plcopen::core::st::TokenKind::kw_lword
@ kw_lword
定义
token.h:127
plcopen::core::st::TokenKind::int_literal
@ int_literal
定义
token.h:17
plcopen::core::st::TokenKind::kw_else
@ kw_else
定义
token.h:62
plcopen::core::st::TokenKind::kw_dt
@ kw_dt
定义
token.h:134
plcopen::core::st::TokenKind::kw_end_transition
@ kw_end_transition
定义
token.h:93
plcopen::core::st::TokenKind::kw_real
@ kw_real
定义
token.h:115
plcopen::core::st::TokenKind::kw_end_for
@ kw_end_for
定义
token.h:71
plcopen::core::st::TokenKind::kw_var
@ kw_var
定义
token.h:57
plcopen::core::st::TokenKind::kw_end_struct
@ kw_end_struct
定义
token.h:109
plcopen::core::st::TokenKind::end_of_input
@ end_of_input
定义
token.h:13
plcopen::core::st::TokenKind::error
@ error
定义
token.h:14
plcopen::core::st::TokenKind::dt_literal
@ dt_literal
定义
token.h:26
plcopen::core::st::TokenKind::colon
@ colon
定义
token.h:31
plcopen::core::st::TokenKind::kw_lint
@ kw_lint
定义
token.h:119
plcopen::core::st::TokenKind::plus
@ plus
定义
token.h:41
plcopen::core::st::TokenKind::kw_repeat
@ kw_repeat
定义
token.h:74
plcopen::core::st::TokenKind::minus
@ minus
定义
token.h:42
plcopen::core::st::TokenKind::kw_int
@ kw_int
定义
token.h:113
plcopen::core::st::TokenKind::kw_then
@ kw_then
定义
token.h:60
plcopen::core::st::TokenKind::kw_end_repeat
@ kw_end_repeat
定义
token.h:76
plcopen::core::st::TokenKind::less
@ less
定义
token.h:49
plcopen::core::st::TokenKind::kw_retain
@ kw_retain
定义
token.h:102
plcopen::core::st::TokenKind::kw_dint
@ kw_dint
定义
token.h:114
plcopen::core::st::TokenKind::kw_return
@ kw_return
定义
token.h:79
plcopen::core::st::TokenKind::kw_constant
@ kw_constant
定义
token.h:101
plcopen::core::st::TokenKind::rparen
@ rparen
定义
token.h:38
plcopen::core::st::TokenKind::date_literal
@ date_literal
定义
token.h:24
plcopen::core::st::TokenKind::kw_dword
@ kw_dword
定义
token.h:126
plcopen::core::st::TokenKind::kw_end_step
@ kw_end_step
定义
token.h:91
plcopen::core::st::TokenKind::kw_end_case
@ kw_end_case
定义
token.h:66
plcopen::core::st::TokenKind::bool_literal
@ bool_literal
定义
token.h:20
plcopen::core::st::TokenKind::kw_end_while
@ kw_end_while
定义
token.h:73
plcopen::core::st::TokenKind::identifier
@ identifier
定义
token.h:16
plcopen::core::st::TokenKind::string_literal
@ string_literal
定义
token.h:22
plcopen::core::st::TokenKind::kw_not
@ kw_not
定义
token.h:83
plcopen::core::st::TokenKind::kw_case
@ kw_case
定义
token.h:64
plcopen::core::st::Token
定义
token.h:141
plcopen::core::st::Token::real_form
bool real_form
定义
token.h:150
plcopen::core::st::Token::debug_line
std::int32_t debug_line
定义
token.h:156
plcopen::core::st::Token::column
std::int32_t column
定义
token.h:144
plcopen::core::st::Token::line
std::int32_t line
定义
token.h:143
plcopen::core::st::Token::literal_type
Type literal_type
定义
token.h:151
plcopen::core::st::Token::text
std::string_view text
定义
token.h:145
plcopen::core::st::Token::debug_call_path
std::string_view debug_call_path
定义
token.h:155
plcopen::core::st::Token::signed_value
std::int64_t signed_value
定义
token.h:147
plcopen::core::st::Token::diag_payload
std::uint16_t diag_payload
定义
token.h:152
plcopen::core::st::Token::unsigned_value
std::uint64_t unsigned_value
定义
token.h:146
plcopen::core::st::Token::real_value
double real_value
定义
token.h:148
plcopen::core::st::Token::debug_pou
std::string_view debug_pou
定义
token.h:154
plcopen::core::st::Token::debug_column
std::int32_t debug_column
定义
token.h:157
plcopen::core::st::Token::based
bool based
定义
token.h:149
plcopen::core::st::Token::debug_provenance
bool debug_provenance
定义
token.h:153
plcopen::core::st::Token::kind
TokenKind kind
定义
token.h:142
plcopen::core::st::Token::debug_call_depth
std::uint16_t debug_call_depth
定义
token.h:158
types.h
core
st
token.h
制作者
1.15.0