Dallycot

 view release on metacpan or  search on metacpan

lib/Dallycot/AST.pm  view on Meta::CPAN


=item L<Decreasing|Dallycot::AST::Decreasing>

=item L<Equality|Dallycot::AST::Equality>

=item L<Increasing|Dallycot::AST::Increasing>

=item L<StrictlyDecreasing|Dallycot::AST::StrictlyDecreasing>

=item L<StrictlyIncreasing|Dallycot::AST::StrictlyIncreasing>

=back

=item L<LoopBase|Dallycot::AST::LoopBase>

The base for operations that loop through a series of options.

=over 4

=item L<All|Dallycot::AST::All>

=item L<Any|Dallycot::AST::Any>

=item L<Condition|Dallycot::AST::Condition>

=item L<PropWalk|Dallycot::AST::PropWalk>

=back

=back

=cut

# use overload '""' => sub {
#   shift->to_string
# };

our @NODE_TYPES;

=func node_types

Returns a list of Perl packages that provide AST nodes.

=cut

sub is_declarative {return}

sub node_types {
  return @NODE_TYPES if @NODE_TYPES;
  (@NODE_TYPES) = shift->_node_types;
  return @NODE_TYPES;
}

__PACKAGE__->node_types;

sub new {
  my ($class) = @_;

  $class = ref $class || $class;

  return bless [] => $class;
}

=method simplify

Simplifies the node and any child nodes.

=cut

sub simplify {
  my ($self) = @_;
  return $self;
}

=method check_for_common_mistakes

Checks for any odd expressions given their context.

Returns a list of warnings.

=cut

sub check_for_common_mistakes {
  my ($self) = @_;

  return map { $_->check_for_common_mistakes } $self->child_nodes;
}

=method to_json

Returns a Perl Hash containing the JSON-LD representation of the node and
any child nodes.

=cut

sub to_json {
  my ($self) = @_;

  croak "to_json not defined for " . ( blessed($self) || $self );
}

=method to_string

Returns a Perl string containing a pseudo-code representation of the node
and any child nodes. This string may not parse. It's intended for debugging
purposes.

=cut

sub to_string {
  my ($self) = @_;

  croak "to_string not defined for " . ( blessed($self) || $self );
}

=method execute($engine)

Executes the node using the provided engine. Returns a promise.

=cut

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.312 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )