Classe de test de l'automateclass DEMO
-- inherit AnaLex1 -- analyseur lexical sans actions
inherit ConstLex AnaLex2 -- analyseur lexical avec actions
creation test
feature
test is
local
Bande : BANDEFICH;
ERREUR,bool : BOOLEAN;
do
make; -- ici l'automate est cree
!!Bande.make_fich("essai.txt");
from
ERREUR := false;
until
bande.aubout or else ERREUR
loop
bool := lancer(bande);
if actions.unite.categorie = LexErreur then ERREUR:=true
else
print(lexenclair(actions.unite.categorie)); print(' ');
print(actions.unite.valeur);io.new_line
end – if
end; --loop
if bool then print("%NErreur rencontrée lors de la lecture!");
else print("%NLecture du fichier terminée. ");
end --if
print("%N%N");
end;
end -- class
|