+ Some cleanup, removed some keywords which are not keywords

This commit is contained in:
michael 2004-12-06 19:16:38 +00:00
parent aad1f7964a
commit 5d26556132
2 changed files with 29 additions and 47 deletions

View File

@ -864,7 +864,6 @@ begin
TypeName := CurTokenString;
ExpectToken(tkEqual);
NextToken;
// 12/04/04 - Dave - allow PACKED for ARRAYs, OBJECTs, CLASSes and RECORDs
HadPackedModifier := False; { Assume not present }
if CurToken = tkPacked then { If PACKED modifier }
begin { Handle PACKED modifier for all situations }
@ -874,7 +873,6 @@ begin
else { otherwise, syntax error }
ParseExc(Format(SParserExpectTokenError,['ARRAY, RECORD, OBJECT or CLASS']))
end;
// 12/04/04 - Dave - End of added code
case CurToken of
tkRecord:
begin
@ -888,30 +886,16 @@ begin
raise;
end;
end;
{ 12/04/04 - Dave - cannot happen. Handled above. Unnecessary code removed by commenting
tkPacked:
begin
Result := TPasRecordType(CreateElement(TPasRecordType, TypeName,
Parent));
try
TPasRecordType(Result).IsPacked := True;
ExpectToken(tkRecord);
ParseRecordDecl(TPasRecordType(Result));
except
Result.Free;
raise;
end;
end; End of removed code - Dave - 12/04/04 }
tkObject:
begin // 12/04/04 - Dave - Added
begin
Result := ParseClassDecl(Parent, TypeName, okObject);
TPasClassType(Result).IsPacked := HadPackedModifier; // 12/04/04 - Dave - Added
end; // 12/04/04 - Dave - Added
TPasClassType(Result).IsPacked := HadPackedModifier;
end;
tkClass:
begin // 12/04/04 - Dave - Added
begin
Result := ParseClassDecl(Parent, TypeName, okClass);
TPasClassType(Result).IsPacked := HadPackedModifier; // 12/04/04 - Dave - Added
end; // 12/04/04 - Dave - Added
TPasClassType(Result).IsPacked := HadPackedModifier;
end;
tkInterface:
Result := ParseClassDecl(Parent, TypeName, okInterface);
tkCaret:
@ -984,7 +968,7 @@ begin
Result := TPasArrayType(CreateElement(TPasArrayType, TypeName, Parent));
try
ParseArrayType(TPasArrayType(Result));
TPasArrayType(Result).IsPacked := HadPackedModifier; // 12/04/04 - Dave - Added
TPasArrayType(Result).IsPacked := HadPackedModifier;
ExpectToken(tkSemicolon);
except
Result.Free;
@ -1167,29 +1151,30 @@ begin
begin
NextToken;
if CurToken = tkIdentifier then
begin
begin
s := UpperCase(CurTokenText);
if s = 'CVAR' then
begin
begin
M := M + '; cvar';
ExpectToken(tkSemicolon);
end else if (s = 'EXTERNAL') or (s = 'PUBLIC') or (s = 'EXPORT') then
begin
end
else if (s = 'EXTERNAL') or (s = 'PUBLIC') or (s = 'EXPORT') then
begin
M := M + ';' + CurTokenText;
if s = 'EXTERNAL' then
begin
NextToken;
if (CurToken = tkString) or (CurToken = tkIdentifier) then
begin
NextToken;
if ((CurToken = tkString) or (CurToken = tkIdentifier)) and (UpperCase(CurTokenText)<> 'NAME') then
begin
// !!!: Is this really correct for tkString?
M := M + ' ' + CurTokenText;
NextToken;
end;
end else
end;
end
else
NextToken;
if (CurToken = tkIdentifier) and (UpperCase(CurTokenText) = 'NAME') then
begin
begin
M := M + ' name ';
NextToken;
if (CurToken = tkString) or (CurToken = tkIdentifier) then
@ -1198,7 +1183,8 @@ begin
else
ParseExc(SParserSyntaxError);
ExpectToken(tkSemicolon);
end else if CurToken <> tkSemicolon then
end
else if CurToken <> tkSemicolon then
ParseExc(SParserSyntaxError);
end else
begin
@ -1855,7 +1841,10 @@ end.
{
$Log$
Revision 1.10 2004-12-06 08:53:47 michael
Revision 1.11 2004-12-06 19:16:38 michael
+ Some cleanup, removed some keywords which are not keywords
Revision 1.10 2004/12/06 08:53:47 michael
+ Fix from Dave Strodtman to properly support packed
Revision 1.9 2004/10/16 18:55:31 michael

View File

@ -69,21 +69,17 @@ type
tkas,
tkasm,
tkbegin,
tkbreak,
tkcase,
tkclass,
tkconst,
tkconstructor,
tkcontinue,
tkdestructor,
tkdispose,
tkdiv,
tkdo,
tkdownto,
tkelse,
tkend,
tkexcept,
tkexit,
tkexports,
tkfalse,
tkfinalization,
@ -102,7 +98,6 @@ type
tklabel,
tklibrary,
tkmod,
tknew,
tknil,
tknot,
tkobject,
@ -251,21 +246,17 @@ const
'as',
'asm',
'begin',
'break',
'case',
'class',
'const',
'constructor',
'continue',
'destructor',
'dispose',
'div',
'do',
'downto',
'else',
'end',
'except',
'exit',
'exports',
'false',
'finalization',
@ -284,7 +275,6 @@ const
'label',
'library',
'mod',
'new',
'nil',
'not',
'object',
@ -1035,7 +1025,10 @@ end.
{
$Log$
Revision 1.9 2004-09-05 08:56:56 michael
Revision 1.10 2004-12-06 19:16:38 michael
+ Some cleanup, removed some keywords which are not keywords
Revision 1.9 2004/09/05 08:56:56 michael
+ Fixed line 404 - missing brackets
Revision 1.8 2004/08/25 09:32:39 michael