瀏覽代碼

* allow more tokens instead of only semicolon after inherited

peter 22 年之前
父節點
當前提交
fe6518a49c
共有 3 個文件被更改,包括 27 次插入15 次删除
  1. 9 2
      compiler/pbase.pas
  2. 5 2
      compiler/pexpr.pas
  3. 13 11
      compiler/pstatmnt.pas

+ 9 - 2
compiler/pbase.pas

@@ -33,6 +33,10 @@ interface
        ;
        ;
 
 
     const
     const
+       { tokens that end a block or statement. And don't require
+         a ; on the statement before }
+       endtokens = [_SEMICOLON,_END,_ELSE,_UNTIL];
+
        { true, if we are after an assignement }
        { true, if we are after an assignement }
        afterassignment : boolean = false;
        afterassignment : boolean = false;
 
 
@@ -167,7 +171,7 @@ implementation
       end;
       end;
 
 
 
 
-    { check if a symbol contains the hint directive, and if so gives out a hint 
+    { check if a symbol contains the hint directive, and if so gives out a hint
       if required.
       if required.
     }
     }
     procedure check_hints(const srsym: tsym);
     procedure check_hints(const srsym: tsym);
@@ -263,7 +267,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2002-12-05 19:28:05  carl
+  Revision 1.23  2003-03-17 18:55:30  peter
+    * allow more tokens instead of only semicolon after inherited
+
+  Revision 1.22  2002/12/05 19:28:05  carl
     - remove lower in hint
     - remove lower in hint
 
 
   Revision 1.21  2002/11/30 11:12:48  carl
   Revision 1.21  2002/11/30 11:12:48  carl

+ 5 - 2
compiler/pexpr.pas

@@ -1783,7 +1783,7 @@ implementation
                   classh:=procinfo._class.childof;
                   classh:=procinfo._class.childof;
                   { if inherited; only then we need the method with
                   { if inherited; only then we need the method with
                     the same name }
                     the same name }
-                  if token=_SEMICOLON then
+                  if token in endtokens then
                    begin
                    begin
                      hs:=aktprocsym.name;
                      hs:=aktprocsym.name;
                      anon_inherited:=true;
                      anon_inherited:=true;
@@ -2340,7 +2340,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.103  2003-03-17 16:54:41  peter
+  Revision 1.104  2003-03-17 18:55:30  peter
+    * allow more tokens instead of only semicolon after inherited
+
+  Revision 1.103  2003/03/17 16:54:41  peter
     * support DefaultHandler and anonymous inheritance fixed
     * support DefaultHandler and anonymous inheritance fixed
       for message methods
       for message methods
 
 

+ 13 - 11
compiler/pstatmnt.pas

@@ -276,11 +276,11 @@ implementation
            { concats instruction }
            { concats instruction }
            instruc:=cstatementnode.create(p,instruc);
            instruc:=cstatementnode.create(p,instruc);
 
 
-           if not((token=_ELSE) or (token=_OTHERWISE) or (token=_END)) then
+           if not(token in [_ELSE,_OTHERWISE,_END]) then
              consume(_SEMICOLON);
              consume(_SEMICOLON);
-         until (token=_ELSE) or (token=_OTHERWISE) or (token=_END);
+         until (token in [_ELSE,_OTHERWISE,_END]);
 
 
-         if (token=_ELSE) or (token=_OTHERWISE) then
+         if (token in [_ELSE,_OTHERWISE]) then
            begin
            begin
               if not try_to_consume(_ELSE) then
               if not try_to_consume(_ELSE) then
                 consume(_OTHERWISE);
                 consume(_OTHERWISE);
@@ -488,7 +488,7 @@ implementation
          paddr:=nil;
          paddr:=nil;
          pframe:=nil;
          pframe:=nil;
          consume(_RAISE);
          consume(_RAISE);
-         if not(token in [_SEMICOLON,_END,_ELSE]) then
+         if not(token in endtokens) then
            begin
            begin
               { object }
               { object }
               pobj:=comp_expr(true);
               pobj:=comp_expr(true);
@@ -683,19 +683,18 @@ implementation
                      if not try_to_consume(_SEMICOLON) then
                      if not try_to_consume(_SEMICOLON) then
                         break;
                         break;
                      consume_emptystats;
                      consume_emptystats;
-                   until (token=_END) or (token=_ELSE);
-                   if token=_ELSE then
-                     { catch the other exceptions }
+                   until (token in [_END,_ELSE]);
+                   if try_to_consume(_ELSE) then
                      begin
                      begin
-                        consume(_ELSE);
-                        p_default:=statements_til_end;
+                       { catch the other exceptions }
+                       p_default:=statements_til_end;
                      end
                      end
                    else
                    else
                      consume(_END);
                      consume(_END);
                 end
                 end
               else
               else
-                { catch all exceptions }
                 begin
                 begin
+                   { catch all exceptions }
                    p_default:=statements_til_end;
                    p_default:=statements_til_end;
                 end;
                 end;
               dec(statement_level);
               dec(statement_level);
@@ -1127,7 +1126,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.86  2003-02-19 22:00:14  daniel
+  Revision 1.87  2003-03-17 18:55:30  peter
+    * allow more tokens instead of only semicolon after inherited
+
+  Revision 1.86  2003/02/19 22:00:14  daniel
     * Code generator converted to new register notation
     * Code generator converted to new register notation
     - Horribily outdated todo.txt removed
     - Horribily outdated todo.txt removed