Explorar el Código

+ strip leading zeros in numeric labels in iso/extended pascal mode also in label declarations, resolves #37323

git-svn-id: trunk@45764 -
florian hace 5 años
padre
commit
f6f5cb45a3
Se han modificado 3 ficheros con 18 adiciones y 1 borrados
  1. 1 0
      .gitattributes
  2. 8 1
      compiler/pdecl.pas
  3. 9 0
      tests/webtbs/tw37323.pp

+ 1 - 0
.gitattributes

@@ -18350,6 +18350,7 @@ tests/webtbs/tw37261.pp svneol=native#text/pascal
 tests/webtbs/tw37272a.pp svneol=native#text/pascal
 tests/webtbs/tw37301.pp svneol=native#text/pascal
 tests/webtbs/tw37322.pp svneol=native#text/pascal
+tests/webtbs/tw37323.pp svneol=native#text/pascal
 tests/webtbs/tw3742.pp svneol=native#text/plain
 tests/webtbs/tw3751.pp svneol=native#text/plain
 tests/webtbs/tw3758.pp svneol=native#text/plain

+ 8 - 1
compiler/pdecl.pas

@@ -387,7 +387,14 @@ implementation
                 if token=_ID then
                   labelsym:=clabelsym.create(orgpattern)
                 else
-                  labelsym:=clabelsym.create(pattern);
+                  begin
+                    { strip leading 0's in iso mode }
+                    if (([m_iso,m_extpas]*current_settings.modeswitches)<>[]) then
+                      while pattern[1]='0' do
+                        delete(pattern,1,1);
+                    labelsym:=clabelsym.create(pattern);
+                  end;
+
                 symtablestack.top.insert(labelsym);
                 if m_non_local_goto in current_settings.modeswitches then
                   begin

+ 9 - 0
tests/webtbs/tw37323.pp

@@ -0,0 +1,9 @@
+{ %OPT=-Miso -Sg }
+program test;
+
+label 0001;
+
+begin
+     goto 1;
+   1:
+end.