Bläddra i källkod

* minor fixes from mantis 8132

git-svn-id: trunk@6091 -
peter 18 år sedan
förälder
incheckning
70fc3274e2
1 ändrade filer med 11 tillägg och 7 borttagningar
  1. 11 7
      compiler/scanner.pas

+ 11 - 7
compiler/scanner.pas

@@ -2374,6 +2374,12 @@ In case not, the value returned can be arbitrary.
          gettokenpos;
          gettokenpos;
          readchar; {Remove the $}
          readchar; {Remove the $}
          hs:=readid;
          hs:=readid;
+         { handle empty directive }
+         if hs='' then
+           begin
+             Message1(scan_w_illegal_switch,'$');
+             exit;
+           end;
 {$ifdef PREPROCWRITE}
 {$ifdef PREPROCWRITE}
          if parapreprocess then
          if parapreprocess then
           begin
           begin
@@ -2395,9 +2401,7 @@ In case not, the value returned can be arbitrary.
             aktcommentstyle:=comment_none;
             aktcommentstyle:=comment_none;
             exit;
             exit;
           end;
           end;
-         if hs='' then
-           Message1(scan_w_illegal_switch,'$'+hs);
-      { Check for compiler switches }
+         { Check for compiler switches }
          while (length(hs)=1) and (c in ['-','+']) do
          while (length(hs)=1) and (c in ['-','+']) do
           begin
           begin
             HandleSwitch(hs[1],c);
             HandleSwitch(hs[1],c);
@@ -2405,7 +2409,7 @@ In case not, the value returned can be arbitrary.
             if c=',' then
             if c=',' then
              begin
              begin
                current_scanner.readchar;   {Remove , }
                current_scanner.readchar;   {Remove , }
-             { read next switch, support $v+,$+}
+               { read next switch, support $v+,$+}
                hs:=current_scanner.readid;
                hs:=current_scanner.readid;
                if (hs='') then
                if (hs='') then
                 begin
                 begin
@@ -2423,7 +2427,7 @@ In case not, the value returned can be arbitrary.
             else
             else
              hs:='';
              hs:='';
           end;
           end;
-      { directives may follow switches after a , }
+         { directives may follow switches after a , }
          if hs<>'' then
          if hs<>'' then
           begin
           begin
             if not (m_mac in current_settings.modeswitches) then
             if not (m_mac in current_settings.modeswitches) then
@@ -2446,7 +2450,7 @@ In case not, the value returned can be arbitrary.
                current_scanner.ignoredirectives.Add(hs,nil);
                current_scanner.ignoredirectives.Add(hs,nil);
                Message1(scan_w_illegal_directive,'$'+hs);
                Message1(scan_w_illegal_directive,'$'+hs);
              end;
              end;
-          { conditionals already read the comment }
+            { conditionals already read the comment }
             if (current_scanner.comment_level>0) then
             if (current_scanner.comment_level>0) then
              current_scanner.readcomment;
              current_scanner.readcomment;
             { we've read the whole comment }
             { we've read the whole comment }
@@ -2643,7 +2647,7 @@ In case not, the value returned can be arbitrary.
                           if (i<255) then
                           if (i<255) then
                             begin
                             begin
                               inc(i);
                               inc(i);
-                              readcomment[i]:='*';
+                              readcomment[i]:=c;
                             end;
                             end;
                         end;
                         end;
                   end
                   end