当前位置: 首页>>代码示例>>C++>>正文


C++ Automate类代码示例

本文整理汇总了C++中Automate的典型用法代码示例。如果您正苦于以下问题:C++ Automate类的具体用法?C++ Automate怎么用?C++ Automate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Automate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

bool E1::Transition ( Automate & automate, Symbole * s )
{
    switch(*s)
    {
        case VAR:
        {
            automate.Decalage(s, new E4);
            return true;
        }
        case CONST:
        {
            automate.Decalage(s, new E5);
            return true;
        }
        case LIRE:
        case ECRIRE:
        case ID:
        case FIN:
        {
            automate.Reduction(new PartieInstructions, 0);
            return true;
        }
        case D:
        {
            automate.Decalage(s, new E3);
            return true;
        }
        case PI:
        {
            automate.Decalage(s, new E2);
            return true;
        }
    }
    return false;
}
开发者ID:H4112,项目名称:GrammairesLangages,代码行数:35,代码来源:E1.cpp

示例2:

bool Etat23::transition(Automate & automate, Symbole * s ){
	int idSym = *s ; 
	switch (idSym) {
		case pf :
		case add :
		case moins :
		case fois :
		case divise :
		case pv :
			//Reduction r20 : F -> num
		{
			Num* num= (Num*) automate.getNthSymbole(0);
			num->setF();

			automate.popAndDeleteState();
			automate.popSymbole();

			automate.reduction(num);
			break;
		}
			
		default : break;
	}
	return false;
}
开发者ID:Salma-El-Alaoui,项目名称:GL,代码行数:25,代码来源:etat23.cpp

示例3: throw

bool E34::transition(Automate& automate, Symbole* symbole) throw(std::pair<int, string>) {
	switch (symbole->getType())
	{
		case(VG) :
			automate.decalageTerminal(symbole, new E35);
			return true;
		case(PVG) :
			automate.decalageTerminal(symbole, new E39);
			return true;
		case(ID) :
			Symbole* symboleAnticipe = new Symbole();
			symboleAnticipe->setType(VG);
			automate.decalageAnticipe(symboleAnticipe, new E35);
			std::pair<int, string> p = std::make_pair(0, "Erreur syntaxique symbole \",\" attendu");
			throw(p);
			return true;
	}
	Symbole* symboleAnticipe = new Symbole();
	symboleAnticipe->setType(PVG);
	automate.decalageAnticipe(symboleAnticipe, new E39);
	std::pair<int, string> p = std::make_pair(0, "Erreur syntaxique symbole \";\" attendu");
	throw(p);

	return true;
}
开发者ID:HEX4114,项目名称:ProjetLG,代码行数:25,代码来源:E34.cpp

示例4: switch

bool GeneratedState0::Transition (Automate & automate, Symbole *s)
{
    // Generated code :
    switch ((int)*s) {
    case CONST:
        automate.Reduction(0);
        break;
    case ECRIRE:
         automate.Reduction(0);
        break;
    case IDENTIFIANT:
         automate.Reduction(0);
        break;
    case LIRE:
         automate.Reduction(0);
        break;
    case PDECL:
        automate.Decalage(s, new GeneratedState0p);
        break;
    case VAR:
        automate.Reduction(0);
        break;
    case PROGRAMME:
        automate.Consommer();
        Programme* progSymbole;
        progSymbole = static_cast<Programme*>(s);
        automate.Accepter(progSymbole);
        break;
    default:
        automate.SetErreur();
        break;
    }
    return false;

}
开发者ID:Brindesable,项目名称:interpreteur-lutin,代码行数:35,代码来源:GeneratedState0.cpp

示例5: Symbole

bool Etat8::transition(Automate & automate, Symbole * s ){
	int idSym = *s ; 
	switch (idSym) {
		case af :
			automate.decalage(s, new Etat17("17"));
		break;
		default :
            automate.recuperation(new Symbole(107), true); // on est sûr qu'il manque un :=
        break;
	}
	return false;
}
开发者ID:Salma-El-Alaoui,项目名称:GL,代码行数:12,代码来源:etat8.cpp

示例6: switch

bool GeneratedState1122::Transition (Automate & automate, Symbole *s)
{   
    // Generated code :
    switch ((int)*s) {
    case OUVRE_PAR:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState114);
        break;
    case FACTEUR:
        automate.Decalage(s, new GeneratedState11221);
        break;
    case IDENTIFIANT:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState115);
        break;
    case VALEUR:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState116);
        break;
    default:
        automate.SetErreur();
        break;
    }
    return false;
}
开发者ID:Brindesable,项目名称:interpreteur-lutin,代码行数:25,代码来源:GeneratedState1122.cpp

示例7: switch

bool GeneratedState1::Transition (Automate & automate, Symbole *s)
{
    // Generated code :
    switch ((int)*s) {
    case FIN:
        automate.Reduction(2);
        break;
    case ECRIRE:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState11);
        break;

    case IDENTIFIANT:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState13);
        break;
    case LIRE:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState12);
        break;
    default:
        automate.SetErreur();
        break;
    }
    return false;

}
开发者ID:Brindesable,项目名称:interpreteur-lutin,代码行数:27,代码来源:GeneratedState1.cpp

示例8: switch

bool GeneratedState12p::Transition (Automate & automate, Symbole *s)
{
    // Generated code :
    switch ((int)*s) {
    case POINT_VIRGULE:
        automate.Consommer();
        automate.Decalage(s, new GeneratedState12s);
        break;
    default:
        automate.SetErreur();
        break;
    }
    return false;

}
开发者ID:Brindesable,项目名称:interpreteur-lutin,代码行数:15,代码来源:GeneratedState12p.cpp

示例9: switch

bool E29::Transition ( Automate & automate, Symbole * s )
{
    switch(*s)
    {
        case FERMEPAR:
        {
            automate.Decalage(s, new E36);
            return true;
        }
        case OPA:
        {
            automate.Decalage(s, new E27);
            return true;
        }
    }
    return false;
}
开发者ID:H4112,项目名称:GrammairesLangages,代码行数:17,代码来源:E29.cpp

示例10: throw

bool E28::transition(Automate& automate, Symbole* symbole) throw(std::pair<int, string>) {
	switch (symbole->getType())
	{
		case(PLUS) :
			automate.decalageTerminal(symbole, new E14);
			return true;
		case(MOINS) :
			automate.decalageTerminal(symbole, new E14);
			return true;
		case(PVG) :
			automate.decalageTerminal(symbole, new E29);
			return true;
	}
	std::pair<int, string> p = std::make_pair(1, "Erreur de syntaxe (attendu : \"+\", \"-\" ou \";\").");
	throw(p);
	return false;
}
开发者ID:HEX4114,项目名称:ProjetLG,代码行数:17,代码来源:E28.cpp

示例11:

bool Etat20::transition(Automate & automate, Symbole * s ){
	int idSym = *s ; 
	switch (idSym) {
		case fois :
			automate.decalage(s, new Etat33("33"));
		break;
		case divise :
			automate.decalage(s, new Etat34("34"));
		break;
		case pf :
		case add :
		case moins :
		case pv :
		{
			//TODO : r16 E → T
			Expression* expr = (Expression*)automate.getNthSymbole(0);
			expr->setE();

			automate.popAndDeleteState();
			automate.popSymbole();

			automate.reduction(expr);
			break;
		}
		case OM : 
			automate.decalage(s, new Etat32("32"));
		break;
		default:
		break;
	}
	return false;
}
开发者ID:Salma-El-Alaoui,项目名称:GL,代码行数:32,代码来源:etat20.cpp

示例12: switch

bool E4::Transition ( Automate & automate, Symbole * s )
{
    switch(*s)
    {
        case ID:
        {
            automate.Decalage(s, new E12);
            return true;
        }
        case LID:
        {
            automate.Decalage(s, new E11);
            return true;
        }
    }
    
    return false;
}
开发者ID:H4112,项目名称:GrammairesLangages,代码行数:18,代码来源:E4.cpp

示例13:

bool Etat42::transition(Automate & automate, Symbole * s ){
	int idSym = *s ; 
	switch (idSym) {
		case num :
			automate.decalage(s, new Etat43("43"));
			break;
		default : break;
	}
	return false;
}
开发者ID:Salma-El-Alaoui,项目名称:GL,代码行数:10,代码来源:etat42.cpp

示例14:

bool Etat13::transition(Automate & automate, Symbole * s ){
	int idSym = *s ; 
	switch (idSym) {
		case eg :
			automate.decalage(s, new Etat26("26"));
			break;
		default : break;
	}
	return false;
}
开发者ID:Salma-El-Alaoui,项目名称:GL,代码行数:10,代码来源:etat13.cpp

示例15: switch

bool E10::Transition ( Automate & automate, Symbole * s )
{
    switch(*s)
    {
        case VAR:
        case CONST:
        case LIRE:
        case ECRIRE:
        case ID:
        case FIN:
        {
            //Symbole * point_virgule = 
            delete automate.PopSymbole();
            ListeDeclaration * d = (ListeDeclaration *) automate.PopSymbole();
            PartieDeclarative * pd = (PartieDeclarative *) automate.PopSymbole();

            if( ! pd->AjouterDeclarations(d) )
            {
                // nettoyer les Declaration
                for(Declaration * decl : d->GetListeDeclarations())
                {
                    delete decl;
                }
                delete d;
                for(auto & decl : pd->GetDeclarations())
                {
                    delete decl.second;
                }
                delete pd;

                throw DOUBLE_DECLARATION;
            }
            else
            {
                delete d;
                automate.Reduction(pd, 3);
                return true;
            }
        }
    }
    return false;
}
开发者ID:H4112,项目名称:GrammairesLangages,代码行数:42,代码来源:E10.cpp


注:本文中的Automate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。