Browse Source

* fixed eof bug with includefiles

peter 26 years ago
parent
commit
f52b051f7d
1 changed files with 37 additions and 16 deletions
  1. 37 16
      compiler/scanner.pas

+ 37 - 16
compiler/scanner.pas

@@ -351,14 +351,14 @@ implementation
            repeat
            repeat
            { still more to read?, then change the #0 to a space so its seen
            { still more to read?, then change the #0 to a space so its seen
              as a seperator }
              as a seperator }
-             if (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
+             if (c=#0) and (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
               begin
               begin
                 c:=' ';
                 c:=' ';
                 inc(longint(inputpointer));
                 inc(longint(inputpointer));
                 exit;
                 exit;
               end;
               end;
            { can we read more from this file ? }
            { can we read more from this file ? }
-             if not endoffile then
+             if (c<>#26) and (not endoffile) then
               begin
               begin
                 readbuf;
                 readbuf;
                 inputpointer:=buf;
                 inputpointer:=buf;
@@ -565,8 +565,11 @@ implementation
          reload
          reload
         else
         else
          inc(longint(inputpointer));
          inc(longint(inputpointer));
-        if c in [#10,#13] then
-         linebreak;
+        case c of
+         #26 : reload;
+         #10,
+         #13 : linebreak;
+        end;
       end;
       end;
 
 
 
 
@@ -599,7 +602,7 @@ implementation
                          c:=inputpointer^;
                          c:=inputpointer^;
                          inc(longint(inputpointer));
                          inc(longint(inputpointer));
                        end;
                        end;
-                  #0 : reload;
+              #0,#26 : reload;
              #13,#10 : begin
              #13,#10 : begin
                          linebreak;
                          linebreak;
                          break;
                          break;
@@ -664,8 +667,11 @@ implementation
             inc(longint(inputpointer));
             inc(longint(inputpointer));
          end;
          end;
       { was the next char a linebreak ? }
       { was the next char a linebreak ? }
-        if c in [#10,#13] then
-         linebreak;
+        case c of
+         #26 : reload;
+         #10,
+         #13 : linebreak;
+        end;
         {$ifndef TP}
         {$ifndef TP}
           {$ifopt H+}
           {$ifopt H+}
             setlength(pattern,i);
             setlength(pattern,i);
@@ -770,8 +776,11 @@ implementation
             reload
             reload
            else
            else
             inc(longint(inputpointer));
             inc(longint(inputpointer));
-           if c in [#10,#13] then
-            linebreak;
+           case c of
+            #26 : reload;
+            #10,
+            #13 : linebreak;
+           end;
          end;
          end;
       end;
       end;
 
 
@@ -805,8 +814,11 @@ implementation
             reload
             reload
            else
            else
             inc(longint(inputpointer));
             inc(longint(inputpointer));
-           if c in [#10,#13] then
-            linebreak;
+           case c of
+            #26 : reload;
+            #10,
+            #13 : linebreak;
+           end;
          until (found=2);
          until (found=2);
       end;
       end;
 
 
@@ -832,8 +844,11 @@ implementation
             reload
             reload
            else
            else
             inc(longint(inputpointer));
             inc(longint(inputpointer));
-           if c in [#10,#13] then
-            linebreak;
+           case c of
+            #26 : reload;
+            #10,
+            #13 : linebreak;
+           end;
          end;
          end;
       end;
       end;
 
 
@@ -895,8 +910,11 @@ implementation
               reload
               reload
              else
              else
               inc(longint(inputpointer));
               inc(longint(inputpointer));
-             if c in [#10,#13] then
-              linebreak;
+             case c of
+              #26 : reload;
+              #10,
+              #13 : linebreak;
+             end;
            until (found=2);
            until (found=2);
          end;
          end;
       end;
       end;
@@ -1486,7 +1504,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.69  1998-12-11 00:03:46  peter
+  Revision 1.70  1999-01-19 12:14:38  peter
+    * fixed eof bug with includefiles
+
+  Revision 1.69  1998/12/11 00:03:46  peter
     + globtype,tokens,version unit splitted from globals
     + globtype,tokens,version unit splitted from globals
 
 
   Revision 1.68  1998/11/16 15:41:44  peter
   Revision 1.68  1998/11/16 15:41:44  peter