#pragma once
/*************************************************

Copyright:

Author:liyuzhe

Date:2021-07-12

Description:描述编译器的实现流程基类

**************************************************/
#include "SConfig.h"
#include <cstring>
#include <cstdint>
#include <string>
#include <vector>
#include <map>
U_NS_BEGIN_SH_LANGUAGE


enum SH_INTFILE_TYPE {
	SH_FILE_TYPE_USER = 0,  //用户文件
	SH_FILE_TYPE_PROJECT = 1,  //工程文件
	SH_FILE_TYPE_SYSTEM = 2, //系统文件

};

enum SH_OUTFILE_TYPE {
	SH_FILE_TYPE_ULC = 0, //领域语言编译器输出的ULC数据文件
	SH_FILE_TYPE_TXT = 1, //领域语言编译器输出的txt数据文件
	SH_FILE_TYPE_MONI = 2  //领域语言编译器的模拟数据，虚拟机模拟器要用
};


class SHFileInfo;
class SHCompileLogInfo;
class SH_CROSS_PLATFORM_API SHCompiler
{
public:
	virtual ~SHCompiler();
	explicit SHCompiler();
	typedef void(*ULogCallBack)(const std::string& sourceId, SHCompileLogInfo* msg, void* userData);

	void SetLogout(const std::string& logCtx, ULogCallBack logCB,void* userData);
	//生成标准编译ulc
	bool SHCompile(const std::map<SH_INTFILE_TYPE, std::string>& inputMap, std::map<SH_OUTFILE_TYPE, std::vector<SHFileInfo*>>& output);

	std::string GetTokenList(const std::map<SH_INTFILE_TYPE, std::string>& inputMap, const std::string& eventCondition,
		const std::string& partCondition, const std::string& trueResult, const std::string& falseResult);

	SHCompileLogInfo* GetErr();

private:
	U_SH_DISABLE_COPY(SHCompiler)

	class SHCompilerPrivate;
	SHCompilerPrivate* m_private;
};

SH_CROSS_PLATFORM_API std::string GetShSdkVersion();

U_NS_END_SH_LANGUAGE

