1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| const
blanc=[#9,#10,#13,' ',#23];
tab_sep=[';',',',':','=','(',')'];
tab_opAr=['+','*','/','-','<','>','=','<','=','>','=','<','>'];
l=['a'..'z'];
c=['0'..'9'];
lm=['A'..'Z'];
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
chaine1,chaine:string;
taille,i,k,t:integer;
stp:integer;
ent,ent1:ent_ligne;
begin
for k := 0 to ((code_source.Lines.Count)-1) do
begin
chaine:=code_source.Lines[k];
t:=length(chaine);
edit1.Text:=inttostr(t);
i:=1; stp:=0;
chaine1:='';
while(i<=t)do
begin
if not(chaine[i] in tab_sep)and not(chaine[i]in tab_opar)and not(chaine[i]in blanc) then
begin
if not(chaine[i+1] in tab_sep)and not(chaine[i+1]in tab_opar)and not(chaine[i+1]in blanc) then
begin
chaine1:=chaine1+chaine[i];
memo1.Lines.add(inttostr(i));
//i:=i+1;
end
else
begin
chaine1:=chaine1+chaine[i];
memo3.Lines.add(chaine1);
stp:=1;
// i:=i+1;
end;
end
else
begin
if (chaine[i]in blanc) then memo2.Lines.add('blanc')
else
begin
chaine1:=chaine1+chaine[i];
memo1.Lines.add(chaine1);
stp:=1;
end;
end;
if(stp=1) then
chaine1:='';
stp:=0;
i:=i+1;
end;
end;
end;
end. |
Partager