34 lines
983 B
C++
34 lines
983 B
C++
#pragma once
|
|
#include <QString>
|
|
#include <QList>
|
|
#include "SyntaxBase.h"
|
|
|
|
namespace Syntax
|
|
{
|
|
/**
|
|
* 基础解析器框架.
|
|
*/
|
|
class ParseFrame
|
|
{
|
|
public:
|
|
explicit ParseFrame();
|
|
virtual ~ParseFrame() = default;
|
|
|
|
QList<Parse::Result::DesNode*> analysis(Parse::Result::DocCore *doc, const QString &path);
|
|
QList<Parse::Result::DesNode*> analysisSource(Parse::Result::DocCore *doc, const QString &src);
|
|
|
|
protected:
|
|
void appendTokensDefine(QList<Lex::LexDef> seqs, const QString &unknown_token);
|
|
void appendParser(Syntax::SyntaxParser* u);
|
|
|
|
private:
|
|
QString unknown_token;
|
|
QList<Lex::LexDef> token_seqs;
|
|
QList<SyntaxParser*> cascade_parsers;
|
|
|
|
ParseResult ParseFrame::inner_parse(QList<Lex::LexResult> &lex_seqence,
|
|
QList<Syntax::SyntaxParser*> parsers,
|
|
QList<Parse::Result::DesNode*> &nodes_out);
|
|
};
|
|
}
|