@@ -82,7 +82,10 @@ sub dbg
82
82
}
83
83
sub dbg_info
84
84
{
85
- $debug == 0 or push @output , $_ [0]." \n " ;
85
+ if ($debug == 1){
86
+ push @output , $_ [0]." \n " ;
87
+ print $_ [0]." \n " ;
88
+ }
86
89
}
87
90
88
91
# main loop
@@ -468,7 +471,7 @@ sub dbg_info
468
471
dbg_info(" go for multiline" );
469
472
$line = $lines [$line_idx ];
470
473
$line_idx ++;
471
- while ( $line =~ m / ^\s *[:,] [\w <>] +\( .*?\) / ){
474
+ while ( $line =~ m / ^\s *[:,] \s + [\w <>] +\( .*?\) / ){
472
475
dbg_info(" member initializing list" );
473
476
$line = $lines [$line_idx ];
474
477
$line_idx ++;
@@ -569,33 +572,45 @@ sub dbg_info
569
572
570
573
# multiline definition (parenthesis left open)
571
574
if ( $MULTILINE_DEFINITION == 1 ){
572
- # see https://regex101.com/r/DN01iM/2
573
- if ( $line =~ m / ^([^()]+(\( (?:[^()]++|(?1))*\) ))*[^()] *\) [^()] *$ / ){
574
- $MULTILINE_DEFINITION = 0;
575
- # remove potential following body
576
- if ( $SIP_RUN == 0 && $lines [$line_idx ] =~ m / ^\s *\{ $ / ){
577
- dbg_info(" remove following body of multiline def" );
578
- my $last_line = $line ;
579
- my $nesting_index = 0;
580
- while ($line_idx < $line_count ){
581
- $line = $lines [$line_idx ];
582
- $line_idx ++;
575
+ dbg_info(" on multiline" );
576
+ # https://regex101.com/r/DN01iM/2
577
+ if ( $line =~ m / ^([^()]+(\( (?:[^()]++|(?1))*\) ))*[^()] *\) [^()] *$ / ){
578
+ $MULTILINE_DEFINITION = 0;
579
+ dbg_info(" ending multiline" );
580
+ # remove potential following body
583
581
584
- $nesting_index += $line =~ tr / \{// ;
585
- $nesting_index -= $line =~ tr / \}// ;
586
- if ($nesting_index == 0){
587
- last ;
588
- }
589
- }
590
- # add missing semi column
591
- my $dummy = pop (@output );
592
- push @output , dbg(" MLT" )." $last_line ;\n " ;
593
- }
594
- }
595
- else
596
- {
597
- next ;
598
- }
582
+
583
+ if ( $SIP_RUN == 0 && $line !~ m / (\{ .*\} |;)\s *(\/\/ .*)?$ / ){
584
+ dbg_info(" remove following body of multiline def" );
585
+ my $last_line = $line ;
586
+ $line = $lines [$line_idx ];
587
+ $line_idx ++;
588
+ while ( $line =~ m / ^\s *[:,] \s +[\w <>] +\( .*?\) / ){
589
+ dbg_info(" member initializing list" );
590
+ $line = $lines [$line_idx ];
591
+ $line_idx ++;
592
+ }
593
+ my $nesting_index = 1;
594
+ if ( $line =~ m / ^\s *\{ $ / ){
595
+ while ($line_idx < $line_count ){
596
+ $line = $lines [$line_idx ];
597
+ $line_idx ++;
598
+ $nesting_index += $line =~ tr / \{// ;
599
+ $nesting_index -= $line =~ tr / \}// ;
600
+ if ($nesting_index == 0){
601
+ last ;
602
+ }
603
+ }
604
+ }
605
+ # add missing semi column
606
+ my $dummy = pop (@output );
607
+ push @output , dbg(" MLT" )." $last_line ;\n " ;
608
+ }
609
+ }
610
+ else
611
+ {
612
+ next ;
613
+ }
599
614
}
600
615
elsif ( $line =~ m / ^[^()] +\( [^()] *([^()]*\( [^()]*\) [^()]*)*[^)] *$ / ){
601
616
dbg_info(" Mulitline detected" );
0 commit comments