Browse Source

* fixed realnumber scanning
* [] after asmblock was not uppercased anymore

peter 27 years ago
parent
commit
889203c8ba
2 changed files with 48 additions and 37 deletions
  1. 7 1
      compiler/pstatmnt.pas
  2. 41 36
      compiler/scanner.pas

+ 7 - 1
compiler/pstatmnt.pas

@@ -631,6 +631,8 @@ unit pstatmnt;
               asmstat^.object_preserved:=true;
               if token<>RECKKLAMMER then
                 repeat
+                { uppercase, because it's a CSTRING }
+                  uppervar(pattern);
 {$ifdef i386}
                   if pattern='EAX' then
                     usedinproc:=usedinproc or ($80 shr byte(R_EAX))
@@ -1166,7 +1168,11 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.23  1998-06-25 08:48:18  florian
+  Revision 1.24  1998-07-10 10:48:42  peter
+    * fixed realnumber scanning
+    * [] after asmblock was not uppercased anymore
+
+  Revision 1.23  1998/06/25 08:48:18  florian
     * first version of rtti support
 
   Revision 1.22  1998/06/24 14:48:36  peter

+ 41 - 36
compiler/scanner.pas

@@ -1240,43 +1240,48 @@ implementation
                       end;
            '0'..'9' : begin
                         readnumber;
-                        case c of
-                         '.' : begin
-                                 readchar;
-                                 if not(c in ['0'..'9']) then
-                                  begin
-                                    s_point:=true;
-                                    yylex:=INTCONST;
-                                    goto exit_label;
-                                  end;
-                                 pattern:=pattern+'.';
-                                 while c in ['0'..'9'] do
-                                  begin
-                                    pattern:=pattern+c;
-                                    readchar;
-                                  end;
-                                 yylex:=REALNUMBER;
+                        if (c in ['.','e','E']) then
+                         begin
+                         { first check for a . }
+                           if c='.' then
+                            begin
+                              readchar;
+                              if not(c in ['0'..'9']) then
+                               begin
+                                 s_point:=true;
+                                 yylex:=INTCONST;
                                  goto exit_label;
                                end;
-                     'e','E' : begin
-                                 pattern:=pattern+'E';
+                              pattern:=pattern+'.';
+                              while c in ['0'..'9'] do
+                               begin
+                                 pattern:=pattern+c;
                                  readchar;
-                                 if c in ['-','+'] then
-                                  begin
-                                    pattern:=pattern+c;
-                                    readchar;
-                                  end;
-                                 if not(c in ['0'..'9']) then
-                                  Message(scan_f_illegal_char);
-                                 while c in ['0'..'9'] do
-                                  begin
-                                    pattern:=pattern+c;
-                                    readchar;
-                                  end;
-                                 yylex:=REALNUMBER;
-                                 goto exit_label;
                                end;
-                        end;
+                            end;
+                         { E can also follow after a point is scanned }
+
+                           if c in ['e','E'] then
+
+                            begin
+                              pattern:=pattern+'E';
+                              readchar;
+                              if c in ['-','+'] then
+                               begin
+                                 pattern:=pattern+c;
+                                 readchar;
+                               end;
+                              if not(c in ['0'..'9']) then
+                               Message(scan_f_illegal_char);
+                              while c in ['0'..'9'] do
+                               begin
+                                 pattern:=pattern+c;
+                                 readchar;
+                               end;
+                            end;
+                           yylex:=REALNUMBER;
+                           goto exit_label;
+                         end;
                         yylex:=INTCONST;
                         goto exit_label;
                       end;
@@ -1753,9 +1758,9 @@ exit_label:
 end.
 {
   $Log$
-  Revision 1.32  1998-07-10 00:00:02  peter
-    * fixed ttypesym bug finally
-    * fileinfo in the symtable and better using for unused vars
+  Revision 1.33  1998-07-10 10:48:40  peter
+    * fixed realnumber scanning
+    * [] after asmblock was not uppercased anymore
 
   Revision 1.31  1998/07/07 17:39:38  peter
     * fixed $I  with following eof