Browse Source

+ Some cleanup, removed some keywords which are not keywords

michael 20 years ago
parent
commit
5d26556132
2 changed files with 29 additions and 47 deletions
  1. 25 36
      fcl/passrc/pparser.pp
  2. 4 11
      fcl/passrc/pscanner.pp

+ 25 - 36
fcl/passrc/pparser.pp

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

+ 4 - 11
fcl/passrc/pscanner.pp

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