codetools: simplified code

git-svn-id: trunk@43214 -
This commit is contained in:
mattias 2013-10-12 08:53:28 +00:00
parent 96a9b7f0db
commit 6849f265a6

View File

@ -187,7 +187,7 @@ type
function KeyWordFuncClassIdentifier: boolean; function KeyWordFuncClassIdentifier: boolean;
// keyword lists // keyword lists
procedure BuildDefaultKeyWordFunctions; override; procedure BuildDefaultKeyWordFunctions; override;
function ParseType(StartPos, WordLen: integer): boolean; function ParseType(StartPos: integer): boolean;
function ParseInnerClass(StartPos, WordLen: integer): boolean; function ParseInnerClass(StartPos, WordLen: integer): boolean;
function UnexpectedKeyWord: boolean; function UnexpectedKeyWord: boolean;
function EndOfSourceExpected: boolean; function EndOfSourceExpected: boolean;
@ -372,7 +372,7 @@ begin
end; end;
end; end;
function TPascalParserTool.ParseType(StartPos, WordLen: integer): boolean; function TPascalParserTool.ParseType(StartPos: integer): boolean;
// KeyWordFunctions for parsing types // KeyWordFunctions for parsing types
// after parsing CurPos is on atom behind type // after parsing CurPos is on atom behind type
var var
@ -422,7 +422,7 @@ begin
end; end;
'T': 'T':
if CompareSrcIdentifiers('TYPE',p) then exit(KeyWordFuncTypeType); if CompareSrcIdentifiers('TYPE',p) then exit(KeyWordFuncTypeType);
'^': if WordLen=1 then exit(KeyWordFuncTypePointer); '^': if CurPos.EndPos-CurPos.StartPos=1 then exit(KeyWordFuncTypePointer);
end; end;
Result:=KeyWordFuncTypeDefault; Result:=KeyWordFuncTypeDefault;
end; end;
@ -3265,7 +3265,7 @@ var
begin begin
ReadNextAtom; ReadNextAtom;
// type // type
ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); ParseType(CurPos.StartPos);
ParentNode:=CurNode.Parent; ParentNode:=CurNode.Parent;
// optional: absolute // optional: absolute
@ -3807,7 +3807,7 @@ begin
if (CurPos.Flag=cafColon) then begin if (CurPos.Flag=cafColon) then begin
// read type // read type
ReadNextAtom; ReadNextAtom;
ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); ParseType(CurPos.StartPos);
end; end;
ReadConstExpr; ReadConstExpr;
// optional: hint modifier // optional: hint modifier
@ -3893,7 +3893,7 @@ begin
SaveRaiseCharExpectedButAtomFound('='); SaveRaiseCharExpectedButAtomFound('=');
// read type // read type
ReadNextAtom; ReadNextAtom;
ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); ParseType(CurPos.StartPos);
// read hint modifier // read hint modifier
ReadHintModifiers; ReadHintModifiers;
// read ; // read ;
@ -4028,7 +4028,7 @@ begin
if (CurPos.StartPos>SrcLen) if (CurPos.StartPos>SrcLen)
or (not PackedTypesKeyWordFuncList.DoIdentifier(@Src[CurPos.StartPos])) then or (not PackedTypesKeyWordFuncList.DoIdentifier(@Src[CurPos.StartPos])) then
SaveRaiseStringExpectedButAtomFound('"record"'); SaveRaiseStringExpectedButAtomFound('"record"');
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
end; end;
function TPascalParserTool.KeyWordFuncTypeBitPacked: boolean; function TPascalParserTool.KeyWordFuncTypeBitPacked: boolean;
@ -4037,7 +4037,7 @@ begin
if (CurPos.StartPos>SrcLen) if (CurPos.StartPos>SrcLen)
or (not BitPackedTypesKeyWordFuncList.DoIdentifier(@Src[CurPos.StartPos])) then or (not BitPackedTypesKeyWordFuncList.DoIdentifier(@Src[CurPos.StartPos])) then
SaveRaiseStringExpectedButAtomFound('"array"'); SaveRaiseStringExpectedButAtomFound('"array"');
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
end; end;
function TPascalParserTool.KeyWordFuncSpecialize: boolean; function TPascalParserTool.KeyWordFuncSpecialize: boolean;
@ -4389,7 +4389,7 @@ begin
if not UpAtomIs('OF') then if not UpAtomIs('OF') then
SaveRaiseStringExpectedButAtomFound('"of"'); SaveRaiseStringExpectedButAtomFound('"of"');
ReadNextAtom; ReadNextAtom;
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
CurNode.EndPos:=CurPos.StartPos; CurNode.EndPos:=CurPos.StartPos;
EndChildNode; // close array EndChildNode; // close array
//debugln(['TPascalParserTool.KeyWordFuncTypeArray END Atom=',GetAtom,' CurNode=',CurNode.DescAsString]); //debugln(['TPascalParserTool.KeyWordFuncTypeArray END Atom=',GetAtom,' CurNode=',CurNode.DescAsString]);
@ -4526,7 +4526,7 @@ begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnTypeType; CurNode.Desc:=ctnTypeType;
ReadNextAtom; ReadNextAtom;
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
EndChildNode; EndChildNode;
end; end;
@ -4538,7 +4538,7 @@ begin
CurNode.Desc:=ctnFileType; CurNode.Desc:=ctnFileType;
if ReadNextUpAtomIs('OF') then begin if ReadNextUpAtomIs('OF') then begin
ReadNextAtom; ReadNextAtom;
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
if not Result then exit; if not Result then exit;
end; end;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
@ -4552,7 +4552,7 @@ begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnPointerType; CurNode.Desc:=ctnPointerType;
ReadNextAtom; ReadNextAtom;
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
EndChildNode; EndChildNode;
end; end;
@ -4846,7 +4846,7 @@ begin
ReadNextAtom; // read next variable name ReadNextAtom; // read next variable name
until false; until false;
ReadNextAtom; // read type ReadNextAtom; // read type
Result:=ParseType(CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=ParseType(CurPos.StartPos);
if not Result then begin if not Result then begin
{$IFDEF VerboseRecordCase} {$IFDEF VerboseRecordCase}
debugln(['TPascalParserTool.KeyWordFuncTypeRecordCase ParseType failed']); debugln(['TPascalParserTool.KeyWordFuncTypeRecordCase ParseType failed']);