Пример #1
0
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;
}
Пример #2
0
bool E21::transition(Automate& automate, Symbole* symbole) throw(std::pair<int, string>) {
	switch (symbole->getType())
	{
		case(ID) :
			automate.decalageTerminal(symbole, new E19);
			return true;
		case(NB) :
			automate.decalageTerminal(symbole, new E20);
			return true;
		case(PARG) :
			automate.decalageTerminal(symbole, new E21);
			return true;
		case(E) :
			automate.decalageNonTerminal(symbole, new E23);
			return true;
		case(T) :
			automate.decalageNonTerminal(symbole, new E22);
			return true;
		case(F) :
			automate.decalageNonTerminal(symbole, new E18);
			return true;
	}
	std::pair<int, string> p = std::make_pair(1, "Erreur de syntaxe (attendu : \"(\", nombre, id, ou expression).");
	throw(p);
	return false;
}
Пример #3
0
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;
}
Пример #4
0
bool E32::transition(Automate& automate, Symbole *symbole) throw(std::pair<int, string>) {
	switch (symbole->getType())
	{
		case(NB) :
			automate.decalageTerminal(symbole, new E33);
			return true;
	}
	std::pair<int, string> p = std::make_pair(1, "Erreur de syntaxe nombre attendu");
	throw(p);
	return false;
}