Browse Source

* fixed line counter when the first line had #10 only. This was buggy
for both the main file as for include files

peter 26 years ago
parent
commit
0e7c4919c8
2 changed files with 30 additions and 3 deletions
  1. 11 1
      compiler/scandir.inc
  2. 19 2
      compiler/scanner.pas

+ 11 - 1
compiler/scandir.inc

@@ -664,6 +664,12 @@ const
             Message1(scan_f_cannot_open_includefile,hs);
             Message1(scan_f_cannot_open_includefile,hs);
            Message1(scan_t_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
            Message1(scan_t_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
            current_scanner^.reload;
            current_scanner^.reload;
+         { process first read char }
+           case c of
+            #26 : current_scanner^.reload;
+            #10,
+            #13 : current_scanner^.linebreak;
+           end;
          { register for refs }
          { register for refs }
            current_module^.sourcefiles^.register_file(hp);
            current_module^.sourcefiles^.register_file(hp);
          end;
          end;
@@ -1157,7 +1163,11 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.64  1999-09-27 23:38:17  peter
+  Revision 1.65  1999-10-30 12:32:30  peter
+    * fixed line counter when the first line had #10 only. This was buggy
+      for both the main file as for include files
+
+  Revision 1.64  1999/09/27 23:38:17  peter
     * bracket support for macro define
     * bracket support for macro define
 
 
   Revision 1.63  1999/09/20 16:39:02  peter
   Revision 1.63  1999/09/20 16:39:02  peter

+ 19 - 2
compiler/scanner.pas

@@ -216,6 +216,12 @@ implementation
         if not openinputfile then
         if not openinputfile then
          Message1(scan_f_cannot_open_input,fn);
          Message1(scan_f_cannot_open_input,fn);
         reload;
         reload;
+      { process first read char }
+        case c of
+         #26 : reload;
+         #10,
+         #13 : linebreak;
+        end;
       end;
       end;
 
 
 
 
@@ -1107,7 +1113,14 @@ implementation
                     insertmacro(pattern,mac^.buftext,mac^.buflen);
                     insertmacro(pattern,mac^.buftext,mac^.buflen);
                   { handle empty macros }
                   { handle empty macros }
                     if c=#0 then
                     if c=#0 then
-                     reload;
+                     begin
+                       reload;
+                       case c of
+                        #26 : reload;
+                        #10,
+                        #13 : linebreak;
+                       end;
+                     end;
                   { play it again ... }
                   { play it again ... }
                     inc(yylexcount);
                     inc(yylexcount);
                     if yylexcount>16 then
                     if yylexcount>16 then
@@ -1671,7 +1684,11 @@ exit_label:
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.96  1999-09-27 23:40:10  peter
+  Revision 1.97  1999-10-30 12:32:30  peter
+    * fixed line counter when the first line had #10 only. This was buggy
+      for both the main file as for include files
+
+  Revision 1.96  1999/09/27 23:40:10  peter
     * fixed macro within macro endless-loop
     * fixed macro within macro endless-loop
 
 
   Revision 1.95  1999/09/03 10:02:48  peter
   Revision 1.95  1999/09/03 10:02:48  peter