Bladeren bron

* allow oridinal labels again

peter 23 jaren geleden
bovenliggende
commit
4b2aa039e6
3 gewijzigde bestanden met toevoegingen van 55 en 7 verwijderingen
  1. 8 2
      compiler/pdecl.pas
  2. 39 2
      compiler/pstatmnt.pas
  3. 8 3
      compiler/targets/t_nwm.pas

+ 8 - 2
compiler/pdecl.pas

@@ -255,7 +255,10 @@ implementation
                   end
                 else
                   getlabel(hl);
-                symtablestack.insert(tlabelsym.create(orgpattern,hl));
+                if token=_ID then
+                 symtablestack.insert(tlabelsym.create(orgpattern,hl))
+                else
+                 symtablestack.insert(tlabelsym.create(pattern,hl));
                 consume(token);
              end;
            if token<>_SEMICOLON then consume(_COMMA);
@@ -605,7 +608,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.40  2001-12-06 17:57:35  florian
+  Revision 1.41  2002-03-04 17:54:59  peter
+    * allow oridinal labels again
+
+  Revision 1.40  2001/12/06 17:57:35  florian
     + parasym to tparaitem added
 
   Revision 1.39  2001/10/25 21:22:35  peter

+ 39 - 2
compiler/pstatmnt.pas

@@ -884,6 +884,7 @@ implementation
          filepos : tfileposinfo;
          srsym   : tsym;
          srsymtable : tsymtable;
+         s       : stringid;
       begin
          filepos:=akttokenpos;
          case token of
@@ -899,7 +900,20 @@ implementation
                   end
                 else
                   begin
-                     consume_sym(srsym,srsymtable);
+                     if token=_ID then
+                      consume_sym(srsym,srsymtable)
+                     else
+                      begin
+                        searchsym(pattern,srsym,srsymtable);
+                        if srsym=nil then
+                         begin
+                           identifier_not_found(pattern);
+                           srsym:=generrorsym;
+                           srsymtable:=nil;
+                         end;
+                        consume(token);
+                      end;
+
                      if srsym.typ<>labelsym then
                        begin
                           Message(sym_e_id_is_no_label_id);
@@ -955,6 +969,26 @@ implementation
            begin
              p:=expr;
 
+             { When a colon follows a intconst then transform it into a label }
+             if try_to_consume(_COLON) then
+              begin
+                s:=tostr(tordconstnode(p).value);
+                p.free;
+                searchsym(s,srsym,srsymtable);
+                if assigned(srsym) then
+                 begin
+                   if tlabelsym(srsym).defined then
+                    Message(sym_e_label_already_defined);
+                   tlabelsym(srsym).defined:=true;
+                   p:=clabelnode.create(tlabelsym(srsym),nil);
+                 end
+                else
+                 begin
+                   identifier_not_found(s);
+                   p:=cnothingnode.create;
+                 end;
+              end;
+
              if p.nodetype=labeln then
               begin
                 { the pointer to the following instruction }
@@ -1188,7 +1222,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.46  2002-01-29 21:32:03  peter
+  Revision 1.47  2002-03-04 17:54:59  peter
+    * allow oridinal labels again
+
+  Revision 1.46  2002/01/29 21:32:03  peter
     * allow accessing locals in other lexlevel when the current assembler
       routine doesn't have locals.
 

+ 8 - 3
compiler/targets/t_nwm.pas

@@ -133,8 +133,10 @@ begin
   current_module.linkothersharedlibs.add(SplitName(module),link_allways);
   { do nothing with the procedure, only set the mangledname }
   if name<>'' then
-    aktprocdef.setmangledname(name)
-    aktprocdef.has_mangledname:=true;
+   begin
+     aktprocdef.setmangledname(name);
+     aktprocdef.has_mangledname:=true;
+   end     
   else
     message(parser_e_empty_import_name);
 end;
@@ -539,7 +541,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.13  2002-03-03 13:00:39  hajny
+  Revision 1.14  2002-03-04 17:54:59  peter
+    * allow oridinal labels again
+
+  Revision 1.13  2002/03/03 13:00:39  hajny
     * importprocedure fix by Armin Diehl
 
   Revision 1.12  2001/11/02 22:58:12  peter