codetools: do not save errors outside parser

git-svn-id: trunk@37213 -
This commit is contained in:
mattias 2012-05-07 16:04:57 +00:00
parent ea0537d6bd
commit 855af79e42
8 changed files with 227 additions and 169 deletions

View File

@ -358,7 +358,7 @@ begin
ReadPrefixModifier; ReadPrefixModifier;
// read parameter name(s) // read parameter name(s)
repeat repeat
AtomIsIdentifier(true); AtomIsIdentifierE;
CurParam.Name:=CurPos; CurParam.Name:=CurPos;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafComma then if CurPos.Flag<>cafComma then

View File

@ -1326,7 +1326,7 @@ begin
repeat repeat
ReadNextAtom; ReadNextAtom;
if (CurPos.StartPos>EndPos) or (CurPos.Flag=cafNone) then exit; if (CurPos.StartPos>EndPos) or (CurPos.Flag=cafNone) then exit;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
//DebugLn(['AddNeededUnitsForRange ',GetAtom]); //DebugLn(['AddNeededUnitsForRange ',GetAtom]);
// save cursor // save cursor
OldCursor:=CurPos; OldCursor:=CurPos;
@ -1658,7 +1658,7 @@ var
AssignmentOperator:=CurPos.StartPos; AssignmentOperator:=CurPos.StartPos;
ReadPriorAtom; ReadPriorAtom;
// check event name // check event name
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
PropVarAtom:=CurPos; PropVarAtom:=CurPos;
// check for semicolon at end of statement // check for semicolon at end of statement
@ -2532,7 +2532,7 @@ var
MoveCursorToCleanPos(ExprStartPos); MoveCursorToCleanPos(ExprStartPos);
repeat repeat
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then if AtomIsIdentifier then
Result:=GetAtom Result:=GetAtom
else else
Result:=''; Result:='';
@ -2651,7 +2651,7 @@ const
// read procname // read procname
MoveCursorToCleanPos(CleanCursorPos); MoveCursorToCleanPos(CleanCursorPos);
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ProcNameAtom:=CurPos; ProcNameAtom:=CurPos;
// read bracket // read bracket
ReadNextAtom; ReadNextAtom;
@ -3641,7 +3641,7 @@ var
if CurPos.Flag<>cafColon then exit; if CurPos.Flag<>cafColon then exit;
// read result type // read result type
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
// check if there is a public definition of the procedure // check if there is a public definition of the procedure
NodeText:=GetRedefinitionNodeText(ProcNode); NodeText:=GetRedefinitionNodeText(ProcNode);
@ -3689,7 +3689,7 @@ var
if (CurPos.Flag in [cafSemicolon,cafEnd]) then if (CurPos.Flag in [cafSemicolon,cafEnd]) then
break; break;
// check if all identifiers can be used in a constant expression // check if all identifiers can be used in a constant expression
if AtomIsIdentifier(false) if AtomIsIdentifier
and not CheckExprIdentifier(@Src[CurPos.StartPos]) then and not CheckExprIdentifier(@Src[CurPos.StartPos]) then
exit; exit;
ExprEnd:=CurPos.EndPos; ExprEnd:=CurPos.EndPos;
@ -4683,7 +4683,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
FromPos:=Node.StartPos; FromPos:=Node.StartPos;
MoveCursorToNodeStart(Node); MoveCursorToNodeStart(Node);
ReadNextAtom;// read identifier ReadNextAtom;// read identifier
AtomIsIdentifier(true); AtomIsIdentifierE;
ToPos:=FindLineEndOrCodeAfterPosition(CurPos.EndPos,true); ToPos:=FindLineEndOrCodeAfterPosition(CurPos.EndPos,true);
end else begin end else begin
// this is for example: var a,b: integer // this is for example: var a,b: integer
@ -4691,12 +4691,12 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
// => remove ,b plus the space behind // => remove ,b plus the space behind
MoveCursorToNodeStart(Node.PriorBrother); MoveCursorToNodeStart(Node.PriorBrother);
ReadNextAtom;// read identifier ReadNextAtom;// read identifier
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom;// read comma ReadNextAtom;// read comma
if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(','); if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
FromPos:=CurPos.StartPos; FromPos:=CurPos.StartPos;
ReadNextAtom;// read identifier ReadNextAtom;// read identifier
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom;//read colon ReadNextAtom;//read colon
if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':'); if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':');
ToPos:=CurPos.StartPos; ToPos:=CurPos.StartPos;
@ -4713,7 +4713,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
FromPos:=FindLineEndOrCodeInFrontOfPosition(Node.StartPos); FromPos:=FindLineEndOrCodeInFrontOfPosition(Node.StartPos);
MoveCursorToNodeStart(Node); MoveCursorToNodeStart(Node);
ReadNextAtom;// read identifier ReadNextAtom;// read identifier
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom;// read comma ReadNextAtom;// read comma
if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(','); if not AtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
ToPos:=CurPos.StartPos; ToPos:=CurPos.StartPos;
@ -4809,7 +4809,7 @@ function TCodeCompletionCodeTool.FixForwardDefinitions(
NewTxt:=GetIdentifier(@Src[Node.StartPos]); NewTxt:=GetIdentifier(@Src[Node.StartPos]);
MoveCursorToNodeStart(GetLastVarDefSequenceNode(Node)); MoveCursorToNodeStart(GetLastVarDefSequenceNode(Node));
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom; ReadNextAtom;
if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':'); if not AtomIsChar(':') then RaiseCharExpectedButAtomFound(':');
FromPos:=CurPos.StartPos; FromPos:=CurPos.StartPos;
@ -5093,7 +5093,7 @@ function TCodeCompletionCodeTool.BuildUnitDefinitionGraph(out
repeat repeat
ReadNextAtom; ReadNextAtom;
if (CurPos.StartPos>=ToPos) or (CurPos.StartPos>SrcLen) then break; if (CurPos.StartPos>=ToPos) or (CurPos.StartPos>SrcLen) then break;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
Identifier:=@Src[CurPos.StartPos]; Identifier:=@Src[CurPos.StartPos];
NodeExt:=FindCodeTreeNodeExtWithIdentifier( NodeExt:=FindCodeTreeNodeExtWithIdentifier(
DefinitionsTreeOfCodeTreeNodeExt, DefinitionsTreeOfCodeTreeNodeExt,
@ -5602,7 +5602,7 @@ function TCodeCompletionCodeTool.FindAssignMethod(CursorPos: TCodeXYPosition;
if NodeExt.Node.Desc=ctnProperty then begin if NodeExt.Node.Desc=ctnProperty then begin
if PropertyHasSpecifier(NodeExt.Node,'write') then begin if PropertyHasSpecifier(NodeExt.Node,'write') then begin
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
WrittenNodeExt:=FindCodeTreeNodeExtWithIdentifier(MemberNodeExts, WrittenNodeExt:=FindCodeTreeNodeExtWithIdentifier(MemberNodeExts,
@Src[CurPos.StartPos]); @Src[CurPos.StartPos]);
if WrittenNodeExt<>nil then if WrittenNodeExt<>nil then
@ -6267,7 +6267,7 @@ var
Parts[SpecWord]:=CurPos; Parts[SpecWord]:=CurPos;
ReadNextAtom; ReadNextAtom;
if AtomIsChar(';') then exit; if AtomIsChar(';') then exit;
AtomIsIdentifier(true); AtomIsIdentifierE;
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos, if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) CurPos.EndPos-CurPos.StartPos)
then then
@ -6276,7 +6276,7 @@ var
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom; ReadNextAtom;
PartIsAtom[SpecParam]:=false; PartIsAtom[SpecParam]:=false;
Parts[SpecParam].EndPos:=CurPos.EndPos; Parts[SpecParam].EndPos:=CurPos.EndPos;
@ -6343,7 +6343,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
procedure CheckIdentifier; procedure CheckIdentifier;
begin begin
if (CurPos.StartPos>PropNode.EndPos) 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 or AtomIsKeyWord then begin
// no type name found -> ignore this property // no type name found -> ignore this property
RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]); RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]);
@ -6436,7 +6436,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
ReadSimpleSpec(ppImplementsWord,ppImplements); ReadSimpleSpec(ppImplementsWord,ppImplements);
while CurPos.Flag=cafComma do begin while CurPos.Flag=cafComma do begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos, if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then CurPos.EndPos-CurPos.StartPos) then
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]); RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);

View File

@ -172,6 +172,7 @@ type
// dirty/dead source // dirty/dead source
procedure LoadDirtySource(const CursorPos: TCodeXYPosition); procedure LoadDirtySource(const CursorPos: TCodeXYPosition);
procedure FetchScannerSource(Range: TLinkScannerRange); virtual; procedure FetchScannerSource(Range: TLinkScannerRange); virtual;
function InternalAtomIsIdentifier: boolean; inline;
public public
Tree: TCodeTree; Tree: TCodeTree;
@ -273,7 +274,6 @@ type
function AtomIs(const AnAtom: shortstring): boolean; function AtomIs(const AnAtom: shortstring): boolean;
function UpAtomIs(const AnAtom: shortstring): boolean; function UpAtomIs(const AnAtom: shortstring): boolean;
function UpAtomIs(const AtomPos: TAtomPosition; const AnAtom: shortstring): boolean; overload; 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 ReadNextAtomIs(const AnAtom: shortstring): boolean; {$IFDEF UseInline}inline;{$ENDIF}
function ReadNextAtomIsIdentifier(Identifier: PChar): boolean; {$IFDEF UseInline}inline;{$ENDIF} function ReadNextAtomIsIdentifier(Identifier: PChar): boolean; {$IFDEF UseInline}inline;{$ENDIF}
function ReadNextUpAtomIs(const AnAtom: shortstring): 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 AtomIsStringConstant: boolean; {$IFDEF UseInline}inline;{$ENDIF}
function AtomIsCharConstant: boolean; function AtomIsCharConstant: boolean;
function AtomIsEmptyStringConstant: 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 AtomIsCustomOperator(AllowIdentifier, ExceptionOnNotFound: boolean): boolean;
function LastAtomIs(BackIndex: integer; function LastAtomIs(BackIndex: integer;
const AnAtom: shortstring): boolean; // 0=current, 1=prior current, ... const AnAtom: shortstring): boolean; // 0=current, 1=prior current, ...
@ -595,6 +599,22 @@ begin
DoDeleteNodes(Tree.Root); DoDeleteNodes(Tree.Root);
end; 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; procedure TCustomCodeTool.RaiseUndoImpossible;
begin begin
RaiseException('TCustomCodeTool.UndoReadNextAtom impossible',true); RaiseException('TCustomCodeTool.UndoReadNextAtom impossible',true);
@ -810,7 +830,41 @@ begin
CurPos.EndPos-CurPos.StartPos)); CurPos.EndPos-CurPos.StartPos));
end; 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; procedure RaiseIdentExpectedButEOFFound;
begin begin
@ -818,15 +872,7 @@ function TCustomCodeTool.AtomIsIdentifier(ExceptionOnNotFound: boolean):boolean;
end; end;
begin begin
if (CurPos.StartPos<=SrcLen) if InternalAtomIsIdentifier then exit;
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 CurPos.StartPos>SrcLen then if CurPos.StartPos>SrcLen then
RaiseIdentExpectedButEOFFound RaiseIdentExpectedButEOFFound
else else
@ -848,7 +894,7 @@ begin
if (CurPos.StartPos<=SrcLen) then begin if (CurPos.StartPos<=SrcLen) then begin
if WordIsCustomOperator.DoItCaseInsensitive( if WordIsCustomOperator.DoItCaseInsensitive(
Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
or AllowIdentifier and AtomIsIdentifier(false) then or AllowIdentifier and AtomIsIdentifier then
exit(true); exit(true);
end; end;
if not ExceptionOnNotFound then if not ExceptionOnNotFound then

View File

@ -422,7 +422,7 @@ var
DeleteStartPos:=VarNode.StartPos; DeleteStartPos:=VarNode.StartPos;
MoveCursorToNodeStart(VarNode); MoveCursorToNodeStart(VarNode);
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafComma then begin if CurPos.Flag=cafComma then begin
// there is a next variable in the same var definition // there is a next variable in the same var definition
@ -1361,7 +1361,7 @@ begin
repeat repeat
LastAtom:=CurPos; LastAtom:=CurPos;
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) and (LastAtom.Flag<>cafPoint) then begin if AtomIsIdentifier and (LastAtom.Flag<>cafPoint) then begin
LastAtom:=CurPos; LastAtom:=CurPos;
CheckIdentifierAtCursor; CheckIdentifierAtCursor;
// restore cursor // restore cursor
@ -1451,7 +1451,7 @@ var
RaiseCharExpectedButAtomFound(']'); RaiseCharExpectedButAtomFound(']');
end; end;
end; end;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
LastPos:=LastAtoms.GetValueAt(0); LastPos:=LastAtoms.GetValueAt(0);
if not ((LastPos.Flag in [cafPoint]) or LastAtomIs(0,'^') if not ((LastPos.Flag in [cafPoint]) or LastAtomIs(0,'^')
or LastUpAtomIs(0,'INHERITED')) or LastUpAtomIs(0,'INHERITED'))
@ -1471,7 +1471,7 @@ var
Identifier:=Identifier+GetAtom; Identifier:=Identifier+GetAtom;
end else if AtomIsChar('^') then begin end else if AtomIsChar('^') then begin
Identifier:=Identifier+GetAtom; Identifier:=Identifier+GetAtom;
end else if AtomIsIdentifier(false) and (LastAtomIs(0,'.')) then end else if AtomIsIdentifier and (LastAtomIs(0,'.')) then
begin begin
Identifier:=Identifier+GetAtom; Identifier:=Identifier+GetAtom;
end else begin end else begin
@ -1735,7 +1735,7 @@ var
while CurPos.StartPos<CleanEndPos do begin while CurPos.StartPos<CleanEndPos do begin
LastAtomType:=CurPos.Flag; LastAtomType:=CurPos.Flag;
ReadNextAtom; 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 // this could be the start of a variable -> check
{$IFDEF CTDebug} {$IFDEF CTDebug}
DebugLn('ScanSourceForVariables B Identifier=',GetAtom); DebugLn('ScanSourceForVariables B Identifier=',GetAtom);

View File

@ -1351,7 +1351,7 @@ var CleanCursorPos: integer;
MoveCursorToNodeStart(CursorNode); MoveCursorToNodeStart(CursorNode);
ReadNextAtom; ReadNextAtom;
IsMethod:=false; IsMethod:=false;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
ReadNextAtom; ReadNextAtom;
if AtomIsChar('.') then begin if AtomIsChar('.') then begin
ReadNextAtom; ReadNextAtom;
@ -3602,7 +3602,7 @@ var
{$IFDEF ShowTriedBaseContexts} {$IFDEF ShowTriedBaseContexts}
debugln(['TFindDeclarationTool.FindBaseTypeOfNode.SearchIdentifier searching identifier "',GetIdentifier(@Src[IdentStart]),'" in unit ...']); debugln(['TFindDeclarationTool.FindBaseTypeOfNode.SearchIdentifier searching identifier "',GetIdentifier(@Src[IdentStart]),'" in unit ...']);
{$ENDIF} {$ENDIF}
AtomIsIdentifier(true); AtomIsIdentifierE;
SubParams.SetIdentifier(Self,@Src[IdentStart],nil); SubParams.SetIdentifier(Self,@Src[IdentStart],nil);
SubParams.Flags:=[fdfExceptionOnNotFound]; SubParams.Flags:=[fdfExceptionOnNotFound];
if SubParams.NewCodeTool=Self then begin if SubParams.NewCodeTool=Self then begin
@ -4900,7 +4900,7 @@ var
ReadNextAtom; // read name ReadNextAtom; // read name
if CurPos.StartPos>SrcLen then break; if CurPos.StartPos>SrcLen then break;
if AtomIsChar(';') then break; if AtomIsChar(';') then break;
AtomIsIdentifier(true); AtomIsIdentifierE;
//DebugLn(['CheckUsesSection ',GetAtom,' ',AUnitName]); //DebugLn(['CheckUsesSection ',GetAtom,' ',AUnitName]);
if UpAtomIs(UpperUnitName) then begin // compare case insensitive if UpAtomIs(UpperUnitName) then begin // compare case insensitive
if CleanPosToCaret(CurPos.StartPos,ReferencePos) then begin if CleanPosToCaret(CurPos.StartPos,ReferencePos) then begin
@ -5227,7 +5227,7 @@ begin
exit(ifrProceedSearch); exit(ifrProceedSearch);
MoveCursorToNodeStart(ProcContextNode.FirstChild); MoveCursorToNodeStart(ProcContextNode.FirstChild);
ReadNextAtom; // read name ReadNextAtom; // read name
if not AtomIsIdentifier(false) then exit; // ignore operator procs if not AtomIsIdentifier then exit; // ignore operator procs
NameAtom:=CurPos; NameAtom:=CurPos;
ReadNextAtom; ReadNextAtom;
if AtomIsChar('.') then begin if AtomIsChar('.') then begin
@ -5566,11 +5566,11 @@ begin
MoveCursorToCleanPos(IdentifierNode.StartPos); MoveCursorToCleanPos(IdentifierNode.StartPos);
AncestorStartPos:=CurPos.StartPos; AncestorStartPos:=CurPos.StartPos;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
AncestorStartPos:=CurPos.StartPos; AncestorStartPos:=CurPos.StartPos;
end; end;
if (ClassIdentNode<>nil) if (ClassIdentNode<>nil)
@ -6204,7 +6204,7 @@ begin
repeat repeat
ReadNextAtom; // read name ReadNextAtom; // read name
if AtomIsChar(';') then break; if AtomIsChar(';') then break;
AtomIsIdentifier(true); AtomIsIdentifierE;
UnitNamePos:=CurPos; UnitNamePos:=CurPos;
ReadNextAtom; ReadNextAtom;
if UpAtomIs('IN') then begin if UpAtomIs('IN') then begin
@ -6672,10 +6672,10 @@ var
if UpAtomIs('INHERITED') then if UpAtomIs('INHERITED') then
ReadNextAtom; ReadNextAtom;
FirstIdentifier:=true; FirstIdentifier:=true;
if (CurPos.Flag in AllCommonAtomWords) and AtomIsIdentifier(true) then begin if not (CurPos.Flag in AllCommonAtomWords) then exit;
FirstIdentifier:=false; AtomIsIdentifierE;
ReadNextAtom; FirstIdentifier:=false;
end; ReadNextAtom;
end; end;
begin begin
@ -6694,7 +6694,7 @@ begin
if FirstIdentifier and ExceptionIfNoVariableStart then if FirstIdentifier and ExceptionIfNoVariableStart then
RaiseIdentNotFound; RaiseIdentNotFound;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
end; end;
cafEdgedBracketOpen: cafEdgedBracketOpen:
@ -7812,7 +7812,7 @@ begin
Tool.MoveCursorToNodeStart(Node); Tool.MoveCursorToNodeStart(Node);
Tool.ReadNextAtom; Tool.ReadNextAtom;
if not Tool.AtomIsIdentifier(false) then exit; if not Tool.AtomIsIdentifier then exit;
Tool.ReadNextAtom; Tool.ReadNextAtom;
if not (CurPos.Flag in [cafEqual,cafColon]) then exit; if not (CurPos.Flag in [cafEqual,cafColon]) then exit;
Tool.ReadNextAtom; Tool.ReadNextAtom;
@ -7923,7 +7923,7 @@ begin
DebugLn('[TFindDeclarationTool.ReadOperandTypeAtCursor] A Atom=',GetAtom); DebugLn('[TFindDeclarationTool.ReadOperandTypeAtCursor] A Atom=',GetAtom);
debugln(['TFindDeclarationTool.ReadOperandTypeAtCursor StartContext=',Params.ContextNode.DescAsString,'="',dbgstr(Src,Params.ContextNode.StartPos,15),'"']); debugln(['TFindDeclarationTool.ReadOperandTypeAtCursor StartContext=',Params.ContextNode.DescAsString,'="',dbgstr(Src,Params.ContextNode.StartPos,15),'"']);
{$ENDIF} {$ENDIF}
if (AtomIsIdentifier(false)) if (AtomIsIdentifier)
or (CurPos.Flag=cafRoundBracketOpen) or (CurPos.Flag=cafRoundBracketOpen)
or UpAtomIs('INHERITED') then begin or UpAtomIs('INHERITED') then begin
// read variable // read variable
@ -10365,7 +10365,7 @@ begin
end; end;
if not UpAtomIs('OF') then exit; if not UpAtomIs('OF') then exit;
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
Params:=TFindDeclarationParams.Create; Params:=TFindDeclarationParams.Create;
try try
Params.Flags:=fdfDefaultForExpressions; Params.Flags:=fdfDefaultForExpressions;
@ -10597,7 +10597,7 @@ var
ReadNextAtom; // read ^ ReadNextAtom; // read ^
if not AtomIsChar('^') then exit; if not AtomIsChar('^') then exit;
ReadNextAtom; // read identifier ReadNextAtom; // read identifier
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
Result:=CompareSrcIdentifiers(CurPos.StartPos,p); Result:=CompareSrcIdentifiers(CurPos.StartPos,p);
end; end;

View File

@ -630,7 +630,7 @@ begin
if HasSourceType then begin if HasSourceType then begin
repeat repeat
ReadNextAtom; // read source name ReadNextAtom; // read source name
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; // read ';' (or 'platform;' or 'unimplemented;') ReadNextAtom; // read ';' (or 'platform;' or 'unimplemented;')
until CurPos.Flag<>cafPoint; until CurPos.Flag<>cafPoint;
end; end;
@ -950,7 +950,7 @@ begin
EndChildNode; EndChildNode;
// read next variable name // read next variable name
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
// create variable definition node // create variable definition node
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
@ -1168,7 +1168,7 @@ begin
if IsOperator then if IsOperator then
AtomIsCustomOperator(true,true) AtomIsCustomOperator(true,true)
else else
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
// create node for procedure head // create node for procedure head
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnProcedureHead; CurNode.Desc:=ctnProcedureHead;
@ -1185,13 +1185,13 @@ begin
CurNode.Parent.Desc:=ctnMethodMap; CurNode.Parent.Desc:=ctnMethodMap;
// read Method name of interface // read Method name of interface
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
//DebugLn(['TPascalParserTool.KeyWordFuncClassMethod ',GetAtom,' at ',CleanPosToStr(CurPos.StartPos,true)]); //DebugLn(['TPascalParserTool.KeyWordFuncClassMethod ',GetAtom,' at ',CleanPosToStr(CurPos.StartPos,true)]);
// read '=' // read '='
ReadNextAtomIsChar('='); ReadNextAtomIsChar('=');
// read implementing method name // read implementing method name
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafSemicolon then if CurPos.Flag<>cafSemicolon then
UndoReadNextAtom; UndoReadNextAtom;
@ -1307,7 +1307,11 @@ begin
ReadPrefixModifier; ReadPrefixModifier;
// read parameter name(s) // read parameter name(s)
repeat repeat
if not AtomIsIdentifier(ExceptionOnError) then exit; if not AtomIsIdentifier then begin
if ExceptionOnError then
AtomIsIdentifierSaveE;
exit;
end;
if (phpCreateNodes in Attr) then begin if (phpCreateNodes in Attr) then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
@ -1411,11 +1415,11 @@ begin
Atom := GetAtom; Atom := GetAtom;
if CurPos.Flag in [cafPoint, cafComma] then begin if CurPos.Flag in [cafPoint, cafComma] then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
end end
else if Atom='<' then begin else if Atom='<' then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
Inc(Level); Inc(Level);
end end
else if Atom='>' then else if Atom='>' then
@ -1486,7 +1490,11 @@ begin
end; end;
end; end;
if NeedIdentifier then begin 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 if (phpCreateNodes in Attr) then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnIdentifier; CurNode.Desc:=ctnIdentifier;
@ -1495,7 +1503,11 @@ begin
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); 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 if (phpCreateNodes in Attr) then
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
@ -1584,7 +1596,7 @@ begin
if (pphIsOperator in ParseAttr) and (CurPos.Flag<>cafColon) then begin if (pphIsOperator in ParseAttr) and (CurPos.Flag<>cafColon) then begin
// read operator result identifier // read operator result identifier
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if (pphCreateNodes in ParseAttr) then begin if (pphCreateNodes in ParseAttr) then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
@ -1598,7 +1610,7 @@ begin
// read function result type // read function result type
if CurPos.Flag=cafColon then begin if CurPos.Flag=cafColon then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if (pphCreateNodes in ParseAttr) then begin if (pphCreateNodes in ParseAttr) then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnIdentifier; CurNode.Desc:=ctnIdentifier;
@ -1609,7 +1621,7 @@ begin
if CurPos.Flag<>cafPoint then break; if CurPos.Flag<>cafPoint then break;
// unitname.classname.identifier // unitname.classname.identifier
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if (pphCreateNodes in ParseAttr) then if (pphCreateNodes in ParseAttr) then
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
until false; until false;
@ -1624,7 +1636,7 @@ begin
if CurPos.Flag=cafEqual then begin if CurPos.Flag=cafEqual then begin
// read interface alias // read interface alias
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;
@ -1711,7 +1723,7 @@ begin
ReadNextAtom; ReadNextAtom;
if AtomIsChar(':') then begin if AtomIsChar(':') then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
end else if UpAtomIs('EXTERNAL') then begin end else if UpAtomIs('EXTERNAL') then begin
@ -1734,7 +1746,7 @@ begin
until false; until false;
if CurPos.Flag=cafColon then begin if CurPos.Flag=cafColon then begin
ReadNextAtom; ReadNextAtom;
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
RaiseStringExpectedButAtomFound(ctsStringConstant); RaiseStringExpectedButAtomFound(ctsStringConstant);
ReadConstant(true,false,[]); ReadConstant(true,false,[]);
end; end;
@ -1910,7 +1922,7 @@ begin
repeat repeat
ReadNextAtom; // read name ReadNextAtom; // read name
if CurPos.Flag=cafSemicolon then break; if CurPos.Flag=cafSemicolon then break;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnUseUnit; CurNode.Desc:=ctnUseUnit;
repeat repeat
@ -1918,7 +1930,7 @@ begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafPoint then break; if CurPos.Flag<>cafPoint then break;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
until false; until false;
if UpAtomIs('IN') then begin if UpAtomIs('IN') then begin
ReadNextAtom; ReadNextAtom;
@ -1963,7 +1975,7 @@ begin
repeat repeat
ReadNextAtom; // read name ReadNextAtom; // read name
if CurPos.Flag=cafSemicolon then break; if CurPos.Flag=cafSemicolon then break;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafSemicolon then break; if CurPos.Flag=cafSemicolon then break;
if CurPos.Flag<>cafComma then if CurPos.Flag<>cafComma then
@ -1991,7 +2003,7 @@ begin
repeat repeat
ReadNextAtom; // read name ReadNextAtom; // read name
if CurPos.Flag=cafSemicolon then break; if CurPos.Flag=cafSemicolon then break;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if UpAtomIs('IN') then begin if UpAtomIs('IN') then begin
ReadNextAtom; ReadNextAtom;
@ -2326,7 +2338,7 @@ begin
RaiseStringExpectedButAtomFound('property'); RaiseStringExpectedButAtomFound('property');
end; end;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then begin if CurPos.Flag=cafEdgedBracketOpen then begin
// read parameter list // read parameter list
@ -2354,7 +2366,7 @@ begin
RaiseSemicolonAfterPropSpecMissing('nodefault'); RaiseSemicolonAfterPropSpecMissing('nodefault');
end else if UpAtomIs('ENUMERATOR') then begin end else if UpAtomIs('ENUMERATOR') then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafSemicolon then if CurPos.Flag<>cafSemicolon then
RaiseSemicolonAfterPropSpecMissing('enumerator'); RaiseSemicolonAfterPropSpecMissing('enumerator');
@ -2571,7 +2583,7 @@ begin
if IsOperator then if IsOperator then
AtomIsCustomOperator(true,true) AtomIsCustomOperator(true,true)
else else
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if ChildCreated then begin if ChildCreated then begin
// create node for procedure head // create node for procedure head
CreateChildNode; CreateChildNode;
@ -2600,7 +2612,7 @@ begin
if IsOperator then if IsOperator then
AtomIsCustomOperator(true,true) AtomIsCustomOperator(true,true)
else else
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;
@ -2921,11 +2933,11 @@ begin
ReadNextAtom; ReadNextAtom;
while UpAtomIs('INHERITED') do while UpAtomIs('INHERITED') do
ReadNextAtom; ReadNextAtom;
Result:=AtomIsIdentifier(false) Result:=AtomIsIdentifier
or (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]); or (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]);
if not Result then exit; if not Result then exit;
repeat repeat
if AtomIsIdentifier(false) then if AtomIsIdentifier then
ReadNextAtom; ReadNextAtom;
repeat repeat
if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then begin if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then begin
@ -3071,7 +3083,7 @@ begin
end; end;
// read variable name // read variable name
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateNodes then begin if CreateNodes then begin
// ctnOnIdentifier for the variable or the type // ctnOnIdentifier for the variable or the type
CreateChildNode; CreateChildNode;
@ -3084,7 +3096,7 @@ begin
if CreateNodes then if CreateNodes then
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateNodes then begin if CreateNodes then begin
// ctnIdentifier for the type // ctnIdentifier for the type
CreateChildNode; CreateChildNode;
@ -3097,7 +3109,7 @@ begin
// for example: on Unit.Exception do ; // for example: on Unit.Exception do ;
// or: on E:Unit.Exception do ; // or: on E:Unit.Exception do ;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateNodes then begin if CreateNodes then begin
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
end; end;
@ -3215,14 +3227,14 @@ begin
// for example 'var a: char; public name test;' // for example 'var a: char; public name test;'
ReadNextAtom; ReadNextAtom;
if (not AtomIsStringConstant) if (not AtomIsStringConstant)
and (not AtomIsIdentifier(false)) then and (not AtomIsIdentifier) then
RaiseStringExpectedButAtomFound(ctsStringConstant); RaiseStringExpectedButAtomFound(ctsStringConstant);
ReadConstant(true,false,[]); ReadConstant(true,false,[]);
if UpAtomIs('SECTION') then begin if UpAtomIs('SECTION') then begin
// for example FreePascal_TLS_callback : pointer = @Exec_Tls_callback; public name '__FPC_tls_callbacks' section '.CRT$XLFPC' // for example FreePascal_TLS_callback : pointer = @Exec_Tls_callback; public name '__FPC_tls_callbacks' section '.CRT$XLFPC'
ReadNextAtom; ReadNextAtom;
if (not AtomIsStringConstant) if (not AtomIsStringConstant)
and (not AtomIsIdentifier(false)) then and (not AtomIsIdentifier) then
RaiseStringExpectedButAtomFound(ctsStringConstant); RaiseStringExpectedButAtomFound(ctsStringConstant);
ReadConstant(true,false,[]); ReadConstant(true,false,[]);
end; end;
@ -3364,7 +3376,7 @@ begin
// read all type definitions Name = Type; or generic Name<List> = Type; // read all type definitions Name = Type; or generic Name<List> = Type;
repeat repeat
ReadNextAtom; // name ReadNextAtom; // name
if UpAtomIs('GENERIC') or AtomIsIdentifier(false) then begin if UpAtomIs('GENERIC') or AtomIsIdentifier then begin
ReadTypeNameAndDefinition; ReadTypeNameAndDefinition;
end else begin end else begin
UndoReadNextAtom; UndoReadNextAtom;
@ -3406,7 +3418,7 @@ begin
// read all variable definitions Name : Type; [cvar;] [public [name '']] // read all variable definitions Name : Type; [cvar;] [public [name '']]
repeat repeat
ReadNextAtom; // name ReadNextAtom; // name
if AtomIsIdentifier(false) if AtomIsIdentifier
and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC])) and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC]))
or (not UpAtomIs('PROPERTY'))) or (not UpAtomIs('PROPERTY')))
then begin then begin
@ -3418,7 +3430,7 @@ begin
CurNode.EndPos:=LastIdentifierEnd; CurNode.EndPos:=LastIdentifierEnd;
EndChildNode; // close variable definition EndChildNode; // close variable definition
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
LastIdentifierEnd:=CurPos.EndPos; LastIdentifierEnd:=CurPos.EndPos;
@ -3465,7 +3477,7 @@ begin
ReadNextAtom; // name ReadNextAtom; // name
if CurPos.Flag=cafSemicolon then begin if CurPos.Flag=cafSemicolon then begin
// ignore empty semicolons // ignore empty semicolons
end else if AtomIsIdentifier(false) then begin end else if AtomIsIdentifier then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnConstDefinition; CurNode.Desc:=ctnConstDefinition;
ReadConst; ReadConst;
@ -3503,7 +3515,7 @@ begin
// read all string constants Name = 'abc'; // read all string constants Name = 'abc';
repeat repeat
ReadNextAtom; // name ReadNextAtom; // name
if AtomIsIdentifier(false) if AtomIsIdentifier
and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC])) and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC]))
or (not UpAtomIs('PROPERTY'))) or (not UpAtomIs('PROPERTY')))
then begin then begin
@ -3514,7 +3526,7 @@ begin
RaiseCharExpectedButAtomFound('='); RaiseCharExpectedButAtomFound('=');
// read string constant // read string constant
ReadNextAtom; ReadNextAtom;
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
RaiseStringExpectedButAtomFound(ctsStringConstant); RaiseStringExpectedButAtomFound(ctsStringConstant);
ReadConstant(true,false,[]); ReadConstant(true,false,[]);
// read hint modifier // read hint modifier
@ -3555,11 +3567,11 @@ begin
CurNode.Desc:=ctnExportsSection; CurNode.Desc:=ctnExportsSection;
repeat repeat
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
if UpAtomIs('INDEX') then begin if UpAtomIs('INDEX') then begin
@ -3593,7 +3605,7 @@ begin
// read all constants // read all constants
repeat repeat
ReadNextAtom; // identifier or number ReadNextAtom; // identifier or number
if (not AtomIsIdentifier(false)) and (not AtomIsNumber) then begin if (not AtomIsIdentifier) and (not AtomIsNumber) then begin
RaiseStringExpectedButAtomFound(ctsIdentifier); RaiseStringExpectedButAtomFound(ctsIdentifier);
end; end;
CreateChildNode; CreateChildNode;
@ -3629,7 +3641,7 @@ begin
repeat repeat
// read property Name // read property Name
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnGlobalProperty; CurNode.Desc:=ctnGlobalProperty;
ReadNextAtom; ReadNextAtom;
@ -3724,7 +3736,7 @@ begin
else else
CurNode.Desc:=ctnTypeDefinition; CurNode.Desc:=ctnTypeDefinition;
// read name // read name
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if (TypeNode.Desc=ctnGenericType) and (not AtomIsChar('<')) then if (TypeNode.Desc=ctnGenericType) and (not AtomIsChar('<')) then
RaiseCharExpectedButAtomFound('<'); RaiseCharExpectedButAtomFound('<');
@ -3742,7 +3754,7 @@ begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnGenericParams; CurNode.Desc:=ctnGenericParams;
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
repeat repeat
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnGenericParameter; CurNode.Desc:=ctnGenericParameter;
@ -3752,7 +3764,7 @@ begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafComma then begin if CurPos.Flag=cafComma then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
end else if AtomIsChar('>') then begin end else if AtomIsChar('>') then begin
break; break;
end else if AtomIs('>=') then begin end else if AtomIs('>=') then begin
@ -3804,7 +3816,7 @@ begin
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
if not AtomIsChar('<') then exit; if not AtomIsChar('<') then exit;
@ -3896,7 +3908,7 @@ begin
IsForward:=false; IsForward:=false;
CurNode.Desc:=ctnClassOfType; CurNode.Desc:=ctnClassOfType;
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnIdentifier; CurNode.Desc:=ctnIdentifier;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
@ -3962,7 +3974,7 @@ begin
CurNode.Desc:=ctnClassHelperFor; CurNode.Desc:=ctnClassHelperFor;
repeat repeat
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
ReadNextAtom; ReadNextAtom;
until CurPos.Flag<>cafPoint; until CurPos.Flag<>cafPoint;
@ -4217,11 +4229,11 @@ begin
if IsFunction then begin if IsFunction then begin
if (CurPos.Flag=cafColon) then begin if (CurPos.Flag=cafColon) then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
end else begin end else begin
@ -4392,7 +4404,7 @@ begin
CreateChildNode; CreateChildNode;
SubRangeOperatorFound:=false; SubRangeOperatorFound:=false;
if CurPos.Flag in AllCommonAtomWords then begin if CurPos.Flag in AllCommonAtomWords then begin
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadTypeReference; ReadTypeReference;
if CurNode.EndPos > 0 then if CurNode.EndPos > 0 then
Exit(True); Exit(True);
@ -4454,7 +4466,7 @@ begin
repeat repeat
ReadNextAtom; // read enum name ReadNextAtom; // read enum name
if (CurPos.Flag=cafRoundBracketClose) then break; if (CurPos.Flag=cafRoundBracketClose) then break;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnEnumIdentifier; CurNode.Desc:=ctnEnumIdentifier;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
@ -4533,7 +4545,7 @@ begin
case a:b.c of case a:b.c of
case a:(b,c) of case a:(b,c) of
} }
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
{$IFDEF VerboseRecordCase} {$IFDEF VerboseRecordCase}
@ -4550,7 +4562,7 @@ begin
if CurPos.Flag<>cafRoundBracketClose then begin if CurPos.Flag<>cafRoundBracketClose then begin
repeat repeat
// read enum // read enum
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnEnumIdentifier; CurNode.Desc:=ctnEnumIdentifier;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
@ -4567,14 +4579,14 @@ begin
ReadNextAtom; ReadNextAtom;
end else begin end else begin
// identifier // identifier
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnIdentifier; CurNode.Desc:=ctnIdentifier;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; // unit.type ReadNextAtom; // unit.type
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
ReadNextAtom; ReadNextAtom;
end; end;
@ -4621,7 +4633,7 @@ begin
end else begin end else begin
// sub identifier // sub identifier
repeat repeat
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnVarDefinition; CurNode.Desc:=ctnVarDefinition;
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
@ -5103,7 +5115,7 @@ begin
ReadNextAtom; // read keyword 'property' ReadNextAtom; // read keyword 'property'
if UpAtomIs('CLASS') then ReadNextAtom; if UpAtomIs('CLASS') then ReadNextAtom;
ReadNextAtom; // read property name ReadNextAtom; // read property name
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if (CurPos.Flag=cafEdgedBracketOpen) then begin if (CurPos.Flag=cafEdgedBracketOpen) then begin
// read parameter list // read parameter list
@ -5115,7 +5127,7 @@ begin
exit; exit;
end; end;
ReadNextAtom; // read type ReadNextAtom; // read type
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
Result:=true; Result:=true;
end; end;
@ -5127,7 +5139,7 @@ begin
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(False) then Exit; if not AtomIsIdentifier then Exit;
ReadNextAtom; ReadNextAtom;
end; end;
if UpAtomIs('INDEX') then begin if UpAtomIs('INDEX') then begin
@ -5135,7 +5147,7 @@ begin
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(False) then Exit; if not AtomIsIdentifier then Exit;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;
@ -5157,7 +5169,7 @@ begin
CurNode.Desc:=ctnClassGUID; CurNode.Desc:=ctnClassGUID;
// read GUID // read GUID
ReadNextAtom; ReadNextAtom;
if (not AtomIsStringConstant) and (not AtomIsIdentifier(false)) then if (not AtomIsStringConstant) and (not AtomIsIdentifier) then
RaiseStringConstantExpected; RaiseStringConstantExpected;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafEdgedBracketClose then if CurPos.Flag<>cafEdgedBracketClose then
@ -5185,7 +5197,7 @@ begin
ReadSpecialize(CreateChildNodes); ReadSpecialize(CreateChildNodes);
end else begin end else begin
// read Identifier or Unit.Identifier // read Identifier or Unit.Identifier
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateChildNodes then begin if CreateChildNodes then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnIdentifier; CurNode.Desc:=ctnIdentifier;
@ -5224,7 +5236,7 @@ begin
end; end;
// read identifier (the name of the generic) // read identifier (the name of the generic)
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateChildNodes then begin if CreateChildNodes then begin
CreateChildNode; CreateChildNode;
CurNode.Desc:=ctnSpecializeType; CurNode.Desc:=ctnSpecializeType;
@ -5234,7 +5246,7 @@ begin
if Curpos.Flag=cafPoint then begin if Curpos.Flag=cafPoint then begin
// first identifier was unitname, now read the type // first identifier was unitname, now read the type
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
if CreateChildNodes then if CreateChildNodes then
CurNode.EndPos:=CurPos.EndPos; CurNode.EndPos:=CurPos.EndPos;
ReadNextAtom; ReadNextAtom;
@ -5253,12 +5265,12 @@ begin
repeat repeat
// read identifier (a parameter of the generic type) // read identifier (a parameter of the generic type)
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
if Curpos.Flag=cafPoint then begin if Curpos.Flag=cafPoint then begin
// first identifier was unitname, now read the type // first identifier was unitname, now read the type
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
if AtomIsChar('>') then if AtomIsChar('>') then
@ -5362,7 +5374,7 @@ begin
if IsOperator then if IsOperator then
AtomIsCustomOperator(true,true) AtomIsCustomOperator(true,true)
else else
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
while (CurPos.Flag=cafPoint) do begin while (CurPos.Flag=cafPoint) do begin
// read procedure name of a class method (the name after the . ) // read procedure name of a class method (the name after the . )
@ -5370,7 +5382,7 @@ begin
if IsOperator then if IsOperator then
AtomIsCustomOperator(true,true) AtomIsCustomOperator(true,true)
else else
AtomIsIdentifier(true); AtomIsIdentifierSaveE;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;

View File

@ -352,7 +352,7 @@ begin
if (not UpAtomIs('PROPERTY')) then exit; if (not UpAtomIs('PROPERTY')) then exit;
ReadNextAtom; ReadNextAtom;
end; end;
AtomIsIdentifier(true); AtomIsIdentifierE;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then begin if CurPos.Flag=cafEdgedBracketOpen then begin
if EmptyIfIndexed then exit; if EmptyIfIndexed then exit;
@ -363,7 +363,7 @@ begin
if not (CurPos.Flag=cafColon) then if not (CurPos.Flag=cafColon) then
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[':',GetAtom]); RaiseExceptionFmt(ctsStrExpectedButAtomFound,[':',GetAtom]);
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
if InUpperCase then if InUpperCase then
Result:=GetUpAtom Result:=GetUpAtom
else else
@ -389,7 +389,7 @@ begin
MoveCursorToNodeStart(ProcHeadNode); MoveCursorToNodeStart(ProcHeadNode);
repeat repeat
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
if phpInUpperCase in Attr then if phpInUpperCase in Attr then
Part:=GetUpAtom Part:=GetUpAtom
else else
@ -461,7 +461,7 @@ begin
// read name // read name
if ((not IsOperator) if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) 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 if TheClassName<>'' then begin
s:=TheClassName+'.'; s:=TheClassName+'.';
@ -488,7 +488,7 @@ begin
ExtractNextAtom(true,Attr); ExtractNextAtom(true,Attr);
if ((not IsOperator) if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
and (not AtomIsIdentifier(false)) then exit; and (not AtomIsIdentifier) then exit;
until false; until false;
end else begin end else begin
// read only part of name // read only part of name
@ -509,7 +509,7 @@ begin
ExtractNextAtom(not (phpWithoutClassName in Attr),Attr); ExtractNextAtom(not (phpWithoutClassName in Attr),Attr);
if ((not IsOperator) if ((not IsOperator)
or (not WordIsCustomOperator.DoItCaseInsensitive(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))) 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 end else begin
// read name // read name
ExtractNextAtom(not (phpWithoutName in Attr),Attr); ExtractNextAtom(not (phpWithoutName in Attr),Attr);
@ -531,11 +531,11 @@ begin
// read result type // read result type
if (CurPos.Flag=cafColon) then begin if (CurPos.Flag=cafColon) then begin
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
end; end;
ExtractProcHeadPos:=phepResultType; ExtractProcHeadPos:=phepResultType;
@ -668,13 +668,13 @@ begin
ReadNextAtom; // '(' ReadNextAtom; // '('
if CurPos.Flag<>cafRoundBracketOpen then exit; if CurPos.Flag<>cafRoundBracketOpen then exit;
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
MoveCursorToCleanPos(CurPos.StartPos); MoveCursorToCleanPos(CurPos.StartPos);
ExtractProcHeadPos:=phepNone; ExtractProcHeadPos:=phepNone;
InitExtraction; InitExtraction;
while (CurPos.StartPos<=SrcLen) do begin while (CurPos.StartPos<=SrcLen) do begin
ExtractNextAtom(true,Attr); // read ancestor/interface ExtractNextAtom(true,Attr); // read ancestor/interface
if not AtomIsIdentifier(false) then break; if not AtomIsIdentifier then break;
ExtractNextAtom(true,Attr); // read ',' ExtractNextAtom(true,Attr); // read ','
if not AtomIsChar(',') then break; if not AtomIsChar(',') then break;
end; end;
@ -694,7 +694,7 @@ begin
MoveCursorToNodeStart(ProcNode); MoveCursorToNodeStart(ProcNode);
repeat repeat
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then break; if not AtomIsIdentifier then break;
Part:=GetAtom; Part:=GetAtom;
ReadNextAtom; ReadNextAtom;
if (Scanner.CompilerMode = cmDELPHI) and AtomIsChar('<') then if (Scanner.CompilerMode = cmDELPHI) and AtomIsChar('<') then
@ -945,11 +945,11 @@ begin
if (CurPos.Flag=cafColon) then begin if (CurPos.Flag=cafColon) then begin
// read function result type // read function result type
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then break; if not AtomIsIdentifier then break;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;
@ -1016,7 +1016,7 @@ begin
break; break;
end; end;
ReadNextAtom; ReadNextAtom;
until not AtomIsIdentifier(false); until not AtomIsIdentifier;
end; end;
procedure TPascalReaderTool.MoveCursorBehindProcName(ProcNode: TCodeTreeNode); procedure TPascalReaderTool.MoveCursorBehindProcName(ProcNode: TCodeTreeNode);
@ -1026,11 +1026,11 @@ begin
ProcNode:=ProcNode.FirstChild; ProcNode:=ProcNode.FirstChild;
MoveCursorToNodeStart(ProcNode); MoveCursorToNodeStart(ProcNode);
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ReadNextAtom; ReadNextAtom;
end; end;
end else if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen,cafColon] end else if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen,cafColon]
@ -1106,7 +1106,7 @@ begin
end else begin end else begin
MoveCursorToNodeStart(ProcNode); MoveCursorToNodeStart(ProcNode);
ReadNextAtom; ReadNextAtom;
while AtomIsIdentifier(false) do begin while AtomIsIdentifier do begin
ReadNextAtom; ReadNextAtom;
if (CurPos.Flag<>cafPoint) then break; if (CurPos.Flag<>cafPoint) then break;
ReadNextAtom; ReadNextAtom;
@ -1117,7 +1117,7 @@ begin
if CurPos.StartPos>CleanPos then exit; if CurPos.StartPos>CleanPos then exit;
// read optional result variable (e.g. operator can have them) // read optional result variable (e.g. operator can have them)
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then ReadNextAtom; if AtomIsIdentifier then ReadNextAtom;
if CurPos.Flag<>cafColon then exit; if CurPos.Flag<>cafColon then exit;
Result:=CleanPos<=CurPos.StartPos; Result:=CleanPos<=CurPos.StartPos;
end; end;
@ -1135,7 +1135,7 @@ begin
if (not UpAtomIs('PROPERTY')) then exit; if (not UpAtomIs('PROPERTY')) then exit;
ReadNextAtom; ReadNextAtom;
end; end;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then begin if CurPos.Flag=cafEdgedBracketOpen then begin
ReadTilBracketClose(true); ReadTilBracketClose(true);
@ -1175,7 +1175,7 @@ begin
if (not UpAtomIs('PROPERTY')) then exit; if (not UpAtomIs('PROPERTY')) then exit;
ReadNextAtom; ReadNextAtom;
end; end;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ReadNextAtom; ReadNextAtom;
end; end;
@ -1207,7 +1207,7 @@ begin
MoveCursorToNodeStart(ProcNode); MoveCursorToNodeStart(ProcNode);
repeat repeat
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit(nil); if not AtomIsIdentifier then exit(nil);
Result:=@Src[CurPos.StartPos]; Result:=@Src[CurPos.StartPos];
ReadNextAtom; ReadNextAtom;
until CurPos.Flag<>cafPoint; until CurPos.Flag<>cafPoint;
@ -1328,12 +1328,12 @@ begin
// read result type // read result type
if (CurPos.Flag=cafColon) then begin if (CurPos.Flag=cafColon) then begin
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
// unit.type // unit.type
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ExtractNextAtom(phpWithResultType in Attr,Attr); ExtractNextAtom(phpWithResultType in Attr,Attr);
end; end;
ExtractProcHeadPos:=phepResultType; ExtractProcHeadPos:=phepResultType;
@ -1962,13 +1962,13 @@ begin
ReadNextAtom; // read source type 'program', 'unit' ... ReadNextAtom; // read source type 'program', 'unit' ...
if (Tree.Root.Desc=ctnProgram) and (not UpAtomIs('PROGRAM')) then exit; if (Tree.Root.Desc=ctnProgram) and (not UpAtomIs('PROGRAM')) then exit;
ReadNextAtom; // read name ReadNextAtom; // read name
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
NamePos:=CurPos; NamePos:=CurPos;
Result:=true; Result:=true;
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
NamePos.EndPos:=CurPos.EndPos; NamePos.EndPos:=CurPos.EndPos;
ReadNextAtom; ReadNextAtom;
end; end;
@ -1991,12 +1991,12 @@ begin
ReadNextAtom; // read source type 'program', 'unit' ... ReadNextAtom; // read source type 'program', 'unit' ...
if (Tree.Root.Desc<>ctnProgram) or UpAtomIs('PROGRAM') then begin if (Tree.Root.Desc<>ctnProgram) or UpAtomIs('PROGRAM') then begin
ReadNextAtom; // read name ReadNextAtom; // read name
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
Result:=copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
ReadNextAtom; ReadNextAtom;
while CurPos.Flag=cafPoint do begin while CurPos.Flag=cafPoint do begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
Result:=Result+'.'+copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos); Result:=Result+'.'+copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
ReadNextAtom; ReadNextAtom;
end; end;
@ -2035,7 +2035,7 @@ begin
MoveCursorToNodeStart(ProcNode.FirstChild); // ctnProcedureHead MoveCursorToNodeStart(ProcNode.FirstChild); // ctnProcedureHead
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ReadNextAtom; ReadNextAtom;
if (CurPos.Flag<>cafPoint) then exit; if (CurPos.Flag<>cafPoint) then exit;
Result:=true; Result:=true;
@ -2475,7 +2475,7 @@ begin
Result:=false; Result:=false;
if not MoveCursorToPropName(PropNode) then exit; if not MoveCursorToPropName(PropNode) then exit;
if not AtomIsIdentifier(ExceptionOnNotFound) then exit; if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then begin if CurPos.Flag=cafEdgedBracketOpen then begin
if not ReadTilBracketClose(ExceptionOnNotFound) then exit; if not ReadTilBracketClose(ExceptionOnNotFound) then exit;
@ -2484,11 +2484,11 @@ begin
if CurPos.Flag=cafColon then begin if CurPos.Flag=cafColon then begin
// read type // read type
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(ExceptionOnNotFound) then exit; if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(ExceptionOnNotFound) then exit; if not AtomIsIdentifierE(ExceptionOnNotFound) then exit;
ReadNextAtom; ReadNextAtom;
end; end;
end; end;
@ -2512,7 +2512,7 @@ begin
end else if UpAtomIs('ENUMERATOR') then begin end else if UpAtomIs('ENUMERATOR') then begin
if CompareIdentifierPtrs(@Src[CurPos.StartPos],Pointer(s))=0 then exit(true); if CompareIdentifierPtrs(@Src[CurPos.StartPos],Pointer(s))=0 then exit(true);
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
end else end else
exit; exit;
ReadNextAtom; ReadNextAtom;
@ -2602,13 +2602,13 @@ function TPascalReaderTool.ReadNextUsedUnit(out UnitNameRange,
// after reading CurPos is on atom behind, i.e. comma or semicolon // after reading CurPos is on atom behind, i.e. comma or semicolon
begin begin
Result:=false; Result:=false;
if not AtomIsIdentifier(SyntaxExceptions) then exit; if not AtomIsIdentifierE(SyntaxExceptions) then exit;
UnitNameRange:=CurPos; UnitNameRange:=CurPos;
repeat repeat
ReadNextAtom; ReadNextAtom;
if CurPos.Flag<>cafPoint then break; if CurPos.Flag<>cafPoint then break;
ReadNextAtom; ReadNextAtom;
if not AtomIsIdentifier(SyntaxExceptions) then exit; if not AtomIsIdentifierE(SyntaxExceptions) then exit;
UnitNameRange.EndPos:=CurPos.EndPos; UnitNameRange.EndPos:=CurPos.EndPos;
until false; until false;
if UpAtomIs('IN') then begin if UpAtomIs('IN') then begin
@ -2637,13 +2637,13 @@ begin
end else begin end else begin
InAtom:=CleanAtomPosition; InAtom:=CleanAtomPosition;
end; end;
AtomIsIdentifier(true); AtomIsIdentifierE;
UnitNameRange:=CurPos; UnitNameRange:=CurPos;
repeat repeat
ReadPriorAtom; ReadPriorAtom;
if CurPos.Flag<>cafPoint then break; if CurPos.Flag<>cafPoint then break;
ReadPriorAtom; ReadPriorAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
UnitNameRange.StartPos:=CurPos.StartPos; UnitNameRange.StartPos:=CurPos.StartPos;
until false; until false;
end; end;
@ -2693,7 +2693,7 @@ begin
else else
p:=nil; p:=nil;
repeat repeat
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
if (p<>nil) then begin if (p<>nil) then begin
if CompareIdentifiers(p,@Src[CurPos.StartPos])=0 then if CompareIdentifiers(p,@Src[CurPos.StartPos])=0 then
inc(p,CurPos.EndPos-CurPos.StartPos) inc(p,CurPos.EndPos-CurPos.StartPos)

View File

@ -1056,7 +1056,7 @@ begin
ReadNextAtom; // read 'uses' ReadNextAtom; // read 'uses'
repeat repeat
ReadNextAtom; // read name ReadNextAtom; // read name
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
if ReadAndCompareUsedUnit(AnUnitName) then begin if ReadAndCompareUsedUnit(AnUnitName) then begin
// unit found // unit found
exit(true); exit(true);
@ -1084,7 +1084,7 @@ begin
repeat repeat
EndPos:=CurPos.StartPos; EndPos:=CurPos.StartPos;
ReadNextAtom; // read name ReadNextAtom; // read name
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
inc(UnitPos); inc(UnitPos);
StartPos:=CurPos.StartPos; StartPos:=CurPos.StartPos;
Found:=ReadAndCompareUsedUnit(AnUnitName); Found:=ReadAndCompareUsedUnit(AnUnitName);
@ -3094,7 +3094,7 @@ begin
ReadNextAtom; ReadNextAtom;
if AtomIsChar('(') then begin if AtomIsChar('(') then begin
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then if AtomIsIdentifier then
AncestorClassName:=GetAtom; AncestorClassName:=GetAtom;
end; end;
if AncestorClassName='' then if AncestorClassName='' then
@ -3222,7 +3222,7 @@ begin
MoveCursorToCleanPos(1); MoveCursorToCleanPos(1);
repeat repeat
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
CurIdentNode:= CurIdentNode:=
IdentTree.FindKey(@Src[CurPos.StartPos], IdentTree.FindKey(@Src[CurPos.StartPos],
TListSortCompare(@CompareIdentifiers)); TListSortCompare(@CompareIdentifiers));
@ -3283,7 +3283,7 @@ type
Result:=scatStrConst Result:=scatStrConst
else if AtomIsChar('+') then else if AtomIsChar('+') then
Result:=scatPlus Result:=scatPlus
else if AtomIsIdentifier(false) then else if AtomIsIdentifier then
Result:=scatIdent Result:=scatIdent
else if UpAtomIs('INHERITED') then else if UpAtomIs('INHERITED') then
Result:=scatInherited Result:=scatInherited
@ -3601,7 +3601,7 @@ begin
ConvertStringConstant; ConvertStringConstant;
end else if AtomIsChar('+') then begin end else if AtomIsChar('+') then begin
// simply ignore // simply ignore
end else if (CurPos.Flag=cafRoundBracketOpen) or AtomIsIdentifier(false) end else if (CurPos.Flag=cafRoundBracketOpen) or AtomIsIdentifier
then begin then begin
// add as parameter // add as parameter
ConvertOther; ConvertOther;
@ -4107,7 +4107,7 @@ function TStandardCodeTool.GatherResourceStringsWithValue(
begin begin
MoveCursorToNodeStart(ANode); MoveCursorToNodeStart(ANode);
ReadNextAtom; // read identifier ReadNextAtom; // read identifier
if not AtomIsIdentifier(false) then exit; if not AtomIsIdentifier then exit;
ReadNextAtom; // read = ReadNextAtom; // read =
if CurPos.Flag<>cafEqual then exit; if CurPos.Flag<>cafEqual then exit;
ReadNextAtom; // read start of string constant ReadNextAtom; // read start of string constant
@ -4811,14 +4811,14 @@ begin
// var X, i: integer; -> var [X, ]i: integer; // var X, i: integer; -> var [X, ]i: integer;
MoveCursorToCleanPos(Node.StartPos); MoveCursorToCleanPos(Node.StartPos);
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(','); if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
DeleteEndPos:=CurPos.EndPos; DeleteEndPos:=CurPos.EndPos;
end else if PrevSibling<>nil then begin end else if PrevSibling<>nil then begin
// var i, X: integer; -> var i[, X]: integer; // var i, X: integer; -> var i[, X]: integer;
MoveCursorToCleanPos(PrevSibling.StartPos); MoveCursorToCleanPos(PrevSibling.StartPos);
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(','); if not ReadNextAtomIsChar(',') then RaiseCharExpectedButAtomFound(',');
DeleteStartPos:=CurPos.StartPos; DeleteStartPos:=CurPos.StartPos;
end else begin end else begin
@ -5912,7 +5912,7 @@ var
} }
NeedCompletion:=CleanCursorPos; NeedCompletion:=CleanCursorPos;
end else if CurPos.Flag=cafWord then begin end else if CurPos.Flag=cafWord then begin
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEqual then begin if CurPos.Flag=cafEqual then begin
{ For example: { For example:
@ -6538,11 +6538,11 @@ begin
if CurPos.Flag=cafRoundBracketOpen then begin if CurPos.Flag=cafRoundBracketOpen then begin
repeat repeat
ReadNextAtom; ReadNextAtom;
if AtomIsIdentifier(false) then begin if AtomIsIdentifier then begin
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafPoint then begin if CurPos.Flag=cafPoint then begin
ReadNextAtom; ReadNextAtom;
AtomIsIdentifier(true); AtomIsIdentifierE;
end; end;
end; end;
if CurPos.Flag=cafRoundBracketClose then break; if CurPos.Flag=cafRoundBracketClose then break;