From 12d8443b2c87b3744c2563b0c25c44f8350df006 Mon Sep 17 00:00:00 2001 From: pawelk Date: Wed, 30 Apr 2008 10:16:33 +0000 Subject: [PATCH] Naproawiono dgc - teraz obsluguje tez komenatrze w linii z regula. git-svn-id: svn://atos.wmid.amu.edu.pl/utt@34 e293616e-ec6a-49c2-aa92-f4a8b91c5d16 --- app/src/dgp/dgc | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) 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"; } }