ast updated
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "InlineNode.h"
|
||||
#include "ast/InlineNode/InlineNode.h"
|
||||
|
||||
struct Bold : public InlineNode {
|
||||
std::vector<std::unique_ptr<InlineNode>> children;
|
||||
|
||||
NodeKind getKind() const {
|
||||
NodeKind getKind() const override {
|
||||
return NodeKind::Bold;
|
||||
}
|
||||
|
||||
void repr(std::ostream &os, int indent) const override {
|
||||
os << getIndent(indent) << toString(getKind()) << '\n';
|
||||
for (const std::unique_ptr<InlineNode> &child : children) {
|
||||
child->repr(os, indent + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,11 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "InlineNode.h"
|
||||
#include "ast/InlineNode/InlineNode.h"
|
||||
|
||||
struct InlineCode : public InlineNode {
|
||||
std::string inlineCodeString;
|
||||
|
||||
NodeKind getKind() const {
|
||||
NodeKind getKind() const override {
|
||||
return NodeKind::InlineCode;
|
||||
}
|
||||
|
||||
void repr(std::ostream &os, int indent) const override {
|
||||
os << getIndent(indent) << toString(getKind()) << " inline code: " << this->inlineCodeString << '\n';
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Node.h"
|
||||
#include "ast/Node.h"
|
||||
|
||||
struct InlineNode : public Node {
|
||||
virtual ~InlineNode() = default;
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "InlineNode.h"
|
||||
#include "ast/InlineNode/InlineNode.h"
|
||||
|
||||
struct Italic : public InlineNode {
|
||||
std::vector<std::unique_ptr<InlineNode>> children;
|
||||
|
||||
NodeKind getKind() const {
|
||||
NodeKind getKind() const override {
|
||||
return NodeKind::Italic;
|
||||
}
|
||||
|
||||
void repr(std::ostream &os, int indent) const override {
|
||||
os << getIndent(indent) << toString(this->getKind()) << '\n';
|
||||
for (const std::unique_ptr<InlineNode> &child : this->children) {
|
||||
child->repr(os, indent + 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,12 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "InlineNode.h"
|
||||
#include "ast/InlineNode/InlineNode.h"
|
||||
#include "utils/shorten.hpp"
|
||||
|
||||
struct Link : public InlineNode {
|
||||
std::string url;
|
||||
std::vector<std::unique_ptr<InlineNode>> children;
|
||||
|
||||
NodeKind getKind() const {
|
||||
NodeKind getKind() const override {
|
||||
return NodeKind::Link;
|
||||
}
|
||||
|
||||
void repr(std::ostream &os, int indent) const override {
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,11 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "InlineNode.h"
|
||||
#include "ast/InlineNode/InlineNode.h"
|
||||
#include "utils/shorten.hpp"
|
||||
|
||||
struct Text : public InlineNode {
|
||||
std::string text;
|
||||
|
||||
NodeKind getKind() const {
|
||||
NodeKind getKind() const override {
|
||||
return NodeKind::Text;
|
||||
}
|
||||
|
||||
void repr(std::ostream &os, int indent) const override {
|
||||
os << getIndent(indent) << toString(this->getKind()) << " text: " << shorten(this->text) << '\n';
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user