botanist
v0.1.0
Loading...
Searching...
No Matches
include
botanist
syntaxnode.hpp
Go to the documentation of this file.
1
4
5
#ifndef BOTANIST_SYNTAX_NODE_H
6
#define BOTANIST_SYNTAX_NODE_H
7
8
#include <stdint.h>
9
10
#include "
token.hpp
"
11
12
namespace
botanist {
13
15
struct
SyntaxNode
{
17
enum class
Kind
: uint8_t {
19
Empty
,
20
22
Add
,
23
25
Subtract
,
26
28
Multiply
,
29
31
Divide
,
32
34
Number
,
35
37
Invalid
38
};
39
41
Kind
kind
=
Kind::Empty
;
42
44
const
char
*
content
=
nullptr
;
45
47
size_t
length
= 0;
48
49
SyntaxNode
() =
default
;
50
58
SyntaxNode
(
const
SyntaxNode::Kind
kind
,
const
char
*
content
,
size_t
length
) :
kind
(
kind
),
content
(
content
),
length
(
length
){};
59
};
60
61
}
// namespace botanist
62
63
#endif
/* BOTANIST_SYNTAX_NODE_H */
botanist::SyntaxNode
構文木のノード
Definition:
syntaxnode.hpp:15
botanist::SyntaxNode::SyntaxNode
SyntaxNode(const SyntaxNode::Kind kind, const char *content, size_t length)
値を渡してノードオブジェクトを初期化
Definition:
syntaxnode.hpp:58
botanist::SyntaxNode::Kind
Kind
ノードの種類
Definition:
syntaxnode.hpp:17
botanist::SyntaxNode::Kind::Divide
@ Divide
除算
botanist::SyntaxNode::Kind::Subtract
@ Subtract
減算
botanist::SyntaxNode::Kind::Invalid
@ Invalid
無効なノード
botanist::SyntaxNode::Kind::Number
@ Number
数値
botanist::SyntaxNode::Kind::Empty
@ Empty
ツリー中に存在しないノード
botanist::SyntaxNode::Kind::Multiply
@ Multiply
乗算
botanist::SyntaxNode::Kind::Add
@ Add
加算
botanist::SyntaxNode::length
size_t length
contentの長さ
Definition:
syntaxnode.hpp:47
botanist::SyntaxNode::kind
Kind kind
このノードの種類
Definition:
syntaxnode.hpp:41
botanist::SyntaxNode::content
const char * content
ノードが持つ内容
Definition:
syntaxnode.hpp:44
token.hpp
数式トークン