diff --git a/app/src/dgp/dgc b/app/src/dgp/dgc index a1f2545..896b3fd 100755 --- a/app/src/dgp/dgc +++ b/app/src/dgp/dgc @@ -130,27 +130,30 @@ else { while() { - if(/^\s*AGR\s+(\S+)\s+(\S+)\s*$/) + s/#.*//; + s/^\s+//; + s/\s+$//; + if(/^AGR\s+(\S+)\s+(\S+)$/) { push @{$agr{$1}}, $2; } - elsif(/^\s*GOV\s+(\S+)\s+(\S+)\s*$/) + elsif(/^GOV\s+(\S+)\s+(\S+)$/) { push @{$gov{$1}}, attr::parse($2); } - elsif(/^\s*ROLE\s+\S+\s*$/) + elsif(/^ROLE\s+\S+$/) { $roles{$_}=1; - print OUTPUT; + print OUTPUT "$_\n"; } - elsif(/^\s*SGL\s+\S+\s*$/) + elsif(/^SGL\s+\S+$/) { ++$nsgl; - print OUTPUT; + print OUTPUT "$_\n"; } - elsif(/^\s*REQ\s+(\S+)\s+(\S+)\s*$/) + elsif(/^REQ\s+(\S+)\s+(\S+)$/) { - print OUTPUT "#$_"; + print OUTPUT "#$_\n"; my $cat = attr::parse $1; for my $atomcat (keys %cats) { @@ -161,19 +164,19 @@ while() } } } - elsif(/^\s*LEFT\s+\S+\s*$/) + elsif(/^LEFT\s+\S+$/) { ++$nleft; - print OUTPUT; + print OUTPUT "$_\n"; } - elsif(/^\s*RIGHT\s+\S+\s*$/) + elsif(/^RIGHT\s+\S+$/) { ++$nright; - print OUTPUT; + print OUTPUT "$_\n"; } - elsif(my ($hs,$ds,$r) = /^\s*LINK\s+($cats_re)\s+($cats_re)\s+(\S+)\s*$/) + elsif(my ($hs,$ds,$r) = /^LINK\s+($cats_re)\s+($cats_re)\s+(\S+)$/) { - print OUTPUT "#$_"; + print OUTPUT "#$_\n"; for my $h ($hs =~ /$attr::cat_re/g) { for my $d ($ds =~ /$attr::cat_re/g) @@ -182,10 +185,12 @@ while() } } } - - else + elsif(/^$/) { + # pomijamy puste linie oraz komentarze + } + else { - print OUTPUT; + print STDERR "Illegal format: $_\n"; } }