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

Diff of /trunk/pg/lib/Parser/BOP/equality.pm

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

Revision 5066 Revision 5067
57 my ($self,$precedence,$showparens,$position,$outerRight) = @_; 57 my ($self,$precedence,$showparens,$position,$outerRight) = @_;
58 my $string; my $bop = $self->{def}; 58 my $string; my $bop = $self->{def};
59 $position = '' unless defined($position); 59 $position = '' unless defined($position);
60 $showparens = '' unless defined($showparens); 60 $showparens = '' unless defined($showparens);
61 my $extraParens = $self->{equation}{context}->flag('showExtraParens'); 61 my $extraParens = $self->{equation}{context}->flag('showExtraParens');
62 my $addparens = 62 my $addparens =
63 defined($precedence) && 63 defined($precedence) &&
64 ($precedence > $bop->{precedence} || ($precedence == $bop->{precedence} && 64 ($precedence > $bop->{precedence} || ($precedence == $bop->{precedence} &&
65 ($bop->{associativity} eq 'right' || $showparens eq 'same'))); 65 ($bop->{associativity} eq 'right' || $showparens eq 'same')));
66 $outerRight = !$addparens && ($outerRight || $position eq 'right'); 66 $outerRight = !$addparens && ($outerRight || $position eq 'right');
67 67
91 91
92 $TeX = '\left('.$TeX.'\right)' if ($addparens); 92 $TeX = '\left('.$TeX.'\right)' if ($addparens);
93 return $TeX; 93 return $TeX;
94} 94}
95 95
96sub perl {
97 my $self= shift;
98 my $bop = $self->{def};
99 return
100 "(" .
101 $self->{lop}->perl(1).
102 " ".($bop->{perl} || $bop->{string})." ".
103 $self->{rop}->perl(2) .
104 " ? 1 : 0)";
105}
106
107
96# 108#
97# Add/Remove the equality operator to/from a context 109# Add/Remove the equality operator to/from a context
98# 110#
99sub Allow { 111sub Allow {
100 my $self = shift || "Value"; my $context = shift || $self->context; 112 my $self = shift || "Value"; my $context = shift || $self->context;

Legend:
Removed from v.5066  
changed lines
  Added in v.5067

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9