# -*- cperl -*-
# ABSTRACT: LaTeX relation object


use strict;
use warnings;
package SpeL::Object::Relation;

use SpeL::Object::RelOperator;
use SpeL::Object::Expression;

use parent 'Exporter';
use Carp;

use Data::Dumper;



sub read {
  my $self = shift;
  my ( $level, $separator ) = @_;

  return 
    ( exists $self->{Left} ? $self->{Left}->read( $level + 1 ) : '' )
    . ' ' .
    ( exists $self->{RelationChain} ?
      join( ' ', map { $_->{RelOperator}->read( $level + 1 ) .
			 ( exists $_->{Right} ?
			   ' ' . $_->{Right}->read( $level + 1 ) : '' ) }
	    @{$self->{RelationChain}} ) : '' ) .
    ( defined $separator ? $separator : '' );
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

SpeL::Object::Relation - LaTeX relation object

=head1 VERSION

version 20240619.1728

=head1 METHODS

=head2 new()

We keep the default method, as the object is generated by the parser.

=head2 read( level )

returns a string with the spoken version of the node

=over 4

=item level: parsing level

=item separator: separator to use when reading the parts of the relation

=back

=head1 SYNOPSYS

Represents a LaTeX mathelement

=head1 AUTHOR

Walter Daems <wdaems@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2024 by Walter Daems.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007

=head1 CONTRIBUTOR

=for stopwords Paul Levrie

Paul Levrie

=cut
