Toward template rendering.
This commit is contained in:
parent
eb3b394bdf
commit
350c20efa6
9 changed files with 542 additions and 385 deletions
50
src/compiler/TemplateFile.h
Normal file
50
src/compiler/TemplateFile.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
#include "File.h"
|
||||
|
||||
#include "TemplateNodes.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class TemplateFile
|
||||
{
|
||||
public:
|
||||
TemplateFile(const Path& path);
|
||||
|
||||
std::vector<std::string> getProcessedContent() const;
|
||||
|
||||
std::string getName() const;
|
||||
|
||||
void loadContent();
|
||||
|
||||
void onTextBodyFinished(std::string working_string = {});
|
||||
|
||||
void processLine(const std::string& line);
|
||||
|
||||
void onFoundStatement(const std::string& statement_string);
|
||||
|
||||
void onFoundBlock(const std::vector<std::string> args);
|
||||
|
||||
void onFoundEndBlock(const std::vector<std::string> args);
|
||||
|
||||
void onFoundExtends(const std::vector<std::string> args);
|
||||
|
||||
void onFoundExpression(const std::string& expression_string);
|
||||
|
||||
void dumpContent();
|
||||
|
||||
TemplateNode* getContent() const
|
||||
{
|
||||
return mRootNode.get();
|
||||
}
|
||||
|
||||
private:
|
||||
Path mPath;
|
||||
unsigned mWorkingLine{ 0 };
|
||||
std::string mParentName;
|
||||
std::vector<std::string> mRawContent;
|
||||
std::vector<std::string> mProcessedContent;
|
||||
std::unique_ptr<TemplateNode> mRootNode;
|
||||
TemplateNode* mWorkingNode{ nullptr };
|
||||
std::unique_ptr<TemplateTextBody> mWorkingTextBody;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue