44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "ast_basic.h"
|
|
#include "ast_gen.h"
|
|
#include "libsyntax.h"
|
|
#include <libtoken.h>
|
|
#include <tokens_novel.h>
|
|
|
|
namespace example_novel {
|
|
/**
|
|
* @brief 节点类型
|
|
* ExprNode::typeMark() 返回值
|
|
*/
|
|
enum NovelExprs {
|
|
DESPITE = -1,
|
|
DESC_SECTION = 0,
|
|
FRAG_REFERS = 1,
|
|
FRAG_DEFINES = 2,
|
|
STORY_DEFINES = 3,
|
|
DOC_DEFINES = 4,
|
|
VOLUME_DEFINE = 5,
|
|
ARTICLE_DEFINE = 6,
|
|
};
|
|
|
|
class LIBSYNTAX_EXPORT NovalSyntax {
|
|
public:
|
|
/**
|
|
* @brief 获取novel词法解析器
|
|
* @param path 文件路径
|
|
* @param name 文件名称
|
|
* @return
|
|
*/
|
|
static std::shared_ptr<const lib_token::TokenReader> getLexReader();
|
|
|
|
/**
|
|
* @brief 获取novel语法解析树
|
|
* @return
|
|
*/
|
|
static std::shared_ptr<const lib_syntax::ExpressionRule> getParseTree();
|
|
|
|
static std::shared_ptr<const ast_gen::SyntaxElement> tidy(std::shared_ptr<const ast_gen::SyntaxElement> root, QList<std::shared_ptr<ast_gen::SyntaxElement>> docs);
|
|
};
|
|
|
|
} // namespace example_novel
|