Exemplo n.º 1
0
LPIType RDOArrayType::type_cast(const LPIType& pFrom, const RDOParserSrcInfo& from_src_info, const RDOParserSrcInfo& to_src_info, const RDOParserSrcInfo& src_info) const
{
    ASSERT(pFrom);

    LPRDOArrayType pFromArrayType = pFrom.object_dynamic_cast<RDOArrayType>();
    if (pFromArrayType)
    {
        LPRDOArrayType pThisArrayType(const_cast<RDOArrayType*>(this));

        if (pThisArrayType->getItemType()->itype()->type_cast(pFromArrayType->getItemType()->itype(), pFromArrayType->src_info(), pThisArrayType->src_info(), pFromArrayType->src_info()))
        {
            // Это один и тот же тип
            return pThisArrayType;
        }

        parser::g_error().push_only(src_info,    rdo::format("Несоответствие размерности массива"));
        parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
        parser::g_error().push_done();
    }

    parser::g_error().push_only(src_info,    rdo::format("Ожидается тип массива, найдено: %s", from_src_info.src_text().c_str()));
    parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
    parser::g_error().push_done();

    return NULL;
}
Exemplo n.º 2
0
//! 2
void Error::error(const RDOParserSrcInfo& src_info1, const RDOParserSrcInfo& src_info2, const std::string& message)
{
	if (blocked())
		return;

	push_only(src_info1.src_pos().m_last_line != src_info2.src_pos().m_last_line ? src_info1 : src_info2, message);
	throw RDOSyntaxException(m_errorList.back().getText());
}
Exemplo n.º 3
0
void Error::push_only(const RDOParserSrcInfo& src_info, const std::string& message)
{
	if (blocked())
		return;

	if (src_info.src_pos().m_last_line != rdo::runtime::RDOSrcInfo::Position::UNDEFINE_LINE && src_info.src_pos().m_last_pos != rdo::runtime::RDOSrcInfo::Position::UNDEFINE_POS)
	{
		m_errorList.push_back(rdo::simulation::report::FileMessage(message, src_info.src_filetype(), src_info.src_pos().m_last_line, src_info.src_pos().m_last_pos));
	}
}
Exemplo n.º 4
0
void Error::warning(const RDOParserSrcInfo& src_info, const std::string& message) 
{
	if (blocked())
		return;

	m_errorList.push_back(rdo::simulation::report::FileMessage(message, src_info.src_filetype(), src_info.src_pos().m_last_line, src_info.src_pos().m_last_pos, FileMessage::MT_WARNING));
}
Exemplo n.º 5
0
LPRDOValue RDOArrayType::value_cast(const LPRDOValue& pFrom, const RDOParserSrcInfo& to_src_info, const RDOParserSrcInfo& src_info) const
{
    ASSERT(pFrom);

    LPRDOArrayType pFromArrayType = pFrom->typeInfo()->itype().object_dynamic_cast<RDOArrayType>();
    if (pFromArrayType)
    {
        LPRDOArrayType  pThisArrayType(const_cast<RDOArrayType*>(this));
        LPRDOArrayValue pThisArrayValue = rdo::Factory<RDOArrayValue>::create(pThisArrayType);
        ASSERT(pThisArrayValue);

        rdo::runtime::LPRDOArrayValue pFromArrayValue = pFrom->get<RDOArrayValue>()->createRuntimeValue();
        ASSERT(pFromArrayValue);

        for (rdo::runtime::LPRDOArrayIterator it = pFromArrayValue->begin(); !it->equal(pFromArrayValue->end()); it->next())
        {
            LPRDOValue pItemValue = rdo::Factory<RDOValue>::create(it->getValue(), src_info, pThisArrayType->getItemType());
            ASSERT(pItemValue);
            pThisArrayValue->insertItem(pThisArrayType->getItemType()->itype()->value_cast(pItemValue, to_src_info, src_info));
        }
        return rdo::Factory<RDOValue>::create(pThisArrayType->typeInfo(), pThisArrayValue, pFrom->src_info());
    }

    parser::g_error().push_only(src_info,    rdo::format("Ожидается массив, найдено: %s", pFrom->src_text().c_str()));
    parser::g_error().push_only(to_src_info, rdo::format("См. тип: %s", to_src_info.src_text().c_str()));
    parser::g_error().push_done();

    return NULL;
}
Exemplo n.º 6
0
RDOPROCProcess::RDOPROCProcess(const RDOParserSrcInfo& info, const std::string& name, LPRDORTPResType transactType)
	: RDOParserSrcInfo(info        )
	, m_closed        (false       )
	, m_name          (name        )
	, m_transactType  (transactType)
{
	RDOParser::s_parser()->insertPROCProcess(this);
	m_pRuntime = rdo::Factory<rdo::runtime::RDOPROCProcess>::create(info.src_text(), RDOParser::s_parser()->runtime());
	ASSERT(m_pRuntime);
	m_pRuntime.object_dynamic_cast<ILogic>()->init(RDOParser::s_parser()->runtime());
}