Changeset 149 for branches/easy compiler/UCompiler.pas
- Timestamp:
- Jan 18, 2018, 1:30:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/easy compiler/UCompiler.pas
r148 r149 50 50 ): Boolean; 51 51 function ParseFunctionCall(SourceCode: TSourceCode; out FunctionCall: TCommandFunctionCall): Boolean; 52 function ParseIfEqual(SourceCode: TSourceCode; out IfZero: TCommandIfEqual): Boolean; 52 function ParseIfEqual(SourceCode: TSourceCode; out IfEqual: TCommandIfEqual): Boolean; 53 function ParseIfNotEqual(SourceCode: TSourceCode; out IfNotEqual: TCommandIfNotEqual): Boolean; 53 54 function ParseReference(SourceCode: TSourceCode): TSourceReference; 54 55 function ParseReferenceVariable(SourceCode: TSourceCode): TSourceReference; … … 327 328 end; 328 329 329 function TCompiler.ParseIfEqual(SourceCode: TSourceCode; out If Zero: TCommandIfEqual): Boolean;330 function TCompiler.ParseIfEqual(SourceCode: TSourceCode; out IfEqual: TCommandIfEqual): Boolean; 330 331 var 331 332 Token: TSourceToken; … … 338 339 Keyword := LowerCase(Token.Text); 339 340 if Keyword = 'ifequal' then begin 340 IfZero := TCommandIfEqual.Create; 341 IfZero.Reference1 := ParseReference(SourceCode); 342 IfZero.Reference2 := ParseReference(SourceCode); 341 IfEqual := TCommandIfEqual.Create; 342 IfEqual.Reference1 := ParseReference(SourceCode); 343 IfEqual.Reference2 := ParseReference(SourceCode); 344 Result := True; 345 end; 346 if not Result then Tokenizer.TokenIndex := TokenIndex; 347 end; 348 349 function TCompiler.ParseIfNotEqual(SourceCode: TSourceCode; out 350 IfNotEqual: TCommandIfNotEqual): Boolean; 351 var 352 Token: TSourceToken; 353 TokenIndex: Integer; 354 Keyword: string; 355 begin 356 Result := False; 357 TokenIndex := Tokenizer.TokenIndex; 358 Token := Tokenizer.GetNext; 359 Keyword := LowerCase(Token.Text); 360 if Keyword = 'ifnotequal' then begin 361 IfNotEqual := TCommandIfNotEqual.Create; 362 IfNotEqual.Reference1 := ParseReference(SourceCode); 363 IfNotEqual.Reference2 := ParseReference(SourceCode); 343 364 Result := True; 344 365 end; … … 390 411 var 391 412 CommandBeginEnd: TCommandBeginEnd; 392 CommandIf Zero: TCommandIfEqual;413 CommandIfEqual: TCommandIfEqual; 393 414 CommandFunctionCall: TCommandFunctionCall; 394 415 CommandBreak: TCommandBreak; 395 416 CommandRepeat: TCommandRepeat; 417 CommandIfNotEqual: TCommandIfNotEqual; 396 418 begin 397 419 Command := nil; … … 401 423 Command := CommandBeginEnd; 402 424 end else 403 if ParseIfEqual(SourceCode, CommandIfZero) then begin 404 Command := CommandIfZero; 425 if ParseIfEqual(SourceCode, CommandIfEqual) then begin 426 Command := CommandIfEqual; 427 end else 428 if ParseIfNotEqual(SourceCode, CommandIfNotEqual) then begin 429 Command := CommandIfNotEqual; 405 430 end else 406 431 if ParseBreak(SourceCode, CommandBreak) then begin
Note:
See TracChangeset
for help on using the changeset viewer.