59 lines
1.4 KiB
C
59 lines
1.4 KiB
C
|
|
#ifndef PARSER_FOUNDATION_H
|
|||
|
|
#define PARSER_FOUNDATION_H
|
|||
|
|
|
|||
|
|
#include "libParse_global.h"
|
|||
|
|
#include "syntax_foundation.h"
|
|||
|
|
|
|||
|
|
namespace Parser {
|
|||
|
|
/**
|
|||
|
|
* @brief 关键字定义,完全匹配
|
|||
|
|
*/
|
|||
|
|
class KeywordDef : public Lex::TokenDef {
|
|||
|
|
public:
|
|||
|
|
KeywordDef(const QString ®ex, const QString &type);
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
QString regex_store;
|
|||
|
|
QString type_store;
|
|||
|
|
|
|||
|
|
// TokenDef interface
|
|||
|
|
public:
|
|||
|
|
virtual QString typeName() const override;
|
|||
|
|
virtual QString regexp() const override;
|
|||
|
|
virtual Lex::Token *analysis(const Lex::WordBase &word) override;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 部分匹配
|
|||
|
|
*/
|
|||
|
|
class SectionMatch : public Lex::TokenDef {
|
|||
|
|
public:
|
|||
|
|
SectionMatch(const QString ®ex, const QString &type);
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
QString regex_store;
|
|||
|
|
QString type_store;
|
|||
|
|
|
|||
|
|
// TokenDef interface
|
|||
|
|
public:
|
|||
|
|
virtual QString typeName() const override;
|
|||
|
|
virtual QString regexp() const override;
|
|||
|
|
virtual Lex::Token *analysis(const Lex::WordBase &word) override;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
class LIBPARSE_EXPORT ChainParser {
|
|||
|
|
public:
|
|||
|
|
ChainParser();
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
SyntaxX::ElmRule node_refer;
|
|||
|
|
SyntaxX::ElmRule text_section;
|
|||
|
|
SyntaxX::ElmRule desc_pragraph;
|
|||
|
|
SyntaxX::ElmRule node_def;
|
|||
|
|
SyntaxX::ElmRule chain_def;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
} // namespace Parser
|
|||
|
|
|
|||
|
|
#endif // PARSER_FOUNDATION_H
|