X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=lib%2FNet%2FZ3950%2FPQF.pm;fp=lib%2FNet%2FZ3950%2FPQF.pm;h=eb1a8fec6eb484bb05e5134a19cf004ffb7939da;hb=3401abe45a0a32a9ce67cfb6bcd74318daf36980;hp=eff7aab7605a85c0f3cabcb860a74196b4497fbc;hpb=99c1266d6be66e0af4b74331d403d3be330a2b05;p=perl-pqf.git diff --git a/lib/Net/Z3950/PQF.pm b/lib/Net/Z3950/PQF.pm index eff7aab..eb1a8fe 100644 --- a/lib/Net/Z3950/PQF.pm +++ b/lib/Net/Z3950/PQF.pm @@ -1,4 +1,4 @@ -# $Id: PQF.pm,v 1.5 2004-12-20 09:22:12 mike Exp $ +# $Id: PQF.pm,v 1.6 2004-12-20 09:46:58 mike Exp $ package Net::Z3950::PQF; @@ -119,7 +119,7 @@ sub _parse { # backslash-quoted embedded double quotes. $this->{text} =~ s/^\s+//; if ($this->{text} =~ s/^"(.*?)"//) { - return $this->_term($1, $attrhash); + return $this->_leaf('term', $1, $attrhash); } my $word = $this->_word(); @@ -154,10 +154,13 @@ sub _parse { } elsif ($word eq '@prox') { return $this->_error("proximity not yet implemented"); + } elsif ($word eq '@set') { + $word = $this->_word(); + return $this->_leaf('rset', $word, $attrhash); } # It must be a bareword - return $this->_term($word, $attrhash); + return $this->_leaf('term', $word, $attrhash); } @@ -182,9 +185,9 @@ sub _error { # PRIVATE to _parse(); -sub _term { +sub _leaf { my $this = shift(); - my($word, $attrhash) = @_; + my($type, $word, $attrhash) = @_; my @attrs; foreach my $key (sort keys %$attrhash) { @@ -192,7 +195,13 @@ sub _term { push @attrs, [ $attrset, $type, $attrhash->{$key} ]; } - return new Net::Z3950::PQF::TermNode($word, @attrs); + if ($type eq 'term') { + return new Net::Z3950::PQF::TermNode($word, @attrs); + } elsif ($type eq 'rset') { + return new Net::Z3950::PQF::RsetNode($word, @attrs); + } else { + die "_leaf() called with type='$type' (should be 'term' or 'rset')"; + } }