Ignore:
Timestamp:
Jan 16, 2018, 3:19:23 PM (7 years ago)
Author:
chronos
Message:
  • Added: Support for begin end block.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/easy compiler/USourceCode.pas

    r141 r142  
    116116  end;
    117117
    118   { TSourceInstructionFunction }
    119 
    120   TSourceInstructionFunction = class(TSourceInstruction)
     118  { TSourceFunctionCall }
     119
     120  TSourceFunctionCall = class(TSourceInstruction)
    121121    Name: string;
    122122    Parameters: array of TSourceReference;
    123123    procedure AddParameter(Value: TSourceReference);
     124  end;
     125
     126  TSourceCode = class;
     127
     128  { TSourceBeginEnd }
     129
     130  TSourceBeginEnd = class(TSourceInstruction)
     131    SourceCode: TSourceCode;
     132    Instructions: TSourceInstructions;
     133    constructor Create;
     134    destructor Destroy; override;
    124135  end;
    125136
     
    134145    Constants: TSourceConstants;
    135146    Functions: TSourceFunctions;
    136     Instructions: TSourceInstructions;
     147    Main: TSourceBeginEnd;
    137148    constructor Create;
    138149    destructor Destroy; override;
     
    141152
    142153implementation
     154
     155{ TSourceBeginEnd }
     156
     157constructor TSourceBeginEnd.Create;
     158begin
     159  Instructions := TSourceInstructions.Create;
     160end;
     161
     162destructor TSourceBeginEnd.Destroy;
     163begin
     164  Instructions.Free;
     165  inherited Destroy;
     166end;
    143167
    144168{ TSourceTypes }
     
    290314end;
    291315
    292 { TSourceInstructionFunction }
    293 
    294 procedure TSourceInstructionFunction.AddParameter(Value: TSourceReference);
     316{ TSourceFunctionCall }
     317
     318procedure TSourceFunctionCall.AddParameter(Value: TSourceReference);
    295319begin
    296320  SetLength(Parameters, Length(Parameters) + 1);
     
    339363  Constants := TSourceConstants.Create;
    340364  Functions := TSourceFunctions.Create;
    341   Instructions := TSourceInstructions.Create;
     365  Main := TSourceBeginEnd.Create;
     366  Main.SourceCode := Self;
    342367  InitFunctions;
    343368end;
     
    345370destructor TSourceCode.Destroy;
    346371begin
    347   Instructions.Free;
     372  Main.Free;
    348373  Functions.Free;
    349374  Variables.Free;
Note: See TracChangeset for help on using the changeset viewer.