diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl
index 6dee500..4445d3d 100644
--- a/src/interfaces/ecpg/preproc/parse.pl
+++ b/src/interfaces/ecpg/preproc/parse.pl
@@ -25,6 +25,7 @@ my $yaccmode              = 0;
 my $header_included       = 0;
 my $feature_not_supported = 0;
 my $tokenmode             = 0;
+my $fill_semicolon        = 0;
 
 my (%buff, $infield, $comment, %tokens, %addons);
 my ($stmt_mode, @fields);
@@ -258,6 +259,7 @@ sub main
 			}
 			elsif ($arr[$fieldIndexer] eq '}')
 			{
+				$fill_semicolon = 1;
 				$brace_indent--;
 				next;
 			}
@@ -271,7 +273,9 @@ sub main
 			{
 				next;
 			}
-			if ($arr[$fieldIndexer] eq ';')
+
+			if (($arr[$fieldIndexer] =~ /[A-Za-z0-9]+:/ && $fill_semicolon eq 1)
+				|| $arr[$fieldIndexer] eq ';')
 			{
 				if ($copymode)
 				{
@@ -279,16 +283,23 @@ sub main
 					{
 						dump_line($stmt_mode, \@fields);
 					}
-					add_to_buffer('rules', ";\n\n");
+					if ($arr[$fieldIndexer] eq ';')
+					{
+						add_to_buffer('rules', ";\n\n");
+					}
 				}
 				else
 				{
 					$copymode = 1;
 				}
+				$fill_semicolon = 0;
 				@fields  = ();
 				$infield = 0;
 				$line    = '';
-				next;
+				if($arr[$fieldIndexer] eq ';')
+				{
+					next;
+				}
 			}
 
 			if ($arr[$fieldIndexer] eq '|')
