Browse Source

* keyword check patch from Gerhard Scholz

git-svn-id: trunk@530 -
peter 20 years ago
parent
commit
8e29f17019
1 changed files with 6 additions and 4 deletions
  1. 6 4
      compiler/scanner.pas

+ 6 - 4
compiler/scanner.pas

@@ -213,7 +213,8 @@ implementation
       var
       var
         low,high,mid : longint;
         low,high,mid : longint;
       begin
       begin
-        if not (length(s) in [tokenlenmin..tokenlenmax]) then
+        if not (length(s) in [tokenlenmin..tokenlenmax]) or
+           not (s[1] in ['a'..'z','A'..'Z']) then
          begin
          begin
            is_keyword:=false;
            is_keyword:=false;
            exit;
            exit;
@@ -869,9 +870,6 @@ implementation
         mac.is_used:=true;
         mac.is_used:=true;
         if (cs_support_macro in aktmoduleswitches) then
         if (cs_support_macro in aktmoduleswitches) then
           begin
           begin
-             { key words are never substituted }
-             if is_keyword(hs) then
-               Message(scan_e_keyword_cant_be_a_macro);
              { !!!!!! handle macro params, need we this? }
              { !!!!!! handle macro params, need we this? }
              current_scanner.skipspace;
              current_scanner.skipspace;
 
 
@@ -887,6 +885,10 @@ implementation
                  current_scanner.skipspace;
                  current_scanner.skipspace;
                end;
                end;
 
 
+             { key words are never substituted }
+             if is_keyword(hs) then
+               Message(scan_e_keyword_cant_be_a_macro);
+
              new(macrobuffer);
              new(macrobuffer);
              macropos:=0;
              macropos:=0;
              { parse macro, brackets are counted so it's possible
              { parse macro, brackets are counted so it's possible