refactored ast, started lexer
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#include "ast/InlineNode/Bold.h"
|
||||
|
||||
namespace ast {
|
||||
NodeKind Bold::getKind() const {
|
||||
return NodeKind::Bold;
|
||||
}
|
||||
|
||||
void Bold::repr(std::ostream &os, int indent) const {
|
||||
os << getIndent(indent) << toString(getKind()) << '\n';
|
||||
for (const std::unique_ptr<InlineNode> &child : this->children) {
|
||||
child->repr(os, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "ast/InlineNode/InlineCode.h"
|
||||
|
||||
namespace ast {
|
||||
NodeKind InlineCode::getKind() const {
|
||||
return NodeKind::InlineCode;
|
||||
}
|
||||
|
||||
void InlineCode::repr(std::ostream &os, int indent) const {
|
||||
os << getIndent(indent) << toString(getKind()) << " inline code: " << this->inlineCodeString << '\n';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "ast/InlineNode/Italic.h"
|
||||
|
||||
namespace ast {
|
||||
NodeKind Italic::getKind() const {
|
||||
return NodeKind::Italic;
|
||||
}
|
||||
|
||||
void Italic::repr(std::ostream &os, int indent) const {
|
||||
os << getIndent(indent) << toString(this->getKind()) << '\n';
|
||||
for (const std::unique_ptr<InlineNode> &child : this->children) {
|
||||
child->repr(os, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "ast/InlineNode/Link.h"
|
||||
|
||||
namespace ast {
|
||||
NodeKind Link::getKind() const {
|
||||
return NodeKind::Link;
|
||||
}
|
||||
|
||||
void Link::repr(std::ostream &os, int indent) const {
|
||||
os << getIndent(indent) << toString(this->getKind()) << " link: " << shorten(this->url) << '\n';
|
||||
for (const std::unique_ptr<InlineNode> &child : this->children) {
|
||||
child->repr(os, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "ast/InlineNode/Text.h"
|
||||
|
||||
namespace ast {
|
||||
NodeKind Text::getKind() const {
|
||||
return NodeKind::Text;
|
||||
}
|
||||
|
||||
void Text::repr(std::ostream &os, int indent) const {
|
||||
os << getIndent(indent) << toString(this->getKind()) << " text: " << shorten(this->text) << '\n';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user