mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:39:20 +02:00
codetools: do not save errors outside parser
git-svn-id: trunk@37213 -
This commit is contained in:
parent
ea0537d6bd
commit
855af79e42
@ -358,7 +358,7 @@ begin
|
||||
ReadPrefixModifier;
|
||||
// read parameter name(s)
|
||||
repeat
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
CurParam.Name:=CurPos;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafComma then
|
||||
|
@ -1326,7 +1326,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if (CurPos.StartPos>EndPos) or (CurPos.Flag=cafNone) then exit;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
//DebugLn(['AddNeededUnitsForRange ',GetAtom]);
|
||||
// save cursor
|
||||
OldCursor:=CurPos;
|
||||
@ -1658,7 +1658,7 @@ var
|
||||
AssignmentOperator:=CurPos.StartPos;
|
||||
ReadPriorAtom;
|
||||
// check event name
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
PropVarAtom:=CurPos;
|
||||
|
||||
// check for semicolon at end of statement
|
||||
@ -2532,7 +2532,7 @@ var
|
||||
MoveCursorToCleanPos(ExprStartPos);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then
|
||||
if AtomIsIdentifier then
|
||||
Result:=GetAtom
|
||||
else
|
||||
Result:='';
|
||||
@ -2651,7 +2651,7 @@ const
|
||||
// read procname
|
||||
MoveCursorToCleanPos(CleanCursorPos);
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ProcNameAtom:=CurPos;
|
||||
// read bracket
|
||||
ReadNextAtom;
|
||||
@ -3641,7 +3641,7 @@ var
|
||||
if CurPos.Flag<>cafColon then exit;
|
||||
// read result type
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
|
||||
// check if there is a public definition of the procedure
|
||||
NodeText:=GetRedefinitionNodeText(ProcNode);
|
||||
@ -3689,7 +3689,7 @@ var
|
||||
if (CurPos.Flag in [cafSemicolon,cafEnd]) then
|
||||
break;
|
||||
// check if all identifiers can be used in a constant expression
|
||||
if AtomIsIdentifier(false)
|
||||
if AtomIsIdentifier
|
||||
and not CheckExprIdentifier(@Src[CurPos.StartPos]) then
|
||||
exit;
|
||||
ExprEnd:=CurPos.EndPos;
|
||||
@ -4683,7 +4683,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
|
||||
FromPos:=Node.StartPos;
|
||||
MoveCursorToNodeStart(Node);
|
||||
ReadNextAtom;// read identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ToPos:=FindLineEndOrCodeAfterPosition(CurPos.EndPos,true);
|
||||
end else begin
|
||||
// this is for example: var a,b: integer
|
||||
@ -4691,12 +4691,12 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
|
||||
// => remove ,b plus the space behind
|
||||
MoveCursorToNodeStart(Node.PriorBrother);
|
||||
ReadNextAtom;// read identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;// read comma
|
||||
if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
|
||||
FromPos:=CurPos.StartPos;
|
||||
ReadNextAtom;// read identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;//read colon
|
||||
if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':');
|
||||
ToPos:=CurPos.StartPos;
|
||||
@ -4713,7 +4713,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
|
||||
FromPos:=FindLineEndOrCodeInFrontOfPosition(Node.StartPos);
|
||||
MoveCursorToNodeStart(Node);
|
||||
ReadNextAtom;// read identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;// read comma
|
||||
if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
|
||||
ToPos:=CurPos.StartPos;
|
||||
@ -4809,7 +4809,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
|
||||
NewTxt:=GetIdentifier(@Src[Node.StartPos]);
|
||||
MoveCursorToNodeStart(GetLastVarDefSequenceNode(Node));
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;
|
||||
if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':');
|
||||
FromPos:=CurPos.StartPos;
|
||||
@ -5093,7 +5093,7 @@ function TCodeCompletionCodeTool.BuildUnitDefinitionGraph(out
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if (CurPos.StartPos>=ToPos) or (CurPos.StartPos>SrcLen) then break;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
Identifier:=@Src[CurPos.StartPos];
|
||||
NodeExt:=FindCodeTreeNodeExtWithIdentifier(
|
||||
DefinitionsTreeOfCodeTreeNodeExt,
|
||||
@ -5602,7 +5602,7 @@ function TCodeCompletionCodeTool.FindAssignMethod(CursorPos: TCodeXYPosition;
|
||||
if NodeExt.Node.Desc=ctnProperty then begin
|
||||
if PropertyHasSpecifier(NodeExt.Node,'write') then begin
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
WrittenNodeExt:=FindCodeTreeNodeExtWithIdentifier(MemberNodeExts,
|
||||
@Src[CurPos.StartPos]);
|
||||
if WrittenNodeExt<>nil then
|
||||
@ -6267,7 +6267,7 @@ var
|
||||
Parts[SpecWord]:=CurPos;
|
||||
ReadNextAtom;
|
||||
if AtomIsChar(';') then exit;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
|
||||
CurPos.EndPos-CurPos.StartPos)
|
||||
then
|
||||
@ -6276,7 +6276,7 @@ var
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;
|
||||
PartIsAtom[SpecParam]:=false;
|
||||
Parts[SpecParam].EndPos:=CurPos.EndPos;
|
||||
@ -6343,7 +6343,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
procedure CheckIdentifier;
|
||||
begin
|
||||
if (CurPos.StartPos>PropNode.EndPos)
|
||||
or UpAtomIs('END') or AtomIsChar(';') or (not AtomIsIdentifier(false))
|
||||
or UpAtomIs('END') or AtomIsChar(';') or (not AtomIsIdentifier)
|
||||
or AtomIsKeyWord then begin
|
||||
// no type name found -> ignore this property
|
||||
RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]);
|
||||
@ -6436,7 +6436,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
ReadSimpleSpec(ppImplementsWord,ppImplements);
|
||||
while CurPos.Flag=cafComma do begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
|
||||
CurPos.EndPos-CurPos.StartPos) then
|
||||
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
|
||||
|
@ -172,6 +172,7 @@ type
|
||||
// dirty/dead source
|
||||
procedure LoadDirtySource(const CursorPos: TCodeXYPosition);
|
||||
procedure FetchScannerSource(Range: TLinkScannerRange); virtual;
|
||||
function InternalAtomIsIdentifier: boolean; inline;
|
||||
public
|
||||
Tree: TCodeTree;
|
||||
|
||||
@ -273,7 +274,6 @@ type
|
||||
function AtomIs(const AnAtom: shortstring): boolean;
|
||||
function UpAtomIs(const AnAtom: shortstring): boolean;
|
||||
function UpAtomIs(const AtomPos: TAtomPosition; const AnAtom: shortstring): boolean; overload;
|
||||
function AtomIsIdentifier(Identifier: PChar): boolean;
|
||||
function ReadNextAtomIs(const AnAtom: shortstring): boolean; {$IFDEF UseInline}inline;{$ENDIF}
|
||||
function ReadNextAtomIsIdentifier(Identifier: PChar): boolean; {$IFDEF UseInline}inline;{$ENDIF}
|
||||
function ReadNextUpAtomIs(const AnAtom: shortstring): boolean; {$IFDEF UseInline}inline;{$ENDIF}
|
||||
@ -285,7 +285,11 @@ type
|
||||
function AtomIsStringConstant: boolean; {$IFDEF UseInline}inline;{$ENDIF}
|
||||
function AtomIsCharConstant: boolean;
|
||||
function AtomIsEmptyStringConstant: boolean;
|
||||
function AtomIsIdentifier(ExceptionOnNotFound: boolean): boolean;
|
||||
function AtomIsIdentifier(Identifier: PChar): boolean;
|
||||
function AtomIsIdentifier: boolean;
|
||||
procedure AtomIsIdentifierE; overload;
|
||||
function AtomIsIdentifierE(ExceptionOnNotFound: boolean): boolean; overload;
|
||||
procedure AtomIsIdentifierSaveE;
|
||||
function AtomIsCustomOperator(AllowIdentifier, ExceptionOnNotFound: boolean): boolean;
|
||||
function LastAtomIs(BackIndex: integer;
|
||||
const AnAtom: shortstring): boolean; // 0=current, 1=prior current, ...
|
||||
@ -595,6 +599,22 @@ begin
|
||||
DoDeleteNodes(Tree.Root);
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.InternalAtomIsIdentifier: boolean;
|
||||
var
|
||||
p: PChar;
|
||||
begin
|
||||
if (CurPos.StartPos<=SrcLen) then begin
|
||||
p:=@Src[CurPos.StartPos];
|
||||
if IsIdentStartChar[p^] then begin
|
||||
if not WordIsKeyWordFuncList.DoIdentifier(p) then
|
||||
exit(true);
|
||||
end else if (p^='&') and (IsIdentChar[p[1]]) then begin
|
||||
exit(true);
|
||||
end;
|
||||
end;
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TCustomCodeTool.RaiseUndoImpossible;
|
||||
begin
|
||||
RaiseException('TCustomCodeTool.UndoReadNextAtom impossible',true);
|
||||
@ -810,7 +830,41 @@ begin
|
||||
CurPos.EndPos-CurPos.StartPos));
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.AtomIsIdentifier(ExceptionOnNotFound: boolean):boolean;
|
||||
function TCustomCodeTool.AtomIsIdentifier:boolean;
|
||||
begin
|
||||
Result:=InternalAtomIsIdentifier;
|
||||
end;
|
||||
|
||||
procedure TCustomCodeTool.AtomIsIdentifierE;
|
||||
|
||||
procedure RaiseEOFFound;
|
||||
begin
|
||||
RaiseExceptionFmt(ctsIdentExpectedButEOFFound,[GetAtom],true);
|
||||
end;
|
||||
|
||||
procedure RaiseAtomFound;
|
||||
begin
|
||||
RaiseExceptionFmt(ctsIdentExpectedButAtomFound,[GetAtom],true);
|
||||
end;
|
||||
|
||||
begin
|
||||
if InternalAtomIsIdentifier then exit;
|
||||
if CurPos.StartPos>SrcLen then
|
||||
RaiseEOFFound
|
||||
else
|
||||
RaiseAtomFound;
|
||||
end;
|
||||
|
||||
function TCustomCodeTool.AtomIsIdentifierE(ExceptionOnNotFound: boolean
|
||||
): boolean;
|
||||
begin
|
||||
if InternalAtomIsIdentifier then exit(true);
|
||||
Result:=false;
|
||||
if not ExceptionOnNotFound then exit;
|
||||
AtomIsIdentifierE();
|
||||
end;
|
||||
|
||||
procedure TCustomCodeTool.AtomIsIdentifierSaveE;
|
||||
|
||||
procedure RaiseIdentExpectedButEOFFound;
|
||||
begin
|
||||
@ -818,15 +872,7 @@ function TCustomCodeTool.AtomIsIdentifier(ExceptionOnNotFound: boolean):boolean;
|
||||
end;
|
||||
|
||||
begin
|
||||
if (CurPos.StartPos<=SrcLen)
|
||||
and ((IsIdentStartChar[Src[CurPos.StartPos]]
|
||||
and not WordIsKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
|
||||
CurPos.EndPos-CurPos.StartPos))
|
||||
or (Src[CurPos.StartPos]='&') and IsIdentChar[Src[CurPos.StartPos+1]])
|
||||
then
|
||||
exit(true);
|
||||
if not ExceptionOnNotFound then
|
||||
exit(false);
|
||||
if InternalAtomIsIdentifier then exit;
|
||||
if CurPos.StartPos>SrcLen then
|
||||
RaiseIdentExpectedButEOFFound
|
||||
else
|
||||
@ -848,7 +894,7 @@ begin
|
||||
if (CurPos.StartPos<=SrcLen) then begin
|
||||
if WordIsCustomOperator.DoItCaseInsensitive(
|
||||
Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
|
||||
or AllowIdentifier and AtomIsIdentifier(false) then
|
||||
or AllowIdentifier and AtomIsIdentifier then
|
||||
exit(true);
|
||||
end;
|
||||
if not ExceptionOnNotFound then
|
||||
|
@ -422,7 +422,7 @@ var
|
||||
DeleteStartPos:=VarNode.StartPos;
|
||||
MoveCursorToNodeStart(VarNode);
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafComma then begin
|
||||
// there is a next variable in the same var definition
|
||||
@ -1361,7 +1361,7 @@ begin
|
||||
repeat
|
||||
LastAtom:=CurPos;
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) and (LastAtom.Flag<>cafPoint) then begin
|
||||
if AtomIsIdentifier and (LastAtom.Flag<>cafPoint) then begin
|
||||
LastAtom:=CurPos;
|
||||
CheckIdentifierAtCursor;
|
||||
// restore cursor
|
||||
@ -1451,7 +1451,7 @@ var
|
||||
RaiseCharExpectedButAtomFound(']');
|
||||
end;
|
||||
end;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
LastPos:=LastAtoms.GetValueAt(0);
|
||||
if not ((LastPos.Flag in [cafPoint]) or LastAtomIs(0,'^')
|
||||
or LastUpAtomIs(0,'INHERITED'))
|
||||
@ -1471,7 +1471,7 @@ var
|
||||
Identifier:=Identifier+GetAtom;
|
||||
end else if AtomIsChar('^') then begin
|
||||
Identifier:=Identifier+GetAtom;
|
||||
end else if AtomIsIdentifier(false) and (LastAtomIs(0,'.')) then
|
||||
end else if AtomIsIdentifier and (LastAtomIs(0,'.')) then
|
||||
begin
|
||||
Identifier:=Identifier+GetAtom;
|
||||
end else begin
|
||||
@ -1735,7 +1735,7 @@ var
|
||||
while CurPos.StartPos<CleanEndPos do begin
|
||||
LastAtomType:=CurPos.Flag;
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) and (LastAtomType<>cafPoint) then begin
|
||||
if AtomIsIdentifier and (LastAtomType<>cafPoint) then begin
|
||||
// this could be the start of a variable -> check
|
||||
{$IFDEF CTDebug}
|
||||
DebugLn('ScanSourceForVariables B Identifier=',GetAtom);
|
||||
|
@ -1351,7 +1351,7 @@ var CleanCursorPos: integer;
|
||||
MoveCursorToNodeStart(CursorNode);
|
||||
ReadNextAtom;
|
||||
IsMethod:=false;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
ReadNextAtom;
|
||||
if AtomIsChar('.') then begin
|
||||
ReadNextAtom;
|
||||
@ -3602,7 +3602,7 @@ var
|
||||
{$IFDEF ShowTriedBaseContexts}
|
||||
debugln(['TFindDeclarationTool.FindBaseTypeOfNode.SearchIdentifier searching identifier "',GetIdentifier(@Src[IdentStart]),'" in unit ...']);
|
||||
{$ENDIF}
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
SubParams.SetIdentifier(Self,@Src[IdentStart],nil);
|
||||
SubParams.Flags:=[fdfExceptionOnNotFound];
|
||||
if SubParams.NewCodeTool=Self then begin
|
||||
@ -4900,7 +4900,7 @@ var
|
||||
ReadNextAtom; // read name
|
||||
if CurPos.StartPos>SrcLen then break;
|
||||
if AtomIsChar(';') then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
//DebugLn(['CheckUsesSection ',GetAtom,' ',AUnitName]);
|
||||
if UpAtomIs(UpperUnitName) then begin // compare case insensitive
|
||||
if CleanPosToCaret(CurPos.StartPos,ReferencePos) then begin
|
||||
@ -5227,7 +5227,7 @@ begin
|
||||
exit(ifrProceedSearch);
|
||||
MoveCursorToNodeStart(ProcContextNode.FirstChild);
|
||||
ReadNextAtom; // read name
|
||||
if not AtomIsIdentifier(false) then exit; // ignore operator procs
|
||||
if not AtomIsIdentifier then exit; // ignore operator procs
|
||||
NameAtom:=CurPos;
|
||||
ReadNextAtom;
|
||||
if AtomIsChar('.') then begin
|
||||
@ -5566,11 +5566,11 @@ begin
|
||||
MoveCursorToCleanPos(IdentifierNode.StartPos);
|
||||
AncestorStartPos:=CurPos.StartPos;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
AncestorStartPos:=CurPos.StartPos;
|
||||
end;
|
||||
if (ClassIdentNode<>nil)
|
||||
@ -6204,7 +6204,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if AtomIsChar(';') then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
UnitNamePos:=CurPos;
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('IN') then begin
|
||||
@ -6672,11 +6672,11 @@ var
|
||||
if UpAtomIs('INHERITED') then
|
||||
ReadNextAtom;
|
||||
FirstIdentifier:=true;
|
||||
if (CurPos.Flag in AllCommonAtomWords) and AtomIsIdentifier(true) then begin
|
||||
if not (CurPos.Flag in AllCommonAtomWords) then exit;
|
||||
AtomIsIdentifierE;
|
||||
FirstIdentifier:=false;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
MoveCursorToCleanPos(StartPos);
|
||||
@ -6694,7 +6694,7 @@ begin
|
||||
if FirstIdentifier and ExceptionIfNoVariableStart then
|
||||
RaiseIdentNotFound;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
end;
|
||||
|
||||
cafEdgedBracketOpen:
|
||||
@ -7812,7 +7812,7 @@ begin
|
||||
Tool.MoveCursorToNodeStart(Node);
|
||||
|
||||
Tool.ReadNextAtom;
|
||||
if not Tool.AtomIsIdentifier(false) then exit;
|
||||
if not Tool.AtomIsIdentifier then exit;
|
||||
Tool.ReadNextAtom;
|
||||
if not (CurPos.Flag in [cafEqual,cafColon]) then exit;
|
||||
Tool.ReadNextAtom;
|
||||
@ -7923,7 +7923,7 @@ begin
|
||||
DebugLn('[TFindDeclarationTool.ReadOperandTypeAtCursor] A Atom=',GetAtom);
|
||||
debugln(['TFindDeclarationTool.ReadOperandTypeAtCursor StartContext=',Params.ContextNode.DescAsString,'="',dbgstr(Src,Params.ContextNode.StartPos,15),'"']);
|
||||
{$ENDIF}
|
||||
if (AtomIsIdentifier(false))
|
||||
if (AtomIsIdentifier)
|
||||
or (CurPos.Flag=cafRoundBracketOpen)
|
||||
or UpAtomIs('INHERITED') then begin
|
||||
// read variable
|
||||
@ -10365,7 +10365,7 @@ begin
|
||||
end;
|
||||
if not UpAtomIs('OF') then exit;
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
Params:=TFindDeclarationParams.Create;
|
||||
try
|
||||
Params.Flags:=fdfDefaultForExpressions;
|
||||
@ -10597,7 +10597,7 @@ var
|
||||
ReadNextAtom; // read ^
|
||||
if not AtomIsChar('^') then exit;
|
||||
ReadNextAtom; // read identifier
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
Result:=CompareSrcIdentifiers(CurPos.StartPos,p);
|
||||
end;
|
||||
|
||||
|
@ -630,7 +630,7 @@ begin
|
||||
if HasSourceType then begin
|
||||
repeat
|
||||
ReadNextAtom; // read source name
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom; // read ';' (or 'platform;' or 'unimplemented;')
|
||||
until CurPos.Flag<>cafPoint;
|
||||
end;
|
||||
@ -950,7 +950,7 @@ begin
|
||||
EndChildNode;
|
||||
// read next variable name
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
// create variable definition node
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
@ -1168,7 +1168,7 @@ begin
|
||||
if IsOperator then
|
||||
AtomIsCustomOperator(true,true)
|
||||
else
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
// create node for procedure head
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnProcedureHead;
|
||||
@ -1185,13 +1185,13 @@ begin
|
||||
CurNode.Parent.Desc:=ctnMethodMap;
|
||||
// read Method name of interface
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
//DebugLn(['TPascalParserTool.KeyWordFuncClassMethod ',GetAtom,' at ',CleanPosToStr(CurPos.StartPos,true)]);
|
||||
// read '='
|
||||
ReadNextAtomIsChar('=');
|
||||
// read implementing method name
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafSemicolon then
|
||||
UndoReadNextAtom;
|
||||
@ -1307,7 +1307,11 @@ begin
|
||||
ReadPrefixModifier;
|
||||
// read parameter name(s)
|
||||
repeat
|
||||
if not AtomIsIdentifier(ExceptionOnError) then exit;
|
||||
if not AtomIsIdentifier then begin
|
||||
if ExceptionOnError then
|
||||
AtomIsIdentifierSaveE;
|
||||
exit;
|
||||
end;
|
||||
if (phpCreateNodes in Attr) then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
@ -1411,11 +1415,11 @@ begin
|
||||
Atom := GetAtom;
|
||||
if CurPos.Flag in [cafPoint, cafComma] then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
end
|
||||
else if Atom='<' then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
Inc(Level);
|
||||
end
|
||||
else if Atom='>' then
|
||||
@ -1486,7 +1490,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
if NeedIdentifier then begin
|
||||
if not AtomIsIdentifier(ExceptionOnError) then exit;
|
||||
if not AtomIsIdentifier then begin
|
||||
if ExceptionOnError then
|
||||
AtomIsIdentifierSaveE;
|
||||
exit;
|
||||
end;
|
||||
if (phpCreateNodes in Attr) then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnIdentifier;
|
||||
@ -1495,7 +1503,11 @@ begin
|
||||
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
|
||||
if not AtomIsIdentifier(ExceptionOnError) then exit;
|
||||
if AtomIsIdentifier then begin
|
||||
if ExceptionOnError then
|
||||
AtomIsIdentifierSaveE;
|
||||
exit;
|
||||
end;
|
||||
if (phpCreateNodes in Attr) then
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
|
||||
@ -1584,7 +1596,7 @@ begin
|
||||
|
||||
if (pphIsOperator in ParseAttr) and (CurPos.Flag<>cafColon) then begin
|
||||
// read operator result identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if (pphCreateNodes in ParseAttr) then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
@ -1598,7 +1610,7 @@ begin
|
||||
// read function result type
|
||||
if CurPos.Flag=cafColon then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if (pphCreateNodes in ParseAttr) then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnIdentifier;
|
||||
@ -1609,7 +1621,7 @@ begin
|
||||
if CurPos.Flag<>cafPoint then break;
|
||||
// unitname.classname.identifier
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if (pphCreateNodes in ParseAttr) then
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
until false;
|
||||
@ -1624,7 +1636,7 @@ begin
|
||||
if CurPos.Flag=cafEqual then begin
|
||||
// read interface alias
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
@ -1711,7 +1723,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if AtomIsChar(':') then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end else if UpAtomIs('EXTERNAL') then begin
|
||||
@ -1734,7 +1746,7 @@ begin
|
||||
until false;
|
||||
if CurPos.Flag=cafColon then begin
|
||||
ReadNextAtom;
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
|
||||
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||
ReadConstant(true,false,[]);
|
||||
end;
|
||||
@ -1910,7 +1922,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if CurPos.Flag=cafSemicolon then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnUseUnit;
|
||||
repeat
|
||||
@ -1918,7 +1930,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafPoint then break;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
until false;
|
||||
if UpAtomIs('IN') then begin
|
||||
ReadNextAtom;
|
||||
@ -1963,7 +1975,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if CurPos.Flag=cafSemicolon then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafSemicolon then break;
|
||||
if CurPos.Flag<>cafComma then
|
||||
@ -1991,7 +2003,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if CurPos.Flag=cafSemicolon then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if UpAtomIs('IN') then begin
|
||||
ReadNextAtom;
|
||||
@ -2326,7 +2338,7 @@ begin
|
||||
RaiseStringExpectedButAtomFound('property');
|
||||
end;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafEdgedBracketOpen then begin
|
||||
// read parameter list
|
||||
@ -2354,7 +2366,7 @@ begin
|
||||
RaiseSemicolonAfterPropSpecMissing('nodefault');
|
||||
end else if UpAtomIs('ENUMERATOR') then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafSemicolon then
|
||||
RaiseSemicolonAfterPropSpecMissing('enumerator');
|
||||
@ -2571,7 +2583,7 @@ begin
|
||||
if IsOperator then
|
||||
AtomIsCustomOperator(true,true)
|
||||
else
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if ChildCreated then begin
|
||||
// create node for procedure head
|
||||
CreateChildNode;
|
||||
@ -2600,7 +2612,7 @@ begin
|
||||
if IsOperator then
|
||||
AtomIsCustomOperator(true,true)
|
||||
else
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
@ -2921,11 +2933,11 @@ begin
|
||||
ReadNextAtom;
|
||||
while UpAtomIs('INHERITED') do
|
||||
ReadNextAtom;
|
||||
Result:=AtomIsIdentifier(false)
|
||||
Result:=AtomIsIdentifier
|
||||
or (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]);
|
||||
if not Result then exit;
|
||||
repeat
|
||||
if AtomIsIdentifier(false) then
|
||||
if AtomIsIdentifier then
|
||||
ReadNextAtom;
|
||||
repeat
|
||||
if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then begin
|
||||
@ -3071,7 +3083,7 @@ begin
|
||||
end;
|
||||
// read variable name
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateNodes then begin
|
||||
// ctnOnIdentifier for the variable or the type
|
||||
CreateChildNode;
|
||||
@ -3084,7 +3096,7 @@ begin
|
||||
if CreateNodes then
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateNodes then begin
|
||||
// ctnIdentifier for the type
|
||||
CreateChildNode;
|
||||
@ -3097,7 +3109,7 @@ begin
|
||||
// for example: on Unit.Exception do ;
|
||||
// or: on E:Unit.Exception do ;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateNodes then begin
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
end;
|
||||
@ -3215,14 +3227,14 @@ begin
|
||||
// for example 'var a: char; public name test;'
|
||||
ReadNextAtom;
|
||||
if (not AtomIsStringConstant)
|
||||
and (not AtomIsIdentifier(false)) then
|
||||
and (not AtomIsIdentifier) then
|
||||
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||
ReadConstant(true,false,[]);
|
||||
if UpAtomIs('SECTION') then begin
|
||||
// for example FreePascal_TLS_callback : pointer = @Exec_Tls_callback; public name '__FPC_tls_callbacks' section '.CRT$XLFPC'
|
||||
ReadNextAtom;
|
||||
if (not AtomIsStringConstant)
|
||||
and (not AtomIsIdentifier(false)) then
|
||||
and (not AtomIsIdentifier) then
|
||||
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||
ReadConstant(true,false,[]);
|
||||
end;
|
||||
@ -3364,7 +3376,7 @@ begin
|
||||
// read all type definitions Name = Type; or generic Name<List> = Type;
|
||||
repeat
|
||||
ReadNextAtom; // name
|
||||
if UpAtomIs('GENERIC') or AtomIsIdentifier(false) then begin
|
||||
if UpAtomIs('GENERIC') or AtomIsIdentifier then begin
|
||||
ReadTypeNameAndDefinition;
|
||||
end else begin
|
||||
UndoReadNextAtom;
|
||||
@ -3406,7 +3418,7 @@ begin
|
||||
// read all variable definitions Name : Type; [cvar;] [public [name '']]
|
||||
repeat
|
||||
ReadNextAtom; // name
|
||||
if AtomIsIdentifier(false)
|
||||
if AtomIsIdentifier
|
||||
and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC]))
|
||||
or (not UpAtomIs('PROPERTY')))
|
||||
then begin
|
||||
@ -3418,7 +3430,7 @@ begin
|
||||
CurNode.EndPos:=LastIdentifierEnd;
|
||||
EndChildNode; // close variable definition
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
LastIdentifierEnd:=CurPos.EndPos;
|
||||
@ -3465,7 +3477,7 @@ begin
|
||||
ReadNextAtom; // name
|
||||
if CurPos.Flag=cafSemicolon then begin
|
||||
// ignore empty semicolons
|
||||
end else if AtomIsIdentifier(false) then begin
|
||||
end else if AtomIsIdentifier then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnConstDefinition;
|
||||
ReadConst;
|
||||
@ -3503,7 +3515,7 @@ begin
|
||||
// read all string constants Name = 'abc';
|
||||
repeat
|
||||
ReadNextAtom; // name
|
||||
if AtomIsIdentifier(false)
|
||||
if AtomIsIdentifier
|
||||
and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC]))
|
||||
or (not UpAtomIs('PROPERTY')))
|
||||
then begin
|
||||
@ -3514,7 +3526,7 @@ begin
|
||||
RaiseCharExpectedButAtomFound('=');
|
||||
// read string constant
|
||||
ReadNextAtom;
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
|
||||
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||
ReadConstant(true,false,[]);
|
||||
// read hint modifier
|
||||
@ -3555,11 +3567,11 @@ begin
|
||||
CurNode.Desc:=ctnExportsSection;
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if UpAtomIs('INDEX') then begin
|
||||
@ -3593,7 +3605,7 @@ begin
|
||||
// read all constants
|
||||
repeat
|
||||
ReadNextAtom; // identifier or number
|
||||
if (not AtomIsIdentifier(false)) and (not AtomIsNumber) then begin
|
||||
if (not AtomIsIdentifier) and (not AtomIsNumber) then begin
|
||||
RaiseStringExpectedButAtomFound(ctsIdentifier);
|
||||
end;
|
||||
CreateChildNode;
|
||||
@ -3629,7 +3641,7 @@ begin
|
||||
repeat
|
||||
// read property Name
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnGlobalProperty;
|
||||
ReadNextAtom;
|
||||
@ -3724,7 +3736,7 @@ begin
|
||||
else
|
||||
CurNode.Desc:=ctnTypeDefinition;
|
||||
// read name
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if (TypeNode.Desc=ctnGenericType) and (not AtomIsChar('<')) then
|
||||
RaiseCharExpectedButAtomFound('<');
|
||||
@ -3742,7 +3754,7 @@ begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnGenericParams;
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
repeat
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnGenericParameter;
|
||||
@ -3752,7 +3764,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafComma then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
end else if AtomIsChar('>') then begin
|
||||
break;
|
||||
end else if AtomIs('>=') then begin
|
||||
@ -3804,7 +3816,7 @@ begin
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if not AtomIsChar('<') then exit;
|
||||
@ -3896,7 +3908,7 @@ begin
|
||||
IsForward:=false;
|
||||
CurNode.Desc:=ctnClassOfType;
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnIdentifier;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
@ -3962,7 +3974,7 @@ begin
|
||||
CurNode.Desc:=ctnClassHelperFor;
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
until CurPos.Flag<>cafPoint;
|
||||
@ -4217,11 +4229,11 @@ begin
|
||||
if IsFunction then begin
|
||||
if (CurPos.Flag=cafColon) then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end else begin
|
||||
@ -4392,7 +4404,7 @@ begin
|
||||
CreateChildNode;
|
||||
SubRangeOperatorFound:=false;
|
||||
if CurPos.Flag in AllCommonAtomWords then begin
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadTypeReference;
|
||||
if CurNode.EndPos > 0 then
|
||||
Exit(True);
|
||||
@ -4454,7 +4466,7 @@ begin
|
||||
repeat
|
||||
ReadNextAtom; // read enum name
|
||||
if (CurPos.Flag=cafRoundBracketClose) then break;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnEnumIdentifier;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
@ -4533,7 +4545,7 @@ begin
|
||||
case a:b.c of
|
||||
case a:(b,c) of
|
||||
}
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
{$IFDEF VerboseRecordCase}
|
||||
@ -4550,7 +4562,7 @@ begin
|
||||
if CurPos.Flag<>cafRoundBracketClose then begin
|
||||
repeat
|
||||
// read enum
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnEnumIdentifier;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
@ -4567,14 +4579,14 @@ begin
|
||||
ReadNextAtom;
|
||||
end else begin
|
||||
// identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnIdentifier;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom; // unit.type
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
@ -4621,7 +4633,7 @@ begin
|
||||
end else begin
|
||||
// sub identifier
|
||||
repeat
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnVarDefinition;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
@ -5103,7 +5115,7 @@ begin
|
||||
ReadNextAtom; // read keyword 'property'
|
||||
if UpAtomIs('CLASS') then ReadNextAtom;
|
||||
ReadNextAtom; // read property name
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if (CurPos.Flag=cafEdgedBracketOpen) then begin
|
||||
// read parameter list
|
||||
@ -5115,7 +5127,7 @@ begin
|
||||
exit;
|
||||
end;
|
||||
ReadNextAtom; // read type
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
@ -5127,7 +5139,7 @@ begin
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(False) then Exit;
|
||||
if not AtomIsIdentifier then Exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if UpAtomIs('INDEX') then begin
|
||||
@ -5135,7 +5147,7 @@ begin
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(False) then Exit;
|
||||
if not AtomIsIdentifier then Exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
@ -5157,7 +5169,7 @@ begin
|
||||
CurNode.Desc:=ctnClassGUID;
|
||||
// read GUID
|
||||
ReadNextAtom;
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then
|
||||
if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
|
||||
RaiseStringConstantExpected;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafEdgedBracketClose then
|
||||
@ -5185,7 +5197,7 @@ begin
|
||||
ReadSpecialize(CreateChildNodes);
|
||||
end else begin
|
||||
// read Identifier or Unit.Identifier
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateChildNodes then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnIdentifier;
|
||||
@ -5224,7 +5236,7 @@ begin
|
||||
end;
|
||||
// read identifier (the name of the generic)
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateChildNodes then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnSpecializeType;
|
||||
@ -5234,7 +5246,7 @@ begin
|
||||
if Curpos.Flag=cafPoint then begin
|
||||
// first identifier was unitname, now read the type
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
if CreateChildNodes then
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
@ -5253,12 +5265,12 @@ begin
|
||||
repeat
|
||||
// read identifier (a parameter of the generic type)
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
if Curpos.Flag=cafPoint then begin
|
||||
// first identifier was unitname, now read the type
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if AtomIsChar('>') then
|
||||
@ -5362,7 +5374,7 @@ begin
|
||||
if IsOperator then
|
||||
AtomIsCustomOperator(true,true)
|
||||
else
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
while (CurPos.Flag=cafPoint) do begin
|
||||
// read procedure name of a class method (the name after the . )
|
||||
@ -5370,7 +5382,7 @@ begin
|
||||
if IsOperator then
|
||||
AtomIsCustomOperator(true,true)
|
||||
else
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierSaveE;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
|
@ -352,7 +352,7 @@ begin
|
||||
if (not UpAtomIs('PROPERTY')) then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafEdgedBracketOpen then begin
|
||||
if EmptyIfIndexed then exit;
|
||||
@ -363,7 +363,7 @@ begin
|
||||
if not (CurPos.Flag=cafColon) then
|
||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[':',GetAtom]);
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
if InUpperCase then
|
||||
Result:=GetUpAtom
|
||||
else
|
||||
@ -389,7 +389,7 @@ begin
|
||||
MoveCursorToNodeStart(ProcHeadNode);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
if phpInUpperCase in Attr then
|
||||
Part:=GetUpAtom
|
||||
else
|
||||
@ -461,7 +461,7 @@ begin
|
||||
// read name
|
||||
if ((not IsOperator)
|
||||
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
|
||||
and (not AtomIsIdentifier(false)) then exit;
|
||||
and (not AtomIsIdentifier) then exit;
|
||||
|
||||
if TheClassName<>'' then begin
|
||||
s:=TheClassName+'.';
|
||||
@ -488,7 +488,7 @@ begin
|
||||
ExtractNextAtom(true,Attr);
|
||||
if ((not IsOperator)
|
||||
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
|
||||
and (not AtomIsIdentifier(false)) then exit;
|
||||
and (not AtomIsIdentifier) then exit;
|
||||
until false;
|
||||
end else begin
|
||||
// read only part of name
|
||||
@ -509,7 +509,7 @@ begin
|
||||
ExtractNextAtom(not (phpWithoutClassName in Attr),Attr);
|
||||
if ((not IsOperator)
|
||||
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
|
||||
and (not AtomIsIdentifier(false)) then exit;
|
||||
and (not AtomIsIdentifier) then exit;
|
||||
end else begin
|
||||
// read name
|
||||
ExtractNextAtom(not (phpWithoutName in Attr),Attr);
|
||||
@ -531,11 +531,11 @@ begin
|
||||
// read result type
|
||||
if (CurPos.Flag=cafColon) then begin
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
end;
|
||||
ExtractProcHeadPos:=phepResultType;
|
||||
@ -668,13 +668,13 @@ begin
|
||||
ReadNextAtom; // '('
|
||||
if CurPos.Flag<>cafRoundBracketOpen then exit;
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
MoveCursorToCleanPos(CurPos.StartPos);
|
||||
ExtractProcHeadPos:=phepNone;
|
||||
InitExtraction;
|
||||
while (CurPos.StartPos<=SrcLen) do begin
|
||||
ExtractNextAtom(true,Attr); // read ancestor/interface
|
||||
if not AtomIsIdentifier(false) then break;
|
||||
if not AtomIsIdentifier then break;
|
||||
ExtractNextAtom(true,Attr); // read ','
|
||||
if not AtomIsChar(',') then break;
|
||||
end;
|
||||
@ -694,7 +694,7 @@ begin
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then break;
|
||||
if not AtomIsIdentifier then break;
|
||||
Part:=GetAtom;
|
||||
ReadNextAtom;
|
||||
if (Scanner.CompilerMode = cmDELPHI) and AtomIsChar('<') then
|
||||
@ -945,11 +945,11 @@ begin
|
||||
if (CurPos.Flag=cafColon) then begin
|
||||
// read function result type
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then break;
|
||||
if not AtomIsIdentifier then break;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
@ -1016,7 +1016,7 @@ begin
|
||||
break;
|
||||
end;
|
||||
ReadNextAtom;
|
||||
until not AtomIsIdentifier(false);
|
||||
until not AtomIsIdentifier;
|
||||
end;
|
||||
|
||||
procedure TPascalReaderTool.MoveCursorBehindProcName(ProcNode: TCodeTreeNode);
|
||||
@ -1026,11 +1026,11 @@ begin
|
||||
ProcNode:=ProcNode.FirstChild;
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end else if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen,cafColon]
|
||||
@ -1106,7 +1106,7 @@ begin
|
||||
end else begin
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
ReadNextAtom;
|
||||
while AtomIsIdentifier(false) do begin
|
||||
while AtomIsIdentifier do begin
|
||||
ReadNextAtom;
|
||||
if (CurPos.Flag<>cafPoint) then break;
|
||||
ReadNextAtom;
|
||||
@ -1117,7 +1117,7 @@ begin
|
||||
if CurPos.StartPos>CleanPos then exit;
|
||||
// read optional result variable (e.g. operator can have them)
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then ReadNextAtom;
|
||||
if AtomIsIdentifier then ReadNextAtom;
|
||||
if CurPos.Flag<>cafColon then exit;
|
||||
Result:=CleanPos<=CurPos.StartPos;
|
||||
end;
|
||||
@ -1135,7 +1135,7 @@ begin
|
||||
if (not UpAtomIs('PROPERTY')) then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafEdgedBracketOpen then begin
|
||||
ReadTilBracketClose(true);
|
||||
@ -1175,7 +1175,7 @@ begin
|
||||
if (not UpAtomIs('PROPERTY')) then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
|
||||
@ -1207,7 +1207,7 @@ begin
|
||||
MoveCursorToNodeStart(ProcNode);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit(nil);
|
||||
if not AtomIsIdentifier then exit(nil);
|
||||
Result:=@Src[CurPos.StartPos];
|
||||
ReadNextAtom;
|
||||
until CurPos.Flag<>cafPoint;
|
||||
@ -1328,12 +1328,12 @@ begin
|
||||
// read result type
|
||||
if (CurPos.Flag=cafColon) then begin
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
// unit.type
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ExtractNextAtom(phpWithResultType in Attr,Attr);
|
||||
end;
|
||||
ExtractProcHeadPos:=phepResultType;
|
||||
@ -1962,13 +1962,13 @@ begin
|
||||
ReadNextAtom; // read source type 'program', 'unit' ...
|
||||
if (Tree.Root.Desc=ctnProgram) and (not UpAtomIs('PROGRAM')) then exit;
|
||||
ReadNextAtom; // read name
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
NamePos:=CurPos;
|
||||
Result:=true;
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
NamePos.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
@ -1991,12 +1991,12 @@ begin
|
||||
ReadNextAtom; // read source type 'program', 'unit' ...
|
||||
if (Tree.Root.Desc<>ctnProgram) or UpAtomIs('PROGRAM') then begin
|
||||
ReadNextAtom; // read name
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
Result:=copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
|
||||
ReadNextAtom;
|
||||
while CurPos.Flag=cafPoint do begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
Result:=Result+'.'+copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
|
||||
ReadNextAtom;
|
||||
end;
|
||||
@ -2035,7 +2035,7 @@ begin
|
||||
|
||||
MoveCursorToNodeStart(ProcNode.FirstChild); // ctnProcedureHead
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ReadNextAtom;
|
||||
if (CurPos.Flag<>cafPoint) then exit;
|
||||
Result:=true;
|
||||
@ -2475,7 +2475,7 @@ begin
|
||||
|
||||
Result:=false;
|
||||
if not MoveCursorToPropName(PropNode) then exit;
|
||||
if not AtomIsIdentifier(ExceptionOnNotFound) then exit;
|
||||
if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafEdgedBracketOpen then begin
|
||||
if not ReadTilBracketClose(ExceptionOnNotFound) then exit;
|
||||
@ -2484,11 +2484,11 @@ begin
|
||||
if CurPos.Flag=cafColon then begin
|
||||
// read type
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(ExceptionOnNotFound) then exit;
|
||||
if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(ExceptionOnNotFound) then exit;
|
||||
if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end;
|
||||
@ -2512,7 +2512,7 @@ begin
|
||||
end else if UpAtomIs('ENUMERATOR') then begin
|
||||
if CompareIdentifierPtrs(@Src[CurPos.StartPos],Pointer(s))=0 then exit(true);
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
end else
|
||||
exit;
|
||||
ReadNextAtom;
|
||||
@ -2602,13 +2602,13 @@ function TPascalReaderTool.ReadNextUsedUnit(out UnitNameRange,
|
||||
// after reading CurPos is on atom behind, i.e. comma or semicolon
|
||||
begin
|
||||
Result:=false;
|
||||
if not AtomIsIdentifier(SyntaxExceptions) then exit;
|
||||
if not AtomIsIdentifierE(SyntaxExceptions) then exit;
|
||||
UnitNameRange:=CurPos;
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag<>cafPoint then break;
|
||||
ReadNextAtom;
|
||||
if not AtomIsIdentifier(SyntaxExceptions) then exit;
|
||||
if not AtomIsIdentifierE(SyntaxExceptions) then exit;
|
||||
UnitNameRange.EndPos:=CurPos.EndPos;
|
||||
until false;
|
||||
if UpAtomIs('IN') then begin
|
||||
@ -2637,13 +2637,13 @@ begin
|
||||
end else begin
|
||||
InAtom:=CleanAtomPosition;
|
||||
end;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
UnitNameRange:=CurPos;
|
||||
repeat
|
||||
ReadPriorAtom;
|
||||
if CurPos.Flag<>cafPoint then break;
|
||||
ReadPriorAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
UnitNameRange.StartPos:=CurPos.StartPos;
|
||||
until false;
|
||||
end;
|
||||
@ -2693,7 +2693,7 @@ begin
|
||||
else
|
||||
p:=nil;
|
||||
repeat
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
if (p<>nil) then begin
|
||||
if CompareIdentifiers(p,@Src[CurPos.StartPos])=0 then
|
||||
inc(p,CurPos.EndPos-CurPos.StartPos)
|
||||
|
@ -1056,7 +1056,7 @@ begin
|
||||
ReadNextAtom; // read 'uses'
|
||||
repeat
|
||||
ReadNextAtom; // read name
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
if ReadAndCompareUsedUnit(AnUnitName) then begin
|
||||
// unit found
|
||||
exit(true);
|
||||
@ -1084,7 +1084,7 @@ begin
|
||||
repeat
|
||||
EndPos:=CurPos.StartPos;
|
||||
ReadNextAtom; // read name
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
inc(UnitPos);
|
||||
StartPos:=CurPos.StartPos;
|
||||
Found:=ReadAndCompareUsedUnit(AnUnitName);
|
||||
@ -3094,7 +3094,7 @@ begin
|
||||
ReadNextAtom;
|
||||
if AtomIsChar('(') then begin
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then
|
||||
if AtomIsIdentifier then
|
||||
AncestorClassName:=GetAtom;
|
||||
end;
|
||||
if AncestorClassName='' then
|
||||
@ -3222,7 +3222,7 @@ begin
|
||||
MoveCursorToCleanPos(1);
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
CurIdentNode:=
|
||||
IdentTree.FindKey(@Src[CurPos.StartPos],
|
||||
TListSortCompare(@CompareIdentifiers));
|
||||
@ -3283,7 +3283,7 @@ type
|
||||
Result:=scatStrConst
|
||||
else if AtomIsChar('+') then
|
||||
Result:=scatPlus
|
||||
else if AtomIsIdentifier(false) then
|
||||
else if AtomIsIdentifier then
|
||||
Result:=scatIdent
|
||||
else if UpAtomIs('INHERITED') then
|
||||
Result:=scatInherited
|
||||
@ -3601,7 +3601,7 @@ begin
|
||||
ConvertStringConstant;
|
||||
end else if AtomIsChar('+') then begin
|
||||
// simply ignore
|
||||
end else if (CurPos.Flag=cafRoundBracketOpen) or AtomIsIdentifier(false)
|
||||
end else if (CurPos.Flag=cafRoundBracketOpen) or AtomIsIdentifier
|
||||
then begin
|
||||
// add as parameter
|
||||
ConvertOther;
|
||||
@ -4107,7 +4107,7 @@ function TStandardCodeTool.GatherResourceStringsWithValue(
|
||||
begin
|
||||
MoveCursorToNodeStart(ANode);
|
||||
ReadNextAtom; // read identifier
|
||||
if not AtomIsIdentifier(false) then exit;
|
||||
if not AtomIsIdentifier then exit;
|
||||
ReadNextAtom; // read =
|
||||
if CurPos.Flag<>cafEqual then exit;
|
||||
ReadNextAtom; // read start of string constant
|
||||
@ -4811,14 +4811,14 @@ begin
|
||||
// var X, i: integer; -> var [X, ]i: integer;
|
||||
MoveCursorToCleanPos(Node.StartPos);
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
|
||||
DeleteEndPos:=CurPos.EndPos;
|
||||
end else if PrevSibling<>nil then begin
|
||||
// var i, X: integer; -> var i[, X]: integer;
|
||||
MoveCursorToCleanPos(PrevSibling.StartPos);
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
|
||||
DeleteStartPos:=CurPos.StartPos;
|
||||
end else begin
|
||||
@ -5912,7 +5912,7 @@ var
|
||||
}
|
||||
NeedCompletion:=CleanCursorPos;
|
||||
end else if CurPos.Flag=cafWord then begin
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafEqual then begin
|
||||
{ For example:
|
||||
@ -6538,11 +6538,11 @@ begin
|
||||
if CurPos.Flag=cafRoundBracketOpen then begin
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if AtomIsIdentifier(false) then begin
|
||||
if AtomIsIdentifier then begin
|
||||
ReadNextAtom;
|
||||
if CurPos.Flag=cafPoint then begin
|
||||
ReadNextAtom;
|
||||
AtomIsIdentifier(true);
|
||||
AtomIsIdentifierE;
|
||||
end;
|
||||
end;
|
||||
if CurPos.Flag=cafRoundBracketClose then break;
|
||||
|
Loading…
Reference in New Issue
Block a user