Exemplo n.º 1
0
inline void read(const cv::FileNode& node, LabelInfo& x, const LabelInfo& default_value = LabelInfo())
{
    if(node.empty())
        x = default_value;
    else
        x.read(node);
}
// 标号声明部分--->  label 标识符 003 标号声明列表
bool LabelStatementSemanticser::processSemanticsParser()
{
	bool bProcessResult = false;

	// 获取上一个字符
	const CToken* pParserWord = this->getTokenWordByLastWordIndex();
	if(NULL == pParserWord){
		LogFileInst::instance().logError("LabelStatementSemanticser::processSemanticsParser pParserWord null", __FILE__, __LINE__);
		return bProcessResult;
	}

	// 最开始的过程Id
	ProcStackParserHandler& procStackParserHandler = SemanticsParserMgrInst::instance().getProcStackParserHandler();
	int nStackTopProcId = procStackParserHandler.getTopProcStackProcAddress();
	if(nStackTopProcId < 0){
		LogFileInst::instance().logError("LabelStatementSemanticser::processSemanticsParser getProcStackTop error", __FILE__, __LINE__);
		return bProcessResult;
	}

	// 不能跟过程名重名
	bool bCompareProcName = SymbolTableInst::instance().compareToProcName(nStackTopProcId, pParserWord->m_szContentValue);
	if(true == bCompareProcName){
		LogFileInst::instance().logError("LabelStatementSemanticser::processSemanticsParser compareToProcName error", __FILE__, __LINE__);
		return bProcessResult;
	}

	// 初始化标号信息
	LabelInfo newLableInfo;
	newLableInfo.initStrName(pParserWord->m_szContentValue);
	newLableInfo.initDefValue(false);
	newLableInfo.initUseValue(false);
	newLableInfo.m_nProcIndex = nStackTopProcId;

	// 是否已经存在该标号(从符号表中搜索)
	int nLabelTableIndex = SymbolTableInst::instance().searchLableInfoTable(nStackTopProcId, pParserWord->m_szContentValue);
	if(nLabelTableIndex >= 0){
		LogFileInst::instance().logError("LabelStatementSemanticser::processSemanticsParser searchLableInfoTable error", __FILE__, __LINE__);
		return bProcessResult;
	}

	// 判断完成 放入符号表中
	SymbolTableInst::instance().addLabelInfo(newLableInfo);
	bProcessResult = true;
	return bProcessResult;
}
Exemplo n.º 3
0
inline void write(cv::FileStorage& fs, const String&, const LabelInfo& x)
{
    x.write(fs);
}
Exemplo n.º 4
0
static void write(cv::FileStorage& fs, const std::string&, const LabelInfo& x)
{
    x.write(fs);
}