codetools: implemented parsing 1e-16, bug #8446

git-svn-id: trunk@15880 -
This commit is contained in:
mattias 2008-07-26 18:16:56 +00:00
parent 1bc45f97db
commit 60e3f56061
3 changed files with 42 additions and 37 deletions

View File

@ -1698,13 +1698,13 @@ begin
inc(Position); inc(Position);
while (Position<=Len) and (Source[Position] in ['0'..'9']) do while (Position<=Len) and (Source[Position] in ['0'..'9']) do
inc(Position); inc(Position);
if (Position<=Len) and (Source[Position] in ['e','E']) then begin end;
// read exponent if (Position<=Len) and (Source[Position] in ['e','E']) then begin
// read exponent
inc(Position);
if (Position<=Len) and (Source[Position]='-') then inc(Position);
while (Position<=Len) and (Source[Position] in ['0'..'9']) do
inc(Position); inc(Position);
if (Position<=Len) and (Source[Position]='-') then inc(Position);
while (Position<=Len) and (Source[Position] in ['0'..'9']) do
inc(Position);
end;
end; end;
end; end;
'''','#': // string constant '''','#': // string constant

View File

@ -1030,16 +1030,16 @@ begin
while (CurPos.EndPos<=SrcLen) and (IsNumberChar[Src[CurPos.EndPos]]) while (CurPos.EndPos<=SrcLen) and (IsNumberChar[Src[CurPos.EndPos]])
do do
inc(CurPos.EndPos); inc(CurPos.EndPos);
if (CurPos.EndPos<=SrcLen) and (UpperSrc[CurPos.EndPos]='E') then end;
begin if (CurPos.EndPos<=SrcLen) and (UpperSrc[CurPos.EndPos]='E') then
// read exponent begin
// read exponent
inc(CurPos.EndPos);
if (CurPos.EndPos<=SrcLen) and (Src[CurPos.EndPos] in ['-','+'])
then inc(CurPos.EndPos);
while (CurPos.EndPos<=SrcLen) and (IsNumberChar[Src[CurPos.EndPos]])
do
inc(CurPos.EndPos); inc(CurPos.EndPos);
if (CurPos.EndPos<=SrcLen) and (Src[CurPos.EndPos] in ['-','+'])
then inc(CurPos.EndPos);
while (CurPos.EndPos<=SrcLen) and (IsNumberChar[Src[CurPos.EndPos]])
do
inc(CurPos.EndPos);
end;
end; end;
end; end;
'%': '%':

View File

@ -1277,10 +1277,12 @@ var
copying: boolean; copying: boolean;
IsArrayType: Boolean; IsArrayType: Boolean;
IsFileType: Boolean; IsFileType: Boolean;
NeedIdentifier: boolean;
begin begin
copying:=[phpWithoutParamList,phpWithoutParamTypes]*Attr=[]; copying:=[phpWithoutParamList,phpWithoutParamTypes]*Attr=[];
Result:=false; Result:=false;
if CurPos.Flag in AllCommonAtomWords then begin if CurPos.Flag in AllCommonAtomWords then begin
NeedIdentifier:=true;
IsArrayType:=UpAtomIs('ARRAY'); IsArrayType:=UpAtomIs('ARRAY');
if IsArrayType then begin if IsArrayType then begin
if (phpCreateNodes in Attr) then begin if (phpCreateNodes in Attr) then begin
@ -1315,36 +1317,39 @@ begin
CurNode.Desc:=ctnFileType; CurNode.Desc:=ctnFileType;
end; end;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
if not UpAtomIs('OF') then if UpAtomIs('OF') then begin
if ExceptionOnError then if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr);
RaiseStringExpectedButAtomFound('"of"') end else begin
else exit; NeedIdentifier:=false;
if not Extract then ReadNextAtom else ExtractNextAtom(copying,Attr); end;
end; end;
if not AtomIsIdentifier(ExceptionOnError) then exit; if NeedIdentifier then begin
if (phpCreateNodes in Attr) then begin
CreateChildNode;
CurNode.Desc:=ctnIdentifier;
CurNode.EndPos:=CurPos.EndPos;
end;
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if CurPos.Flag=cafPoint then begin
// first identifier was unitname -> read '.' + identifier
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if not AtomIsIdentifier(ExceptionOnError) then exit; if not AtomIsIdentifier(ExceptionOnError) then exit;
if (phpCreateNodes in Attr) then begin
CreateChildNode;
CurNode.Desc:=ctnIdentifier;
CurNode.EndPos:=CurPos.EndPos;
end;
if not Extract then if not Extract then
ReadNextAtom ReadNextAtom
else else
ExtractNextAtom(copying,Attr); ExtractNextAtom(copying,Attr);
if CurPos.Flag=cafPoint then begin
// first identifier was unitname -> read '.' + identifier
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
if not AtomIsIdentifier(ExceptionOnError) then exit;
if not Extract then
ReadNextAtom
else
ExtractNextAtom(copying,Attr);
end;
if (phpCreateNodes in Attr) then
EndChildNode;
end; end;
if (phpCreateNodes in Attr) then begin if (phpCreateNodes in Attr) then begin
EndChildNode;
if IsFileType then if IsFileType then
EndChildNode; EndChildNode;
if IsArrayType then if IsArrayType then