Browse Source

* better error recovering

florian 27 years ago
parent
commit
2cd812215b
2 changed files with 25 additions and 13 deletions
  1. 15 11
      compiler/pdecl.pas
  2. 10 2
      compiler/pexpr.pas

+ 15 - 11
compiler/pdecl.pas

@@ -1262,17 +1262,18 @@ unit pdecl;
                                     aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
                                     aktprocsym^.definition^.options:=aktprocsym^.definition^.options or
                                       pooverridingmethod or povirtualmethod;
                                       pooverridingmethod or povirtualmethod;
                                   end;
                                   end;
-                      _ABSTRACT : begin
-                                    if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
-                                      aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
-                                    else
-                                      Message(parser_e_only_virtual_methods_abstract);
-                                    consume(_ABSTRACT);
-                                    consume(SEMICOLON);
-                                    { the method is defined }
-                                    aktprocsym^.definition^.forwarddef:=false;
-                                  end;
                       end;
                       end;
+                      if idtoken=_abstract then
+                        begin
+                           if (aktprocsym^.definition^.options and povirtualmethod)<>0 then
+                             aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poabstractmethod
+                           else
+                             Message(parser_e_only_virtual_methods_abstract);
+                           consume(_ABSTRACT);
+                           consume(SEMICOLON);
+                           { the method is defined }
+                           aktprocsym^.definition^.forwarddef:=false;
+                        end;
                       if (cs_static_keyword in aktglobalswitches) and (idtoken=_STATIC) then
                       if (cs_static_keyword in aktglobalswitches) and (idtoken=_STATIC) then
                        begin
                        begin
                          consume(_STATIC);
                          consume(_STATIC);
@@ -2036,7 +2037,10 @@ unit pdecl;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.59  1998-09-26 17:45:33  peter
+  Revision 1.60  1998-09-30 07:40:33  florian
+    * better error recovering
+
+  Revision 1.59  1998/09/26 17:45:33  peter
     + idtoken and only one token table
     + idtoken and only one token table
 
 
   Revision 1.58  1998/09/25 00:04:01  florian
   Revision 1.58  1998/09/25 00:04:01  florian

+ 10 - 2
compiler/pexpr.pas

@@ -1396,7 +1396,12 @@ unit pexpr;
                      end;
                      end;
                   end
                   end
                  else
                  else
-                  Message(parser_e_generic_methods_only_in_methods);
+                   begin
+                      Message(parser_e_generic_methods_only_in_methods);
+                      again:=false;
+                      pd:=generrordef;
+                      p1:=genzeronode(errorn);
+                   end;
                  postfixoperators;
                  postfixoperators;
                end;
                end;
     INTCONST : begin
     INTCONST : begin
@@ -1765,7 +1770,10 @@ unit pexpr;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.57  1998-09-28 16:18:16  florian
+  Revision 1.58  1998-09-30 07:40:35  florian
+    * better error recovering
+
+  Revision 1.57  1998/09/28 16:18:16  florian
     * two fixes to get ansi strings work
     * two fixes to get ansi strings work
 
 
   Revision 1.56  1998/09/26 17:45:36  peter
   Revision 1.56  1998/09/26 17:45:36  peter