50 lines
1017 B
C++
50 lines
1017 B
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
namespace ast {
|
|
enum class NodeKind {
|
|
CodeBlock,
|
|
Header,
|
|
List,
|
|
ListItem,
|
|
Paragraph,
|
|
|
|
Bold,
|
|
InlineCode,
|
|
Italic,
|
|
Link,
|
|
Text
|
|
};
|
|
|
|
const std::string toString(NodeKind kind) {
|
|
switch (kind) {
|
|
case NodeKind::CodeBlock:
|
|
return "CodeBlock";
|
|
case NodeKind::Header:
|
|
return "Header";
|
|
case NodeKind::List:
|
|
return "List";
|
|
case NodeKind::ListItem:
|
|
return "ListItem";
|
|
case NodeKind::Paragraph:
|
|
return "Paragraph";
|
|
|
|
case NodeKind::Bold:
|
|
return "Bold";
|
|
case NodeKind::InlineCode:
|
|
return "InlineCode";
|
|
case NodeKind::Italic:
|
|
return "Italic";
|
|
case NodeKind::Link:
|
|
return "Link";
|
|
case NodeKind::Text:
|
|
return "Text";
|
|
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
}
|