Ignore:
Timestamp:
Jun 4, 2024, 12:22:49 AM (5 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from unit names.
  • Modified: Updated Common package.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Modules/Pascal/AnalyzerPascal.pas

    r74 r75  
    1 unit UAnalyzerPascal;
    2 
    3 {$mode delphi}
     1unit AnalyzerPascal;
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, UAnalyzer, USourceCodePascal, Dialogs, USourceConvertor;
     6  Classes, SysUtils, Analyzer, SourceCodePascal, Dialogs, SourceConvertor;
    97
    108type
     
    1614  public
    1715    Parser: TAnalyzer;
    18     function DebugExpressions(List: TListExpression): string;
     16    function DebugExpressions(List: TExpressions): string;
    1917    function ParseFile(Name: string): Boolean;
    2018    function ParseWhileDo(var WhileDo: TWhileDo; SourceCode: TCommonBlock): Boolean;
    2119    function ParseExpression(SourceCode: TExpression): Boolean;
    2220    function ParseExpressionParenthases(SourceCode: TExpression;
    23       Expressions: TListExpression): Boolean;
     21      Expressions: TExpressions): Boolean;
    2422    function ParseExpressionOperator(SourceCode: TExpression;
    25       Expressions: TListExpression): Boolean;
     23      Expressions: TExpressions): Boolean;
    2624    function ParseExpressionRightValue(SourceCode: TExpression;
    27       Expressions: TListExpression): Boolean;
     25      Expressions: TExpressions): Boolean;
    2826    function ParseExpressionFunctionCall(SourceCode: TExpression;
    29       Expressions: TListExpression; var Func: TFunctionCall): Boolean;
    30     function ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
    31     function ParseUsesItem(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
     27      Expressions: TExpressions; var Func: TFunctionCall): Boolean;
     28    function ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean;
     29    function ParseUsesItem(SourceCode: TUsedModules; AExported: Boolean): Boolean;
    3230    function ParseModule(ProgramCode: TProgram): TSourceModule;
    3331    function ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean;
     
    4038    function ParseCommand(SourceCode: TCommonBlock): TCommand;
    4139    function ParseBeginEnd(var BeginEnd: TBeginEnd; SourceCode: TCommonBlock): Boolean;
    42     function ParseFunction(SourceCode: TFunctionList; Exported: Boolean = False): Boolean;
     40    function ParseFunction(SourceCode: TFunctions; Exported: Boolean = False): Boolean;
    4341    procedure ParseFunctionParameters(SourceCode: TFunction; ValidateParams: Boolean = False);
    4442    function ParseIfThenElse(var IfThenElse: TIfThenElse; SourceCode: TCommonBlock): Boolean;
     
    4644    function ParseAssigment(var Assignment: TAssignment; SourceCode: TCommonBlock): Boolean;
    4745    function ParseFunctionCall(var Call: TFunctionCall; SourceCode: TCommonBlock): Boolean;
    48     function ParseVariableList(SourceCode: TVariableList; Exported: Boolean = False): Boolean;
    49     procedure ParseVariable(SourceCode: TVariableList; Exported: Boolean = False);
    50     function ParseConstantList(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
    51     function ParseConstant(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
    52     function ParseType(TypeList: TTypeList; var NewType: TType; ExpectName: Boolean = True;
     46    function ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean;
     47    procedure ParseVariable(SourceCode: TVariables; Exported: Boolean = False);
     48    function ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean;
     49    function ParseConstant(SourceCode: TConstants; Exported: Boolean = False): Boolean;
     50    function ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True;
    5351      AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean;
    5452    function ParseTypeParameters(var NewType: TType): Boolean;
     
    8684  SNotRecordOrClass = '"%s" not record or class';
    8785
     86
    8887implementation
    8988
    9089{ TAnalyzerPascal }
    9190
    92 function TAnalyzerPascal.DebugExpressions(List: TListExpression): string;
     91function TAnalyzerPascal.DebugExpressions(List: TExpressions): string;
    9392var
    9493  I: Integer;
     
    152151function TAnalyzerPascal.ParseExpression(SourceCode: TExpression): Boolean;
    153152var
    154   Expressions: TListExpression;
     153  Expressions: TExpressions;
    155154  I: Integer;
    156155  II: Integer;
     
    158157(*  with Parser do
    159158  try
    160     Expressions := TListExpression.Create;
     159    Expressions := TExpressions.Create;
    161160    Expressions.Add(TExpression.Create);
    162161    with SourceCode do begin
     
    206205
    207206function TAnalyzerPascal.ParseExpressionParenthases(SourceCode: TExpression;
    208   Expressions: TListExpression): Boolean;
     207  Expressions: TExpressions): Boolean;
    209208var
    210209  NewExpression: TExpression;
     
    230229
    231230function TAnalyzerPascal.ParseExpressionOperator(SourceCode: TExpression;
    232   Expressions: TListExpression): Boolean;
     231  Expressions: TExpressions): Boolean;
    233232begin
    234233  (*if IsOperator(NextToken) then begin
     
    241240
    242241function TAnalyzerPascal.ParseExpressionRightValue(SourceCode: TExpression;
    243   Expressions: TListExpression): Boolean;
     242  Expressions: TExpressions): Boolean;
    244243var
    245244  UseType: TType;
     
    348347    end;
    349348    if Assigned(NewExpression) then begin
    350       TExpression(Expressions.Last).SubItems.Last := NewExpression;
     349      TExpression(Expressions.Last).SubItems[TExpression(Expressions.Last).SubItems.Count - 1] := NewExpression;
    351350      with TExpression(Expressions.Items[Expressions.Add(TExpression.Create)]) do
    352351      begin
    353352        CommonBlock := SourceCode.CommonBlock;
    354         SubItems.First := NewExpression;
     353        SubItems[0] := NewExpression;
    355354      end;
    356355      Result := True;
     
    364363
    365364function TAnalyzerPascal.ParseExpressionFunctionCall(SourceCode: TExpression;
    366   Expressions: TListExpression; var Func: TFunctionCall): Boolean;
     365  Expressions: TExpressions; var Func: TFunctionCall): Boolean;
    367366var
    368367  UseFunction: TFunction;
     
    666665{ TParserParseFunctionList }
    667666
    668 function TAnalyzerPascal.ParseFunction(SourceCode: TFunctionList;
     667function TAnalyzerPascal.ParseFunction(SourceCode: TFunctions;
    669668  Exported: Boolean = False): Boolean;
    670669var
     
    796795        while (NextToken <> ')') and (NextTokenType <> ttEndOfFile) do begin
    797796          // while IsIdentificator(NextCode) do begin
    798           with TParameterList(Parameters) do begin
     797          with TParameters(Parameters) do begin
    799798            VariableName := ReadToken;
    800799            if VariableName = 'var' then begin
     
    948947{ TParserVariableList }
    949948
    950 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariableList; Exported: Boolean = False): Boolean;
     949function TAnalyzerPascal.ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean;
    951950var
    952951  NewValueType: TType;
     
    968967{ TParserVariable }
    969968
    970 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariableList; Exported: Boolean = False);
     969procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariables; Exported: Boolean = False);
    971970var
    972971  VariableName: string;
     
    10161015{ TParserConstantList }
    10171016
    1018 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
     1017function TAnalyzerPascal.ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean;
    10191018begin
    10201019  with Parser do
     
    10301029end;
    10311030
    1032 function TAnalyzerPascal.ParseConstant(SourceCode: TConstantList;
     1031function TAnalyzerPascal.ParseConstant(SourceCode: TConstants;
    10331032  Exported: Boolean): Boolean;
    10341033var
     
    10821081{ TParserType }
    10831082
    1084 function TAnalyzerPascal.ParseType(TypeList: TTypeList; var NewType: TType; ExpectName: Boolean = True;
     1083function TAnalyzerPascal.ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True;
    10851084  AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean;
    10861085begin
     
    14711470{ TParserUsedModuleList }
    14721471
    1473 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
     1472function TAnalyzerPascal.ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean;
    14741473var
    14751474  NewUsedModule: TUsedModule;
     
    14881487end;
    14891488
    1490 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModuleList;
     1489function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModules;
    14911490  AExported: Boolean): Boolean;
    14921491begin
Note: See TracChangeset for help on using the changeset viewer.