?? evmain.pas
字號:
unit EvMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Label2: TLabel;
ListBox1: TListBox;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure ListToken(InList: TList);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R WindowsXP.res}
uses
EvFunction;
procedure TForm1.ListToken(InList: TList);
var
I: Integer;
begin
ListBox1.Clear;
For I := 0 to InList.Count - 1 do
Case PToken(InList.Items[I])^.Token of
tkNumber: ListBox1.Items.Add('tkNumber');
tkAdd: ListBox1.Items.Add('tkAdd');
tkSub: ListBox1.Items.Add('tkSub');
tkMul: ListBox1.Items.Add('tkMul');
tkDiv: ListBox1.Items.Add('tkDiv');
tkLBracket: ListBox1.Items.Add('tkLBracket');
tkRBracket: ListBox1.Items.Add('tkRBracket');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
InList: TList;
sSuffix: String;
ErrCode: Integer;
begin
if Trim(Edit1.Text) = '' then Exit;
InList := TList.Create;
ErrCode := ParseExpression(Edit1.Text,
InList);
if ErrCode > 0 then
begin
MessageBox(Handle,
'Input Error!',
'Error',
MB_ICONERROR);
Edit1.SetFocus;
Edit1.SelStart := ErrCode - 1;
Edit1.SelLength := 1;
Exit;
end;
ListToken(InList);
sSuffix := InsideToSuffix(InList);
Edit2.Text := sSuffix;
Edit3.Text := FloatToStr(Evaluate(sSuffix));
InList.Free;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -