[system] / trunk / pg / lib / Parser / UOP.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Parser/UOP.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2695 Revision 2696
174# than the parent operation. 174# than the parent operation.
175# Add the operator before or after the operand according to the 175# Add the operator before or after the operand according to the
176# associativity of the operator. 176# associativity of the operator.
177# 177#
178sub string { 178sub string {
179 my $self = shift; 179 my ($self,$precedence,$showparens,$position,$outerRight) = @_;
180 my $precedence = shift; my $showparens = shift;
181 my $string; my $uop = $self->{def}; 180 my $string; my $uop = $self->{def};
182 my $addparens = defined($precedence) && $precedence >= $uop->{precedence}; 181 my $addparens = defined($precedence) &&
182 ($precedence >= $uop->{precedence} || $position eq 'right' || $outerRight);
183 if ($uop->{associativity} eq "right") { 183 if ($uop->{associativity} eq "right") {
184 $string = $self->{op}->string($uop->{precedence}).$uop->{string}; 184 $string = $self->{op}->string($uop->{precedence}).$uop->{string};
185 } else { 185 } else {
186 $string = $uop->{string}.$self->{op}->string($uop->{precedence}); 186 $string = $uop->{string}.$self->{op}->string($uop->{precedence});
187 } 187 }
191 191
192# 192#
193# Produce the TeX form 193# Produce the TeX form
194# 194#
195sub TeX { 195sub TeX {
196 my $self = shift; my $precedence = shift; my $showparens = shift; 196 my ($self,$precedence,$showparens,$position,$outerRight) = @_;
197 my $TeX; my $uop = $self->{def}; 197 my $TeX; my $uop = $self->{def};
198 my $addparens = defined($precedence) && $precedence >= $uop->{precedence}; 198 my $addparens = defined($precedence) &&
199 ($precedence >= $uop->{precedence} || $position eq 'right' || $outerRight);
199 $TeX = (defined($uop->{TeX}) ? $uop->{TeX} : $uop->{string}); 200 $TeX = (defined($uop->{TeX}) ? $uop->{TeX} : $uop->{string});
200 if ($uop->{associativity} eq "right") { 201 if ($uop->{associativity} eq "right") {
201 $TeX = $self->{op}->TeX($uop->{precedence}) . $TeX; 202 $TeX = $self->{op}->TeX($uop->{precedence}) . $TeX;
202 } else { 203 } else {
203 $TeX = $TeX . $self->{op}->TeX($uop->{precedence}); 204 $TeX = $TeX . $self->{op}->TeX($uop->{precedence});

Legend:
Removed from v.2695  
changed lines
  Added in v.2696

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9