Răsfoiți Sursa

* allow the "then" part of an if-statement to be terminated by any endtoken,
instead of only by "else" (mantis #25781)

git-svn-id: trunk@27696 -

Jonas Maebe 11 ani în urmă
părinte
comite
270c2d700e
3 a modificat fișierele cu 13 adăugiri și 1 ștergeri
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/pstatmnt.pas
  3. 11 0
      tests/webtbs/tw25781.pp

+ 1 - 0
.gitattributes

@@ -13907,6 +13907,7 @@ tests/webtbs/tw25605.pp svneol=native#text/pascal
 tests/webtbs/tw2561.pp svneol=native#text/plain
 tests/webtbs/tw25610.pp -text svneol=native#text/plain
 tests/webtbs/tw25685.pp svneol=native#text/pascal
+tests/webtbs/tw25781.pp svneol=native#text/plain
 tests/webtbs/tw25814.pp svneol=native#text/plain
 tests/webtbs/tw25869.pp svneol=native#text/plain
 tests/webtbs/tw2588.pp svneol=native#text/plain

+ 1 - 1
compiler/pstatmnt.pas

@@ -73,7 +73,7 @@ implementation
          consume(_IF);
          ex:=comp_expr(true,false);
          consume(_THEN);
-         if token<>_ELSE then
+         if not(token in endtokens) then
            if_a:=statement
          else
            if_a:=nil;

+ 11 - 0
tests/webtbs/tw25781.pp

@@ -0,0 +1,11 @@
+{ %norun }
+
+{$mode delphi}
+
+begin
+  try
+    if true then
+  except
+  end
+end.
+