mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 22:40:30 +02:00
MG: fixed nested record parsing
git-svn-id: trunk@1459 -
This commit is contained in:
parent
fbfb9e8cbf
commit
386a8e08f4
@ -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
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
|
||||
{ $DEFINE CTDEBUG}
|
||||
{ $DEFINE ShowSearchPaths}
|
||||
{ $DEFINE ShowTriedFiles}
|
||||
{$DEFINE ShowTriedFiles}
|
||||
{ $DEFINE ShowTriedContexts}
|
||||
{ $DEFINE ShowExprEval}
|
||||
{ $DEFINE ShowFoundIdentifier}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user