Advertisement
r4lovets

Untitled

Oct 1st, 2019
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.98 KB | None | 0 0
  1. {
  2.   optCounter := 0;
  3.   opdCounter := 0;
  4.  
  5.   i := 0;
  6.   while (i < len) do
  7.   begin
  8.     if ((code[i] >= 'a') and (code[i] <= 'z')) or ((code[i] >= 'A') and (code[i] <= 'Z')) then
  9.     begin
  10.       word := '';
  11.       while ((code[i] >= 'a') and (code[i] <= 'z')) or ((code[i] >= 'A') and (code[i] <= 'Z')) or ((code[i] >= '0') and (code[i] <= '9')) or (code[i] = '_') do
  12.       begin
  13.         word := word + code[i];
  14.         Inc(i);
  15.       end;
  16.  
  17.       if (code[i] = '(') then
  18.       begin
  19.         word := word + '(' + ')';
  20.         operators[optCounter] := word;
  21.         Inc(optCounter);
  22.       end;
  23.  
  24.     end;
  25.     Inc(i);
  26.   end;
  27.  
  28.   //--- Литералы ---
  29.   word := '';
  30.   if (code[i] >= '0') and (code[i] <= '9') then
  31.     begin
  32.       while (code[i] >= '0') and (code[i] <= '9') do
  33.       begin
  34.         word := word + code[i];
  35.       end;
  36.  
  37.       if code[i] = '.' then
  38.       begin
  39.         word := word + code[i];
  40.         Inc(i);
  41.  
  42.         while (code[i] >= '0') and (code[i] <= '9') do
  43.         begin
  44.           word := word + code[i];
  45.         end;
  46.  
  47.         if (code[i] = 'f') and (code[i] = 'd') then
  48.         begin
  49.           word := word + code[i];
  50.           Inc(i);
  51.         end;
  52.       end
  53.       else if code[i] = 'L' then
  54.       begin
  55.           word := word + code[i];
  56.           Inc(i);
  57.       end;
  58.  
  59.       Operands[opdCounter] := word;
  60.       Inc(opdCounter);
  61.     end;
  62.  
  63.   word := '';
  64.   if code[i] = '"' then
  65.   begin
  66.     word := word + code[i];
  67.     Inc(i);
  68.  
  69.     while code[i] <> '"' do
  70.     begin
  71.       word := word + code[i];
  72.       Inc(i);
  73.     end;
  74.  
  75.     word := word + code[i];
  76.     Inc(i);
  77.  
  78.     Operands[opdCounter] := word;
  79.     Inc(opdCounter);
  80.   end;
  81.  
  82.   word := '';
  83.   if code[i] = '''' then
  84.   begin
  85.     word := word + code[i];
  86.     Inc(i);
  87.  
  88.     while code[i] <> '''' do
  89.     begin
  90.       word := word + code[i];
  91.       Inc(i);
  92.     end;
  93.  
  94.     word := word + code[i];
  95.     Inc(i);
  96.  
  97.     Operands[opdCounter] := word;
  98.     Inc(opdCounter);
  99.   end;
  100.  
  101.           }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement