Changeset 75 for trunk/Compiler/Modules/Pascal/AnalyzerPascal.pas
- Timestamp:
- Jun 4, 2024, 12:22:49 AM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Modules/Pascal/AnalyzerPascal.pas
r74 r75 1 unit UAnalyzerPascal; 2 3 {$mode delphi} 1 unit AnalyzerPascal; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UAnalyzer, USourceCodePascal, Dialogs, USourceConvertor;6 Classes, SysUtils, Analyzer, SourceCodePascal, Dialogs, SourceConvertor; 9 7 10 8 type … … 16 14 public 17 15 Parser: TAnalyzer; 18 function DebugExpressions(List: T ListExpression): string;16 function DebugExpressions(List: TExpressions): string; 19 17 function ParseFile(Name: string): Boolean; 20 18 function ParseWhileDo(var WhileDo: TWhileDo; SourceCode: TCommonBlock): Boolean; 21 19 function ParseExpression(SourceCode: TExpression): Boolean; 22 20 function ParseExpressionParenthases(SourceCode: TExpression; 23 Expressions: T ListExpression): Boolean;21 Expressions: TExpressions): Boolean; 24 22 function ParseExpressionOperator(SourceCode: TExpression; 25 Expressions: T ListExpression): Boolean;23 Expressions: TExpressions): Boolean; 26 24 function ParseExpressionRightValue(SourceCode: TExpression; 27 Expressions: T ListExpression): Boolean;25 Expressions: TExpressions): Boolean; 28 26 function ParseExpressionFunctionCall(SourceCode: TExpression; 29 Expressions: T ListExpression; var Func: TFunctionCall): Boolean;30 function ParseUses(SourceCode: TUsedModule List; AExported: Boolean): Boolean;31 function ParseUsesItem(SourceCode: TUsedModule List; 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; 32 30 function ParseModule(ProgramCode: TProgram): TSourceModule; 33 31 function ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean; … … 40 38 function ParseCommand(SourceCode: TCommonBlock): TCommand; 41 39 function ParseBeginEnd(var BeginEnd: TBeginEnd; SourceCode: TCommonBlock): Boolean; 42 function ParseFunction(SourceCode: TFunction List; Exported: Boolean = False): Boolean;40 function ParseFunction(SourceCode: TFunctions; Exported: Boolean = False): Boolean; 43 41 procedure ParseFunctionParameters(SourceCode: TFunction; ValidateParams: Boolean = False); 44 42 function ParseIfThenElse(var IfThenElse: TIfThenElse; SourceCode: TCommonBlock): Boolean; … … 46 44 function ParseAssigment(var Assignment: TAssignment; SourceCode: TCommonBlock): Boolean; 47 45 function ParseFunctionCall(var Call: TFunctionCall; SourceCode: TCommonBlock): Boolean; 48 function ParseVariableList(SourceCode: TVariable List; Exported: Boolean = False): Boolean;49 procedure ParseVariable(SourceCode: TVariable List; Exported: Boolean = False);50 function ParseConstantList(SourceCode: TConstant List; Exported: Boolean = False): Boolean;51 function ParseConstant(SourceCode: TConstant List; Exported: Boolean = False): Boolean;52 function ParseType(TypeList: TType List; 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; 53 51 AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean; 54 52 function ParseTypeParameters(var NewType: TType): Boolean; … … 86 84 SNotRecordOrClass = '"%s" not record or class'; 87 85 86 88 87 implementation 89 88 90 89 { TAnalyzerPascal } 91 90 92 function TAnalyzerPascal.DebugExpressions(List: T ListExpression): string;91 function TAnalyzerPascal.DebugExpressions(List: TExpressions): string; 93 92 var 94 93 I: Integer; … … 152 151 function TAnalyzerPascal.ParseExpression(SourceCode: TExpression): Boolean; 153 152 var 154 Expressions: T ListExpression;153 Expressions: TExpressions; 155 154 I: Integer; 156 155 II: Integer; … … 158 157 (* with Parser do 159 158 try 160 Expressions := T ListExpression.Create;159 Expressions := TExpressions.Create; 161 160 Expressions.Add(TExpression.Create); 162 161 with SourceCode do begin … … 206 205 207 206 function TAnalyzerPascal.ParseExpressionParenthases(SourceCode: TExpression; 208 Expressions: T ListExpression): Boolean;207 Expressions: TExpressions): Boolean; 209 208 var 210 209 NewExpression: TExpression; … … 230 229 231 230 function TAnalyzerPascal.ParseExpressionOperator(SourceCode: TExpression; 232 Expressions: T ListExpression): Boolean;231 Expressions: TExpressions): Boolean; 233 232 begin 234 233 (*if IsOperator(NextToken) then begin … … 241 240 242 241 function TAnalyzerPascal.ParseExpressionRightValue(SourceCode: TExpression; 243 Expressions: T ListExpression): Boolean;242 Expressions: TExpressions): Boolean; 244 243 var 245 244 UseType: TType; … … 348 347 end; 349 348 if Assigned(NewExpression) then begin 350 TExpression(Expressions.Last).SubItems .Last:= NewExpression;349 TExpression(Expressions.Last).SubItems[TExpression(Expressions.Last).SubItems.Count - 1] := NewExpression; 351 350 with TExpression(Expressions.Items[Expressions.Add(TExpression.Create)]) do 352 351 begin 353 352 CommonBlock := SourceCode.CommonBlock; 354 SubItems .First:= NewExpression;353 SubItems[0] := NewExpression; 355 354 end; 356 355 Result := True; … … 364 363 365 364 function TAnalyzerPascal.ParseExpressionFunctionCall(SourceCode: TExpression; 366 Expressions: T ListExpression; var Func: TFunctionCall): Boolean;365 Expressions: TExpressions; var Func: TFunctionCall): Boolean; 367 366 var 368 367 UseFunction: TFunction; … … 666 665 { TParserParseFunctionList } 667 666 668 function TAnalyzerPascal.ParseFunction(SourceCode: TFunction List;667 function TAnalyzerPascal.ParseFunction(SourceCode: TFunctions; 669 668 Exported: Boolean = False): Boolean; 670 669 var … … 796 795 while (NextToken <> ')') and (NextTokenType <> ttEndOfFile) do begin 797 796 // while IsIdentificator(NextCode) do begin 798 with TParameter List(Parameters) do begin797 with TParameters(Parameters) do begin 799 798 VariableName := ReadToken; 800 799 if VariableName = 'var' then begin … … 948 947 { TParserVariableList } 949 948 950 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariable List; Exported: Boolean = False): Boolean;949 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean; 951 950 var 952 951 NewValueType: TType; … … 968 967 { TParserVariable } 969 968 970 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariable List; Exported: Boolean = False);969 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariables; Exported: Boolean = False); 971 970 var 972 971 VariableName: string; … … 1016 1015 { TParserConstantList } 1017 1016 1018 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstant List; Exported: Boolean = False): Boolean;1017 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean; 1019 1018 begin 1020 1019 with Parser do … … 1030 1029 end; 1031 1030 1032 function TAnalyzerPascal.ParseConstant(SourceCode: TConstant List;1031 function TAnalyzerPascal.ParseConstant(SourceCode: TConstants; 1033 1032 Exported: Boolean): Boolean; 1034 1033 var … … 1082 1081 { TParserType } 1083 1082 1084 function TAnalyzerPascal.ParseType(TypeList: TType List; var NewType: TType; ExpectName: Boolean = True;1083 function TAnalyzerPascal.ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True; 1085 1084 AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean; 1086 1085 begin … … 1471 1470 { TParserUsedModuleList } 1472 1471 1473 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModule List; AExported: Boolean): Boolean;1472 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean; 1474 1473 var 1475 1474 NewUsedModule: TUsedModule; … … 1488 1487 end; 1489 1488 1490 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModule List;1489 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModules; 1491 1490 AExported: Boolean): Boolean; 1492 1491 begin
Note:
See TracChangeset
for help on using the changeset viewer.