From 270c2d700e8fc97b69276593bd107846c784f2e7 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Wed, 30 Apr 2014 19:25:06 +0000 Subject: [PATCH] * 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 - --- .gitattributes | 1 + compiler/pstatmnt.pas | 2 +- tests/webtbs/tw25781.pp | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw25781.pp diff --git a/.gitattributes b/.gitattributes index e596c6c397..eb84d4f88a 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index b49fdd0908..8479cef0c9 100644 --- a/compiler/pstatmnt.pas +++ b/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; diff --git a/tests/webtbs/tw25781.pp b/tests/webtbs/tw25781.pp new file mode 100644 index 0000000000..55a110ace8 --- /dev/null +++ b/tests/webtbs/tw25781.pp @@ -0,0 +1,11 @@ +{ %norun } + +{$mode delphi} + +begin + try + if true then + except + end +end. +