botanist
v0.1.0
Loading...
Searching...
No Matches
include
botanist
token.hpp
Go to the documentation of this file.
1
4
5
#ifndef BOTANIST_TOKEN_H
6
#define BOTANIST_TOKEN_H
7
8
#include <stddef.h>
9
#include <stdint.h>
10
11
namespace
botanist {
12
14
struct
Token
{
16
enum class
Kind
: uint8_t {
18
Empty
,
19
21
Number
,
22
24
Operator
,
25
27
Bracket
,
28
30
Symbol
,
31
33
Terminator
34
};
35
37
Kind
kind
=
Kind::Empty
;
38
40
uint8_t
length
= 0;
41
43
const
char
*
content
=
nullptr
;
44
45
Token
() =
default
;
46
54
Token
(
Kind
kind
,
const
char
*
content
, uint8_t
length
)
55
:
kind
(
kind
),
length
(
length
),
content
(
content
){};
56
};
57
58
}
// namespace botanist
59
60
#endif
/* BOTANIST_TOKEN_H */
botanist::Token
式を構成するトークン
Definition:
token.hpp:14
botanist::Token::length
uint8_t length
contentの長さ
Definition:
token.hpp:40
botanist::Token::content
const char * content
トークンが持つ内容
Definition:
token.hpp:43
botanist::Token::kind
Kind kind
このトークンの種類
Definition:
token.hpp:37
botanist::Token::Token
Token(Kind kind, const char *content, uint8_t length)
トークンを生成
Definition:
token.hpp:54
botanist::Token::Kind
Kind
トークンの種類
Definition:
token.hpp:16
botanist::Token::Kind::Symbol
@ Symbol
それ以外のシンボル
botanist::Token::Kind::Number
@ Number
数値
botanist::Token::Kind::Terminator
@ Terminator
トークン列の終端
botanist::Token::Kind::Bracket
@ Bracket
括弧
botanist::Token::Kind::Empty
@ Empty
リスト内に存在しないトークン
botanist::Token::Kind::Operator
@ Operator
演算子