From 386a8e08f48298126bdff6383c515617c0927c62 Mon Sep 17 00:00:00 2001 From: lazarus Date: Mon, 25 Feb 2002 18:46:06 +0000 Subject: [PATCH] MG: fixed nested record parsing git-svn-id: trunk@1459 - --- components/codetools/definetemplates.pas | 11 ++++++----- components/codetools/finddeclarationtool.pas | 2 +- components/codetools/linkscanner.pas | 5 +++-- components/codetools/pascalparsertool.pas | 14 +++++++++++++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index fd29c962c8..67eb2c6434 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -1740,7 +1740,8 @@ end; function TDefinePool.CreateLazarusSrcTemplate( const LazarusSrcDir, WidgetType: string): TDefineTemplate; -const ds: char = PathDelim; +const + ds: char = PathDelim; var MainDir, DirTempl, SubDirTempl: TDefineTemplate; TargetOS, SrcPath: string; begin @@ -1790,12 +1791,12 @@ begin +'include',da_Define)); MainDir.AddChild(DirTempl); - // Widget Directory + // lcl/interfaces SubDirTempl:=TDefineTemplate.Create('Widget Directory','Widget Directory', - '','interfaces'+ds+WidgetType,da_Directory); + '','interfaces',da_Directory); SubDirTempl.AddChild(TDefineTemplate.Create('LCL Path', - 'adds lcl to SrcPath','SrcPath', - '..'+ds+'..;'+SrcPath,da_Define)); + 'adds lcl to SrcPath',ExternalMacroStart+'SrcPath', + LazarusSrcDir+ds+'lcl;'+SrcPath,da_DefineAll)); DirTempl.AddChild(SubDirTempl); // components diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index db2bdbea2f..af8d29ef9d 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -41,7 +41,7 @@ interface { $DEFINE CTDEBUG} { $DEFINE ShowSearchPaths} -{ $DEFINE ShowTriedFiles} +{$DEFINE ShowTriedFiles} { $DEFINE ShowTriedContexts} { $DEFINE ShowExprEval} { $DEFINE ShowFoundIdentifier} diff --git a/components/codetools/linkscanner.pas b/components/codetools/linkscanner.pas index 96fa129722..a4f0126c47 100644 --- a/components/codetools/linkscanner.pas +++ b/components/codetools/linkscanner.pas @@ -1279,7 +1279,7 @@ var ExpFilename:=APath+AFilename; if not FilenameIsAbsolute(ExpFilename) then ExpFilename:=ExtractFilePath(FMainSourceFilename)+ExpFilename; - NewCode:=LoadSourceCaseSensitive(ExpFilename); + NewCode:=LoadSourceCaseSensitive(ExpandFilename(ExpFilename)); Result:=NewCode<>nil; end; @@ -1300,7 +1300,8 @@ var // filename is relative // first search file in the directory of the main source if FilenameIsAbsolute(FMainSourceFilename) then begin - ExpFilename:=ExtractFilePath(FMainSourceFilename)+AFilename; + ExpFilename:= + ExpandFilename(ExtractFilePath(FMainSourceFilename)+AFilename); NewCode:=LoadSourceCaseSensitive(ExpFilename); if NewCode<>nil then exit; end; diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 8fa7147a1f..7616437123 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -2713,6 +2713,7 @@ begin end; function TPascalParserTool.KeyWordFuncTypeRecordCase: boolean; +var s: string; begin if not UpAtomIs('CASE') then RaiseException('[TPascalParserTool.KeyWordFuncTypeRecordCase] ' @@ -2721,6 +2722,8 @@ begin CurNode.Desc:=ctnRecordCase; ReadNextAtom; // read ordinal type AtomIsIdentifier(true); +s:=GetAtom; +writeln('TPascalParserTool.KeyWordFuncTypeRecordCase ',s); ReadNextAtom; if AtomIsChar(':') then begin ReadNextAtom; @@ -2732,7 +2735,8 @@ begin // read all variants repeat ReadNextAtom; // read constant (variant identifier) - if UpAtomIs('END') then break; +writeln('%%%%% Variant=',GetAtom); + if AtomIsChar(')') or UpAtomIs('END') then break; CreateChildNode; CurNode.Desc:=ctnRecordVariant; repeat @@ -2750,14 +2754,18 @@ begin ReadNextAtom; // read first variable name repeat if AtomIsChar(')') then begin +writeln('%%%%% End of Variant ',GetAtom); // end of variant record break; end else if UpAtomIs('CASE') then begin // sub record variant +writeln('%%%%% SubCase ',GetAtom); KeyWordFuncTypeRecordCase(); +writeln('%%%%% Return from SubCase ',GetAtom); break; end else begin // sub identifier +writeln('%%%%% SubIdentifier ',GetAtom); repeat AtomIsIdentifier(true); CreateChildNode; @@ -2774,6 +2782,7 @@ begin ReadNextAtom; // read type Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos, CurPos.EndPos-CurPos.StartPos); +writeln('%%%%% End of Type ',GetAtom); if not Result then exit; CurNode.EndPos:=CurPos.EndPos; EndChildNode; // close variable definition @@ -2782,10 +2791,12 @@ begin if not AtomIsChar(';') then RaiseException('; expected, but '+GetAtom+' found'); ReadNextAtom; +writeln('%%%%% C ',GetAtom); until false; if not AtomIsChar(')') then RaiseException(') expected, but '+GetAtom+' found'); ReadNextAtom; +writeln('%%%%% CloseVariant ',GetAtom); if UpAtomIs('END') or AtomIsChar(')') then begin CurNode.EndPos:=CurPos.StartPos; EndChildNode; // close variant @@ -2799,6 +2810,7 @@ begin until false; CurNode.EndPos:=CurPos.EndPos; EndChildNode; // close case +writeln('TPascalParserTool.KeyWordFuncTypeRecordCase END ',s); Result:=true; end;