codetools: removed TCustomCodeTool.UpperSrc

git-svn-id: trunk@19832 -
This commit is contained in:
mattias 2009-05-07 08:16:34 +00:00
parent c756e3bd21
commit 8f19b73c43
11 changed files with 178 additions and 191 deletions

View File

@ -4406,7 +4406,7 @@ var
ReadNextAtom;
if AtomIsChar(';') then exit;
AtomIsIdentifier(true);
if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then exit;
Parts[SpecParam]:=CurPos;
ReadNextAtom;
@ -4462,7 +4462,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
{$ENDIF}
RaiseException(ctsErrorInParamList);
end;
CleanParamList:=GetExtraction;
CleanParamList:=GetExtraction(true);
Parts[ppParamList].EndPos:=CurPos.EndPos;
end else
CleanParamList:='';
@ -4502,7 +4502,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
RaiseException(ctsIndexSpecifierRedefined);
Parts[ppIndexWord]:=CurPos;
ReadNextAtom;
if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
Parts[ppIndex].StartPos:=CurPos.StartPos;
@ -4533,7 +4533,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
RaiseException(ctsDefaultSpecifierRedefined);
Parts[ppDefaultWord]:=CurPos;
ReadNextAtom;
if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
RaiseExceptionFmt(ctsDefaultParameterExpectedButAtomFound,[GetAtom]);
Parts[ppDefault].StartPos:=CurPos.StartPos;
@ -4550,7 +4550,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
while CurPos.Flag=cafComma do begin
ReadNextAtom;
AtomIsIdentifier(true);
if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
ReadNextAtom;
@ -4665,7 +4665,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
{$ENDIF}
RaiseException(ctsErrorInParamList);
end;
ParamList:=GetExtraction;
ParamList:=GetExtraction(false);
if (Parts[ppIndexWord].StartPos<1) then begin
// param list, no index
AccessFunc:='function '+AccessParam
@ -4788,7 +4788,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
phpWithComments])
then
RaiseException(ctsErrorInParamList);
ParamList:=GetExtraction;
ParamList:=GetExtraction(false);
if (Parts[ppIndexWord].StartPos<1) then begin
// param list, no index
AccessFunc:='procedure '+AccessParam

View File

@ -80,7 +80,6 @@ type
CursorPos: TCodeXYPosition;
Src: string;
GapSrc: string;
GapUpperSrc: string;
Code: TCodeBuffer;
Valid: boolean;
CurPos: TAtomPosition;
@ -166,7 +165,6 @@ type
// current Values, Position, Node ...
CurPos: TAtomPosition;
Src: string;
UpperSrc: string;
SrcLen: integer;
CurNode: TCodeTreeNode;
LastAtoms: TAtomRing;
@ -564,16 +562,20 @@ begin
end;
function TCustomCodeTool.UpAtomIs(const AnAtom: shortstring): boolean;
var AnAtomLen,i : integer;
var
AnAtomLen, i: integer;
p: PChar;
begin
Result:=false;
AnAtomLen:=length(AnAtom);
if AnAtomLen<>CurPos.EndPos-CurPos.StartPos then exit;
if (CurPos.EndPos<=SrcLen+1) and (CurPos.StartPos>=1) then begin
AnAtomLen:=length(AnAtom);
if AnAtomLen=CurPos.EndPos-CurPos.StartPos then begin
for i:=1 to AnAtomLen do
if AnAtom[i]<>UpperSrc[CurPos.StartPos-1+i] then exit;
Result:=true;
p:=@Src[CurPos.StartPos];
for i:=1 to AnAtomLen do begin
if AnAtom[i]<>UpChars[p^] then exit;
inc(p);
end;
Result:=true;
end;
end;
@ -597,7 +599,9 @@ end;
function TCustomCodeTool.CompareNodeIdentChars(ANode: TCodeTreeNode;
const AnUpperIdent: string): integer;
var AnIdentLen, i, NodeSrcLen, MinLen, p: integer;
var
AnIdentLen, i, NodeSrcLen, MinLen: integer;
p: PChar;
begin
{$IFDEF CheckNodeTool}CheckNodeTool(ANode);{$ENDIF}
if (ANode.StartPos<=SrcLen) and (ANode.EndPos<=SrcLen+1)
@ -609,11 +613,11 @@ begin
else
MinLen:=NodeSrcLen;
i:=1;
p:=ANode.StartPos-1+i;
while (i<=MinLen) and (IsIdentChar[Src[p]]) do begin
if AnUpperIdent[i]<>UpperSrc[p] then begin
p:=@Src[ANode.StartPos];
while (i<=MinLen) and (IsIdentChar[p^]) do begin
if AnUpperIdent[i]<>UpChars[p^] then begin
// identifiers different in one letter
if UpperSrc[p]>AnUpperIdent[i] then
if UpChars[p^]>AnUpperIdent[i] then
Result:=-1
else
Result:=1;
@ -624,7 +628,7 @@ begin
end;
if (i>MinLen) and (i>AnIdentLen) then begin
// node is longer than AnUpperIdent
if (i>NodeSrcLen) or (not IsIdentChar[Src[p]]) then
if (i>NodeSrcLen) or (not IsIdentChar[p^]) then
// node identifier is equal to AnUpperIdent
Result:=0
else
@ -639,19 +643,24 @@ end;
function TCustomCodeTool.CompareSrcIdentifiers(
CleanStartPos1, CleanStartPos2: integer): boolean;
var
p1: PChar;
p2: PChar;
begin
Result:=(CleanStartPos1>=1) and (CleanStartPos1<=SrcLen)
and (CleanStartPos2>=1) and (CleanStartPos2<=SrcLen);
if not Result then exit;
while (CleanStartPos1<=SrcLen) and (IsIdentChar[Src[CleanStartPos1]]) do begin
if (UpperSrc[CleanStartPos1]<>UpperSrc[CleanStartPos2]) then begin
Result:=false;
exit;
end;
if (CleanStartPos1<1) or (CleanStartPos1>SrcLen)
or (CleanStartPos2<1) or (CleanStartPos2>SrcLen)
then
exit(false);
p1:=@Src[CleanStartPos1];
p2:=@Src[CleanStartPos2];
while (CleanStartPos1<=SrcLen) and IsIdentChar[p1^] do begin
if (UpChars[p1^]<>UpChars[p2^]) then
exit(false);
inc(CleanStartPos1);
inc(CleanStartPos2);
inc(p1);
inc(p2);
end;
Result:=(CleanStartPos2>SrcLen) or (not IsIdentChar[Src[CleanStartPos2]]);
Result:=(not IsIdentChar[p2^]);
end;
function TCustomCodeTool.AtomIsChar(const c: char): boolean;
@ -664,8 +673,8 @@ end;
function TCustomCodeTool.AtomIsKeyWord: boolean;
begin
Result:=(CurPos.StartPos<=SrcLen)
and (IsIdentStartChar[UpperSrc[CurPos.StartPos]])
and (WordIsKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
and (IsIdentStartChar[Src[CurPos.StartPos]])
and (WordIsKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos));
end;
@ -677,29 +686,16 @@ function TCustomCodeTool.AtomIsIdentifier(ExceptionOnNotFound: boolean):boolean;
end;
begin
if CurPos.StartPos<=SrcLen then begin
if IsIdentStartChar[UpperSrc[CurPos.StartPos]] then begin
if not WordIsKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
Result:=true
else begin
if ExceptionOnNotFound then
RaiseIdentExpectedButAtomFound
else
Result:=false;
end;
end else begin
if ExceptionOnNotFound then
RaiseIdentExpectedButAtomFound
else
Result:=false;
end;
end else begin
if ExceptionOnNotFound then
RaiseIdentExpectedButEOFFound
else
Result:=false;
end;
if (CurPos.StartPos<=SrcLen)
and IsIdentStartChar[Src[CurPos.StartPos]]
and not WordIsKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
exit(true);
if ExceptionOnNotFound then
RaiseIdentExpectedButAtomFound
else
Result:=false;
end;
function TCustomCodeTool.AtomIsNumber: boolean;
@ -807,21 +803,20 @@ function TCustomCodeTool.LastUpAtomIs(BackIndex: integer;
var ap: TAtomPosition;
AnAtomLen: integer;
i: integer;
p: PChar;
begin
Result:=false;
if (BackIndex>=0) and (BackIndex<LastAtoms.Count) then begin
ap:=LastAtoms.GetValueAt(BackIndex);
Result:=false;
if (ap.StartPos<SrcLen) and (ap.EndPos<=SrcLen+1)
and (ap.StartPos>=1) then begin
AnAtomLen:=length(AnAtom);
if AnAtomLen=ap.EndPos-ap.StartPos then begin
for i:=1 to AnAtomLen do
if AnAtom[i]<>UpperSrc[ap.StartPos-1+i] then exit;
Result:=true;
end;
end;
if (BackIndex<0) or (BackIndex>=LastAtoms.Count) then exit;
ap:=LastAtoms.GetValueAt(BackIndex);
AnAtomLen:=length(AnAtom);
if AnAtomLen<>ap.EndPos-ap.StartPos then exit;
if (ap.StartPos>SrcLen) or (ap.EndPos>SrcLen+1) or (ap.StartPos<1) then exit;
p:=@Src[ap.StartPos];
for i:=1 to AnAtomLen do begin
if AnAtom[i]<>UpChars[p^] then exit;
inc(p);
end;
Result:=true;
end;
function TCustomCodeTool.GetAtom: string;
@ -831,7 +826,7 @@ end;
function TCustomCodeTool.GetUpAtom: string;
begin
Result:=copy(UpperSrc,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
Result:=UpperCaseStr(copy(Src,CurPos.StartPos,CurPos.EndPos-CurPos.StartPos));
end;
function TCustomCodeTool.GetAtom(const Atom: TAtomPosition): string;
@ -841,23 +836,26 @@ end;
function TCustomCodeTool.GetUpAtom(const Atom: TAtomPosition): string;
begin
Result:=copy(UpperSrc,Atom.StartPos,Atom.EndPos-Atom.StartPos);
Result:=UpperCaseStr(copy(Src,Atom.StartPos,Atom.EndPos-Atom.StartPos));
end;
function TCustomCodeTool.FreeUpAtomIs(const FreeAtomPos: TAtomPosition;
const AnAtom: shortstring): boolean;
var AnAtomLen,i : integer;
p: PChar;
begin
Result:=false;
if (FreeAtomPos.StartPos<SrcLen) and (FreeAtomPos.EndPos<=SrcLen+1)
and (FreeAtomPos.StartPos>=1) then begin
AnAtomLen:=length(AnAtom);
if AnAtomLen=FreeAtomPos.EndPos-FreeAtomPos.StartPos then begin
for i:=1 to AnAtomLen do
if AnAtom[i]<>UpperSrc[FreeAtomPos.StartPos-1+i] then exit;
Result:=true;
end;
if (FreeAtomPos.StartPos>SrcLen) or (FreeAtomPos.EndPos>SrcLen+1)
or (FreeAtomPos.StartPos<1) then
exit;
AnAtomLen:=length(AnAtom);
if AnAtomLen<>FreeAtomPos.EndPos-FreeAtomPos.StartPos then exit;
p:=@Src[FreeAtomPos.StartPos];
for i:=1 to AnAtomLen do begin
if AnAtom[i]<>UpChars[p^] then exit;
inc(p);
end;
Result:=true;
end;
procedure TCustomCodeTool.ReadNextAtom;
@ -959,28 +957,28 @@ begin
end;
CurPos.EndPos:=CurPos.StartPos;
// read atom
c1:=UpperSrc[CurPos.EndPos];
c1:=Src[CurPos.EndPos];
case c1 of
#0: ;
'_','A'..'Z':
'_','A'..'Z','a'..'z':
begin
inc(CurPos.EndPos);
while (IsIdentChar[UpperSrc[CurPos.EndPos]]) do
while (IsIdentChar[Src[CurPos.EndPos]]) do
inc(CurPos.EndPos);
CurPos.Flag:=cafWord;
case c1 of
'B':
'b','B':
if (CurPos.EndPos-CurPos.StartPos=5)
and UpAtomIs('BEGIN')
then
CurPos.Flag:=cafBegin;
'E':
'e','E':
if (CurPos.EndPos-CurPos.StartPos=3)
and (UpperSrc[CurPos.StartPos+1]='N')
and (UpperSrc[CurPos.StartPos+2]='D')
and (Src[CurPos.StartPos+1] in ['n','N'])
and (Src[CurPos.StartPos+2] in ['d','D'])
then
CurPos.Flag:=cafEnd;
'R':
'r','R':
if (CurPos.EndPos-CurPos.StartPos=6)
and UpAtomIs('RECORD')
then
@ -1050,7 +1048,7 @@ begin
do
inc(CurPos.EndPos);
end;
if (CurPos.EndPos<=SrcLen) and (UpperSrc[CurPos.EndPos]='E') then
if (CurPos.EndPos<=SrcLen) and (Src[CurPos.EndPos] in ['e','E']) then
begin
// read exponent
inc(CurPos.EndPos);
@ -1071,7 +1069,7 @@ begin
begin
inc(CurPos.EndPos);
while (CurPos.EndPos<=SrcLen)
and (IsHexNumberChar[UpperSrc[CurPos.EndPos]]) do
and (IsHexNumberChar[Src[CurPos.EndPos]]) do
inc(CurPos.EndPos);
end;
';':
@ -1172,7 +1170,7 @@ var
var PrePos: integer;
begin
while (CurPos.StartPos>1) do begin
case UpperSrc[CurPos.StartPos-1] of
case Src[CurPos.StartPos-1] of
'''':
begin
dec(CurPos.StartPos);
@ -1180,7 +1178,7 @@ var
dec(CurPos.StartPos);
until (CurPos.StartPos<1) or (Src[CurPos.StartPos]='''');
end;
'0'..'9','A'..'Z':
'0'..'9','A'..'Z','a'..'z':
begin
// test if char constant
PrePos:=CurPos.StartPos-1;
@ -1364,13 +1362,13 @@ begin
end;
exit;
end;
c2:=UpperSrc[CurPos.StartPos];
c2:=Src[CurPos.StartPos];
case c2 of
'_','A'..'Z':
'_','A'..'Z','a'..'z':
begin
// identifier or keyword or hexnumber
while (CurPos.StartPos>1) do begin
if (IsIdentChar[UpperSrc[CurPos.StartPos-1]]) then
if (IsIdentChar[Src[CurPos.StartPos-1]]) then
dec(CurPos.StartPos)
else begin
case Src[CurPos.StartPos-1] of
@ -1383,7 +1381,7 @@ begin
// hex number
dec(CurPos.StartPos);
else
WordToAtomFlag.DoItUpperCase(UpperSrc,CurPos.StartPos,
WordToAtomFlag.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
CurPos.Flag:=WordToAtomFlag.Flag;
if CurPos.Flag=cafNone then
@ -1404,7 +1402,7 @@ begin
// a binary number, a char constant, a float, a float with exponent
ForbiddenNumberTypes:=[];
while true do begin
case UpperSrc[CurPos.StartPos] of
case UpChars[Src[CurPos.StartPos]] of
'0'..'1':
;
'2'..'9':
@ -1434,8 +1432,9 @@ begin
begin
// could be part of an exponent
if (ntFloatWithExponent in ForbiddenNumberTypes)
or (CurPos.StartPos<=1) or (UpperSrc[CurPos.StartPos-1]<>'E') then
begin
or (CurPos.StartPos<=1)
or (not (Src[CurPos.StartPos-1] in ['e','E']))
then begin
inc(CurPos.StartPos);
break;
end;
@ -1490,7 +1489,7 @@ begin
end;
if IsIdentStartChar[Src[CurPos.StartPos]] then begin
// it is an identifier
WordToAtomFlag.DoItUpperCase(UpperSrc,CurPos.StartPos,
WordToAtomFlag.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
CurPos.Flag:=WordToAtomFlag.Flag;
if CurPos.Flag=cafNone then
@ -1706,7 +1705,6 @@ begin
ClearLastError;
FLastScannerChangeStep:=Scanner.ChangeStep;
Src:=Scanner.CleanedSrc;
UpperSrc:=UpperCaseStr(Src);
SrcLen:=length(Src);
{$IFDEF VerboseUpdateNeeded}
DebugLn(['TCustomCodeTool.BeginParsing FForceUpdateNeeded:=true ',MainFilename]);
@ -1977,7 +1975,7 @@ begin
if (CurPos.StartPos>SrcLen) or (CurPos.EndPos<=CurPos.StartPos) then
Result:=false
else if IsIdentStartChar[Src[CurPos.StartPos]] then
Result:=KeyWordFuncList.DoItUppercase(UpperSrc,CurPos.StartPos,
Result:=KeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
else
Result:=true;
@ -2473,7 +2471,7 @@ begin
if (AnIdentifier=nil) or (CleanStartPos<1) or (CleanStartPos>SrcLen) then
exit;
while IsIdentChar[AnIdentifier^] do begin
if (UpChars[AnIdentifier^]=UpperSrc[CleanStartPos]) then begin
if (UpChars[AnIdentifier^]=UpChars[Src[CleanStartPos]]) then begin
inc(AnIdentifier);
inc(CleanStartPos);
if CleanStartPos>SrcLen then begin
@ -2483,7 +2481,7 @@ begin
end else
exit(false);
end;
Result:=not IsIdentChar[UpperSrc[CleanStartPos]];
Result:=not IsIdentChar[Src[CleanStartPos]];
end;
function TCustomCodeTool.CompareSrcIdentifiersMethod(Identifier1,
@ -2617,7 +2615,6 @@ begin
Src:='';
if (GapStart>0) then begin
GapSrc:=copy(Src,GapStart,GapEnd-GapStart);
GapUpperSrc:=UpperCaseStr(GapSrc);
{$IFDEF ShowDirtySrc}
DebugLn('TDirtySource.SetGap Owner=',ExtractFilename(Owner.MainFilename),
' Code=',ExtractFilename(Code.Filename),
@ -2628,7 +2625,6 @@ begin
{$ENDIF}
end else begin
GapSrc:='';
GapUpperSrc:='';
end;
end;

View File

@ -619,7 +619,7 @@ begin
end;
NameStart:=ProcHeadNode.StartPos;
NameEnd:=NameStart;
while (NameEnd<=SrcLen) and (IsIdentChar[UpperSrc[NameEnd]]) do
while (NameEnd<=SrcLen) and (IsIdentChar[Src[NameEnd]]) do
inc(NameEnd);
if not SourceChangeCache.Replace(gtNone,gtNone,NameStart,NameEnd,
NewMethodName)

View File

@ -216,7 +216,7 @@ begin
or (CurPos.StartPos>CursorNode.EndPos) then
break;
//debugln('TExtractProcTool.InitExtractProc A "',GetAtom,'"');
if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
if WordIsBlockStatementStart.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
//debugln('TExtractProcTool.InitExtractProc WordIsBlockStatementStart "',GetAtom,'"');
@ -248,13 +248,13 @@ begin
end;
//debugln('TExtractProcTool.InitExtractProc Block ok');
end
else if WordIsBlockStatementEnd.DoItUpperCase(UpperSrc,
else if WordIsBlockStatementEnd.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// a block ended inside, that started outside
exit;
end
else if WordIsBlockStatementMiddle.DoItUpperCase(UpperSrc,
else if WordIsBlockStatementMiddle.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// a block ended inside, that started outside

View File

@ -2573,7 +2573,7 @@ var
begin
Result:=false;
if ContextNode.FirstChild=nil then exit;
//debugln('SearchInOnBlockDefinition B ',GetIdentifier(@UpperSrc[ContextNode.StartPos]));
//debugln('SearchInOnBlockDefinition B ',GetIdentifier(@Src[ContextNode.StartPos]));
if (fdfCollect in Params.Flags)
or CompareSrcIdentifiers(ContextNode.FirstChild.StartPos,Params.Identifier)
then begin
@ -5055,26 +5055,26 @@ begin
Params.Flags:=OldFlags;
exit;
end;
if not WordIsBinaryOperator.DoItUpperCase(UpperSrc,CurPos.StartPos,
if not WordIsBinaryOperator.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
RaiseBinaryOperatorNotFound;
// put operator on stack
ExprStack[StackPtr].theOperator:=CurPos;
// find operator precendence level
if WordIsLvl1Operator.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsLvl1Operator.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
ExprStack[StackPtr].OperatorLvl:=1
else if WordIsLvl2Operator.DoItUpperCase(UpperSrc,CurPos.StartPos,
else if WordIsLvl2Operator.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
ExprStack[StackPtr].OperatorLvl:=2
else if WordIsLvl3Operator.DoItUpperCase(UpperSrc,CurPos.StartPos,
else if WordIsLvl3Operator.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
ExprStack[StackPtr].OperatorLvl:=3
else if WordIsLvl4Operator.DoItUpperCase(UpperSrc,CurPos.StartPos,
else if WordIsLvl4Operator.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
ExprStack[StackPtr].OperatorLvl:=4
@ -6555,7 +6555,7 @@ begin
or (CurPos.Flag in [cafSemicolon,cafComma,cafEnd,
cafRoundBracketClose,cafEdgedBracketClose])
or (AtomIsKeyWord
and not IsKeyWordInConstAllowed.DoItUpperCase(UpperSrc,
and not IsKeyWordInConstAllowed.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))
then begin
break;
@ -6572,7 +6572,7 @@ function TFindDeclarationTool.ConvertNodeToExpressionType(Node: TCodeTreeNode;
procedure ConvertIdentifierAtCursor;
begin
if WordIsPredefinedIdentifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsPredefinedIdentifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
// predefined identifiers
@ -7570,15 +7570,15 @@ begin
Result:=vatSpace
else if (CurPos.StartPos>SrcLen) then
Result:=vatNone
else if IsIdentStartChar[UpperSrc[CurPos.StartPos]] then begin
if WordIsPredefinedIdentifier.DoItUpperCase(UpperSrc,CurPos.StartPos,
else if IsIdentStartChar[Src[CurPos.StartPos]] then begin
if WordIsPredefinedIdentifier.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
Result:=vatPreDefIdentifier
else if UpAtomIs('INHERITED') then
Result:=vatINHERITED
else if UpAtomIs('AS') then
Result:=vatAS
else if WordIsKeyWord.DoItUpperCase(UpperSrc,CurPos.StartPos,
else if WordIsKeyWord.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
Result:=vatKeyWord
else if UpAtomIs('PROPERTY') then begin

View File

@ -1387,7 +1387,7 @@ procedure TIdentCompletionTool.FindCollectionContext(
case ContextNode.Desc of
ctnProperty:
// check for special property keywords
if WordIsPropertySpecifier.DoItUpperCase(UpperSrc,
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
// do not resolve property specifiers
@ -1712,7 +1712,7 @@ begin
or UpAtomIs('DO')
or UpAtomIs('TO')
or UpAtomIs('OF')
or WordIsBinaryOperator.DoItUppercase(UpperSrc,
or WordIsBinaryOperator.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
then begin
// do not add semicolon
@ -1728,7 +1728,7 @@ begin
then begin
// check if a semicolon is needed at the end
if (CurPos.Flag in [cafEnd,cafBegin])
or WordIsBlockKeyWord.DoItUpperCase(UpperSrc,
or WordIsBlockKeyWord.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
or ((CurPos.Flag=cafWord)
and (not PositionsInSameLine(Src,IdentEndPos,CurPos.StartPos)))

View File

@ -122,7 +122,7 @@ type
protected
// code extraction
procedure InitExtraction;
function GetExtraction: string;
function GetExtraction(InUpperCase: boolean): string;
function ExtractStreamEndIsIdentChar: boolean;
procedure ExtractNextAtom(AddAtom: boolean; Attr: TProcHeadAttributes);
// sections
@ -718,7 +718,7 @@ begin
MaxPos:=SrcLen;
repeat
ReadNextAtom;
if BlockStatementStartKeyWordFuncList.DoItUppercase(UpperSrc,CurPos.StartPos,
if BlockStatementStartKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
if not ReadTilBlockEnd(false,true) then RaiseEndOfSourceExpected;
@ -882,7 +882,7 @@ begin
if not UpAtomIs('OF') then
RaiseCharExpectedButAtomFound('[');
ReadNextAtom;
Result:=ClassVarTypeKeyWordFuncList.DoItUpperCase(UpperSrc,
Result:=ClassVarTypeKeyWordFuncList.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
end;
@ -1499,10 +1499,10 @@ begin
SaveRaiseException(ctsSemicolonNotFound);
repeat
if (pphIsMethod in ParseAttr) then
IsSpecifier:=IsKeyWordMethodSpecifier.DoItUppercase(UpperSrc,
IsSpecifier:=IsKeyWordMethodSpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
else
IsSpecifier:=IsKeyWordProcedureSpecifier.DoItUppercase(UpperSrc,
IsSpecifier:=IsKeyWordProcedureSpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos);
if IsSpecifier then begin
// read specifier
@ -1532,7 +1532,7 @@ begin
ReadNextAtom;
if not (CurPos.Flag in AllCommonAtomWords) then
RaiseStringExpectedButAtomFound(ctsKeyword);
if not IsKeyWordProcedureBracketSpecifier.DoItUppercase(UpperSrc,
if not IsKeyWordProcedureBracketSpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseKeyWordExampleExpected;
@ -1612,7 +1612,7 @@ begin
Result:=false;
if CurPos.Flag in AllCommonAtomWords then begin
// word (identifier or keyword)
if AtomIsKeyWord and (not IsKeyWordInConstAllowed.DoItUppercase(UpperSrc,
if AtomIsKeyWord and (not IsKeyWordInConstAllowed.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)) then begin
if ExceptionOnError then
RaiseUnexpectedKeyWord
@ -1625,7 +1625,7 @@ begin
Result:=ReadConstant(ExceptionOnError,Extract,Attr);
exit;
end;
if WordIsTermOperator.DoItUpperCase(UpperSrc,
if WordIsTermOperator.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// identifier + operator + ?
@ -1653,7 +1653,7 @@ begin
end else if AtomIsNumber or AtomIsStringConstant then begin
// number or '...' or #...
if not Extract then ReadNextAtom else ExtractNextAtom(true,Attr);
if WordIsTermOperator.DoItUpperCase(UpperSrc,
if WordIsTermOperator.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// number + operator + ?
@ -1675,7 +1675,7 @@ begin
RaiseCharExpectedButAtomFound(')')
else exit;
if not Extract then ReadNextAtom else ExtractNextAtom(true,Attr);
if WordIsTermOperator.DoItUpperCase(UpperSrc,
if WordIsTermOperator.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// open bracket + ? + close bracket + operator + ?
@ -1702,7 +1702,7 @@ begin
end;
until false;
if not Extract then ReadNextAtom else ExtractNextAtom(true,Attr);
if WordIsTermOperator.DoItUpperCase(UpperSrc,
if WordIsTermOperator.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then begin
// open bracket + ? + close bracket + operator + ?
@ -1933,7 +1933,7 @@ begin
//DebugLn('[TPascalParserTool.DoAtom] A ',DbgS(CurKeyWordFuncList));
if (CurPos.StartPos<=SrcLen) and (CurPos.EndPos>CurPos.StartPos) then begin
if IsIdentStartChar[Src[CurPos.StartPos]] then
Result:=CurKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=CurKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
else begin
if Src[CurPos.StartPos] in ['(','['] then
@ -1995,7 +1995,7 @@ begin
CreateChildNode;
CurNode.Desc:=ctnFinalization;
CurSection:=CurNode.Desc;
end else if EndKeyWordFuncList.DoItUppercase(UpperSrc,CurPos.StartPos,
end else if EndKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
ReadTilBlockEnd(false,false);
@ -2226,7 +2226,7 @@ begin
UndoReadNextAtom;
break;
end;
end else if EndKeyWordFuncList.DoItUppercase(UpperSrc,CurPos.StartPos,
end else if EndKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
or UpAtomIs('REPEAT') then
begin
@ -2261,13 +2261,13 @@ begin
case BlockType of
ebtBegin,ebtTry,ebtCase,ebtRepeat:
if UnexpectedKeyWordInBeginBlock.DoItUppercase(UpperSrc,
if UnexpectedKeyWordInBeginBlock.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseUnexpectedKeyWordInBeginEndBlock;
ebtAsm:
if UnexpectedKeyWordInAsmBlock.DoItUppercase(UpperSrc,
if UnexpectedKeyWordInAsmBlock.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
RaiseUnexpectedKeyWordInBeginEndBlock;
@ -2282,7 +2282,7 @@ function TPascalParserTool.ReadTilBlockStatementEnd(
begin
if CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen] then
Result:=ReadTilBracketClose(ExceptionOnNotFound)
else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
else if WordIsBlockStatementStart.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
then
Result:=ReadTilBlockEnd(false,false)
@ -2331,7 +2331,7 @@ begin
ReadPriorAtom;
if (CurPos.StartPos<1) then begin
SaveRaiseExceptionFmt(ctsWordNotFound,['begin']);
end else if WordIsBlockKeyWord.DoItUpperCase(UpperSrc,CurPos.StartPos,
end else if WordIsBlockKeyWord.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
if (CurPos.Flag=cafEND) or (UpAtomIs('UNTIL')) then begin
@ -2369,7 +2369,7 @@ begin
OldAtom:=CurPos;
repeat
ReadPriorAtom;
if WordIsBlockKeyWord.DoItUpperCase(UpperSrc,CurPos.StartPos,
if WordIsBlockKeyWord.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
if UpAtomIs('CASE') then begin
@ -2455,7 +2455,7 @@ function TPascalParserTool.ReadTilStatementEnd(ExceptionOnError,
begin
Result:=true;
repeat
if BlockStatementStartKeyWordFuncList.DoItUppercase(UpperSrc,CurPos.StartPos,
if BlockStatementStartKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos) then
begin
if not ReadTilBlockEnd(false,CreateNodes) then exit(false);
@ -2634,7 +2634,7 @@ procedure TPascalParserTool.ReadVariableType;
// creates nodes for variable type
begin
ReadNextAtom;
TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
if UpAtomIs('ABSOLUTE') then begin
ReadNextAtom;
@ -2647,7 +2647,7 @@ begin
if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then
ReadTilBracketClose(true);
if (CurPos.Flag in AllCommonAtomWords)
and (not IsKeyWordInConstAllowed.DoItUppercase(UpperSrc,
and (not IsKeyWordInConstAllowed.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))
and AtomIsKeyWord
then
@ -2957,7 +2957,7 @@ begin
if (CurPos.Flag=cafColon) then begin
// read type
ReadNextAtom;
TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
end;
if (CurPos.Flag<>cafEqual) then
@ -2970,7 +2970,7 @@ begin
if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then
ReadTilBracketClose(true);
if (CurPos.Flag in AllCommonAtomWords)
and (not IsKeyWordInConstAllowed.DoItUppercase(UpperSrc,
and (not IsKeyWordInConstAllowed.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))
and AtomIsKeyWord then
RaiseStringExpectedButAtomFound('constant');
@ -3165,7 +3165,7 @@ begin
RaiseCharExpectedButAtomFound('=');
// read type
ReadNextAtom;
TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
// read ;
if CurPos.Flag<>cafSemicolon then
@ -3175,22 +3175,22 @@ end;
function TPascalParserTool.KeyWordFuncTypePacked: boolean;
begin
ReadNextAtom;
if not PackedTypesKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
if not PackedTypesKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
RaiseStringExpectedButAtomFound('"record"');
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
end;
function TPascalParserTool.KeyWordFuncTypeBitPacked: boolean;
begin
ReadNextAtom;
if not BitPackedTypesKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
if not BitPackedTypesKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos)
then
RaiseStringExpectedButAtomFound('"array"');
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
end;
@ -3437,7 +3437,7 @@ begin
if not UpAtomIs('OF') then
RaiseStringExpectedButAtomFound('"of"');
ReadNextAtom;
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
CurNode.EndPos:=CurPos.StartPos;
EndChildNode;
@ -3499,7 +3499,7 @@ begin
if not EqualFound then begin
// read modifiers
repeat
if (not IsKeyWordProcedureTypeSpecifier.DoItUpperCase(UpperSrc,
if (not IsKeyWordProcedureTypeSpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)) then
begin
UndoReadNextAtom;
@ -3511,7 +3511,7 @@ begin
break;
end;
// delphi/fpc allow proc modifiers without semicolons
if not IsKeyWordProcedureTypeSpecifier.DoItUpperCase(UpperSrc,
if not IsKeyWordProcedureTypeSpecifier.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin
RaiseCharExpectedButAtomFound(';');
@ -3567,7 +3567,7 @@ begin
CreateChildNode;
CurNode.Desc:=ctnTypeType;
ReadNextAtom;
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
CurNode.EndPos:=CurPos.EndPos;
EndChildNode;
@ -3580,7 +3580,7 @@ begin
CurNode.Desc:=ctnFileType;
if ReadNextUpAtomIs('OF') then begin
ReadNextAtom;
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
if not Result then exit;
end;
@ -3595,7 +3595,7 @@ begin
CreateChildNode;
CurNode.Desc:=ctnPointerType;
ReadNextAtom;
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
CurNode.EndPos:=CurPos.EndPos;
EndChildNode;
@ -3621,7 +3621,7 @@ var SubRangeOperatorFound: boolean;
if (CurPos.Flag in [cafSemicolon,cafColon,cafRoundBracketClose,
cafEqual,cafEdgedBracketClose])
or (AtomIsKeyWord
and (not IsKeyWordInConstAllowed.DoItUpperCase(UpperSrc,
and (not IsKeyWordInConstAllowed.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)))
then
break;
@ -3761,7 +3761,7 @@ begin
ReadNextAtom; // read next variable name
until false;
ReadNextAtom;
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
if not Result then exit;
CurNode.EndPos:=CurPos.EndPos;
@ -3838,7 +3838,7 @@ begin
ReadNextAtom; // read next variable name
until false;
ReadNextAtom; // read type
Result:=TypeKeyWordFuncList.DoItUpperCase(UpperSrc,CurPos.StartPos,
Result:=TypeKeyWordFuncList.DoItCaseInsensitive(Src,CurPos.StartPos,
CurPos.EndPos-CurPos.StartPos);
if not Result then exit;
CurNode.EndPos:=CurPos.EndPos;
@ -3898,12 +3898,14 @@ begin
ExtractMemStream.Position:=0;
end;
function TPascalParserTool.GetExtraction: string;
function TPascalParserTool.GetExtraction(InUpperCase: boolean): string;
begin
SetLength(Result,ExtractMemStream.Position);
ExtractMemStream.Position:=0;
if Result<>'' then
ExtractMemStream.Read(Result[1],length(Result));
if InUpperCase then
Result:=UpperCaseStr(Result);
end;
function TPascalParserTool.ExtractStreamEndIsIdentChar: boolean;
@ -3933,12 +3935,7 @@ begin
LastAtomEndPos:=LastAtoms.GetValueAt(0).EndPos;
if phpWithComments in Attr then begin
// add space/comment between pascal atoms
if phpInUpperCase in Attr then
ExtractMemStream.Write(UpperSrc[LastAtomEndPos],
CurPos.StartPos-LastAtomEndPos)
else
ExtractMemStream.Write(Src[LastAtomEndPos],
CurPos.StartPos-LastAtomEndPos);
ExtractMemStream.Write(Src[LastAtomEndPos],CurPos.StartPos-LastAtomEndPos);
end else if (ExtractMemStream.Position>0) then
begin
// some space/comments were skipped
@ -3954,12 +3951,7 @@ begin
end;
end;
if AddAtom then begin
if phpInUpperCase in Attr then
ExtractMemStream.Write(UpperSrc[CurPos.StartPos],
CurPos.EndPos-CurPos.StartPos)
else
ExtractMemStream.Write(Src[CurPos.StartPos],
CurPos.EndPos-CurPos.StartPos);
ExtractMemStream.Write(Src[CurPos.StartPos],CurPos.EndPos-CurPos.StartPos);
end;
if (ExtractSearchPos>0)
and (ExtractSearchPos<=ExtractMemStream.Position)

View File

@ -472,7 +472,7 @@ begin
end;
// copy memorystream to Result string
Result:=GetExtraction;
Result:=GetExtraction(phpInUpperCase in Attr);
// add semicolon
if ([phpWithoutSemicolon,phpDoNotAddSemicolon]*Attr=[])
@ -508,7 +508,7 @@ begin
end;
if InUpperCase then
Result:=GetIdentifier(@UpperSrc[DefNode.StartPos])
Result:=UpperCaseStr(GetIdentifier(@Src[DefNode.StartPos]))
else
Result:=GetIdentifier(@Src[DefNode.StartPos]);
end else
@ -538,7 +538,7 @@ begin
if not AtomIsChar(',') then break;
end;
// copy memorystream to Result string
Result:=GetExtraction;
Result:=GetExtraction(phpInUpperCase in Attr);
end;
function TPascalReaderTool.ExtractClassNameOfProcNode(ProcNode: TCodeTreeNode
@ -918,7 +918,7 @@ begin
and (CurPos.StartPos<=SrcLen) do
ExtractNextAtom(true,Attr);
// copy memorystream to Result string
Result:=GetExtraction;
Result:=GetExtraction(phpInUpperCase in Attr);
end;
function TPascalReaderTool.ExtractCode(StartPos, EndPos: integer;
@ -934,7 +934,7 @@ begin
and (CurPos.StartPos<=SrcLen) do
ExtractNextAtom(true,Attr);
// copy memorystream to Result string
Result:=GetExtraction;
Result:=GetExtraction(phpInUpperCase in Attr);
end;
function TPascalReaderTool.ExtractPropName(PropNode: TCodeTreeNode;
@ -987,7 +987,7 @@ begin
end;
// copy memorystream to Result string
Result:=GetExtraction;
Result:=GetExtraction(phpInUpperCase in Attr);
end;
function TPascalReaderTool.GetPropertyNameIdentifier(PropNode: TCodeTreeNode

View File

@ -68,7 +68,6 @@ procedure TResourceCodeTool.SetSource(ACode: TCodeBuffer);
begin
ClearLastError;
Src:=ACode.Source;
UpperSrc:=UpperCaseStr(Src);
SrcLen:=length(Src);
CurPos:=StartAtomPosition;
LastAtoms.Clear;

View File

@ -104,7 +104,7 @@ type
CurPos, AtomStart, AtomEnd, SrcLen, CurIndent, HiddenIndent: integer;
CommentLvl: integer;
CommentStartPos: array of integer;
Src, UpperSrc: string;
Src: string;
procedure AddAtom(var CurCode: string; NewAtom: string);
procedure ReadNextAtom;
procedure ReadTilDirectiveEnd;
@ -1092,15 +1092,15 @@ var c1, c2: char;
begin
AtomStart:=CurPos;
if AtomStart<=SrcLen then begin
c1:=UpperSrc[CurPos];
c1:=Src[CurPos];
case c1 of
'A'..'Z','_': // identifier
'a'..'z','A'..'Z','_': // identifier
begin
CurAtomType:=atIdentifier;
repeat
inc(CurPos);
until (CurPos>SrcLen) or (not IsIdentChar[Src[CurPos]]);
if WordIsKeyWord.DoItUpperCase(UpperSrc,AtomStart,CurPos-AtomStart)
if WordIsKeyWord.DoItCaseInsensitive(Src,AtomStart,CurPos-AtomStart)
then
CurAtomType:=atKeyword;
end;
@ -1134,7 +1134,7 @@ begin
while (CurPos<=SrcLen) and (IsNumberChar[Src[CurPos]])
do
inc(CurPos);
if (CurPos<=SrcLen) and (UpperSrc[CurPos]='E')
if (CurPos<=SrcLen) and (Src[CurPos] in ['e','E'])
then begin
// read exponent
inc(CurPos);
@ -1372,7 +1372,6 @@ begin
Indent:=0;
// init
Src:=AStatement;
UpperSrc:=UpperCaseStr(Src);
SrcLen:=length(Src);
if IndentSize>=LineLength-10 then IndentSize:=LineLength-10;
CurIndent:=IndentSize;

View File

@ -3718,6 +3718,7 @@ function TStandardCodeTool.ConvertDelphiToLazarusSource(AddLRSCode: boolean;
ParamPos: Integer;
ACleanPos: Integer;
StartPos: Integer;
s: String;
begin
Result:=false;
// find $R directive
@ -3726,9 +3727,9 @@ function TStandardCodeTool.ConvertDelphiToLazarusSource(AddLRSCode: boolean;
ACleanPos:=FindNextCompilerDirectiveWithName(Src,ACleanPos,'R',
Scanner.NestedComments,ParamPos);
if (ACleanPos<1) or (ACleanPos>SrcLen) or (ParamPos>SrcLen) then break;
s:=UpperCaseStr(copy(Src,ParamPos,6));
if (Src[ACleanPos]='{')
and ((copy(UpperSrc,ParamPos,6)='*.DFM}')
or (copy(UpperSrc,ParamPos,6)='*.XFM}'))
and ((s='*.DFM}') or (s='*.XFM}'))
then begin
StartPos:=FindLineEndOrCodeInFrontOfPosition(ACleanPos,true);
if not SourceChangeCache.Replace(gtNone,gtNone,StartPos,ParamPos+6,'')
@ -4925,7 +4926,7 @@ begin
// jump backward to matching bracket
if not ReadBackwardTilAnyBracketClose then exit;
end
else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
else if WordIsBlockStatementStart.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin
// block start found
@ -5024,7 +5025,7 @@ begin
// jump backward to matching bracket
if not ReadBackwardTilAnyBracketClose then exit;
end
else if WordIsBlockStatementStart.DoItUpperCase(UpperSrc,
else if WordIsBlockStatementStart.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin
// block start found
@ -5494,7 +5495,7 @@ begin
BlockStart:=-1;
// read til this block is closed
while (CurPos.StartPos<=SrcLen) do begin
if BlockKeywordFuncList.DoItUppercase(UpperSrc,
if BlockKeywordFuncList.DoItCaseInsensitive(Src,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) then
begin
for CurBlockWord:=Low(TBlockKeyword) to High(TBlockKeyword) do