#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);

	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);
	};
}
