mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-05 21:34:11 +02:00
codetools: parsing member type without semicolon
git-svn-id: trunk@29364 -
This commit is contained in:
parent
b23421ec3e
commit
bec76993b1
@ -3035,55 +3035,60 @@ begin
|
|||||||
end;
|
end;
|
||||||
if UpAtomIs('DEPRECATED') then
|
if UpAtomIs('DEPRECATED') then
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
// read ;
|
if CurPos.Flag=cafSemicolon then begin
|
||||||
if CurPos.Flag<>cafSemicolon then
|
// read ;
|
||||||
RaiseCharExpectedButAtomFound(';');
|
|
||||||
ReadNextAtom;
|
|
||||||
if UpAtomIs('CVAR') then begin
|
|
||||||
// for example: 'var a: char; cvar;'
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if CurPos.Flag<>cafSemicolon then
|
if UpAtomIs('CVAR') then begin
|
||||||
RaiseCharExpectedButAtomFound(';');
|
// for example: 'var a: char; cvar;'
|
||||||
ReadNextAtom;
|
|
||||||
end;
|
|
||||||
if UpAtomIs('STATIC') and (CurNode.Parent<>nil)
|
|
||||||
and (CurNode.Parent.Desc in AllClassSections) then begin
|
|
||||||
// 'static' is allowed for class variables
|
|
||||||
// for example: 'a: char; static;'
|
|
||||||
ReadNextAtom;
|
|
||||||
if CurPos.Flag<>cafSemicolon then
|
|
||||||
RaiseCharExpectedButAtomFound(';');
|
|
||||||
ReadNextAtom;
|
|
||||||
end;
|
|
||||||
if (CurNode.Parent.Desc=ctnVarSection)
|
|
||||||
and (UpAtomIs('PUBLIC') or UpAtomIs('EXPORT') or UpAtomIs('EXTERNAL')) then
|
|
||||||
begin
|
|
||||||
// examples:
|
|
||||||
// a: b; public;
|
|
||||||
// a: b; external;
|
|
||||||
// a: b; external c;
|
|
||||||
// a: b; external name 'c';
|
|
||||||
// a: b; external 'library' name 'c';
|
|
||||||
if UpAtomIs('EXTERNAL') then begin
|
|
||||||
// read external identifier
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if (CurPos.Flag<>cafSemicolon) and (not UpAtomIs('NAME')) then
|
if CurPos.Flag<>cafSemicolon then
|
||||||
ReadConstant(true,false,[]); // library name
|
RaiseCharExpectedButAtomFound(';');
|
||||||
end else
|
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
if UpAtomIs('NAME') then begin
|
|
||||||
// for example 'var a: char; public name 'b' ;'
|
|
||||||
// for example 'var a: char; public name test;'
|
|
||||||
ReadNextAtom;
|
|
||||||
if (not AtomIsStringConstant)
|
|
||||||
and (not AtomIsIdentifier(false)) then
|
|
||||||
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
|
||||||
ReadConstant(true,false,[]);
|
|
||||||
end;
|
end;
|
||||||
if CurPos.Flag<>cafSemicolon then
|
if UpAtomIs('STATIC') and (CurNode.Parent<>nil)
|
||||||
RaiseCharExpectedButAtomFound(';');
|
and (CurNode.Parent.Desc in AllClassSections) then begin
|
||||||
end else
|
// 'static' is allowed for class variables
|
||||||
|
// for example: 'a: char; static;'
|
||||||
|
ReadNextAtom;
|
||||||
|
if CurPos.Flag<>cafSemicolon then
|
||||||
|
RaiseCharExpectedButAtomFound(';');
|
||||||
|
ReadNextAtom;
|
||||||
|
end;
|
||||||
|
if (CurNode.Parent.Desc=ctnVarSection)
|
||||||
|
and (UpAtomIs('PUBLIC') or UpAtomIs('EXPORT') or UpAtomIs('EXTERNAL')) then
|
||||||
|
begin
|
||||||
|
// examples:
|
||||||
|
// a: b; public;
|
||||||
|
// a: b; external;
|
||||||
|
// a: b; external c;
|
||||||
|
// a: b; external name 'c';
|
||||||
|
// a: b; external 'library' name 'c';
|
||||||
|
if UpAtomIs('EXTERNAL') then begin
|
||||||
|
// read external identifier
|
||||||
|
ReadNextAtom;
|
||||||
|
if (CurPos.Flag<>cafSemicolon) and (not UpAtomIs('NAME')) then
|
||||||
|
ReadConstant(true,false,[]); // library name
|
||||||
|
end else
|
||||||
|
ReadNextAtom;
|
||||||
|
if UpAtomIs('NAME') then begin
|
||||||
|
// for example 'var a: char; public name 'b' ;'
|
||||||
|
// for example 'var a: char; public name test;'
|
||||||
|
ReadNextAtom;
|
||||||
|
if (not AtomIsStringConstant)
|
||||||
|
and (not AtomIsIdentifier(false)) then
|
||||||
|
RaiseStringExpectedButAtomFound(ctsStringConstant);
|
||||||
|
ReadConstant(true,false,[]);
|
||||||
|
end;
|
||||||
|
if CurPos.Flag<>cafSemicolon then
|
||||||
|
RaiseCharExpectedButAtomFound(';');
|
||||||
|
end else
|
||||||
|
UndoReadNextAtom;
|
||||||
|
|
||||||
|
end else if CurPos.Flag=cafEND then begin
|
||||||
UndoReadNextAtom;
|
UndoReadNextAtom;
|
||||||
|
end else begin
|
||||||
|
RaiseCharExpectedButAtomFound(';');
|
||||||
|
end;
|
||||||
CurNode.EndPos:=CurPos.EndPos;
|
CurNode.EndPos:=CurPos.EndPos;
|
||||||
EndChildNode;
|
EndChildNode;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user