Fiction-XML / perl / modules / XML-Grammar-Fiction / lib / XML / Grammar / FictionBase /

package XML::Grammar::FictionBase::Event;

=head1 NAME

XML::Grammar::FictionBase::Event - a parser event.

B<For internal use only>.


use Mouse;

use XML::Grammar::Fiction::FromProto::Nodes;

has 'type' => (isa => "Str", is => "ro");
has 'tag' => (isa => "Maybe[Str]", is => "ro", predicate => '_has_tag',);
has 'elem' => (isa => "Maybe[XML::Grammar::Fiction::FromProto::Node]", is => "ro");
has 'tag_elem' => (isa => "Maybe[XML::Grammar::Fiction::FromProto::Node]", is => "ro");

sub is_tag_of_name
    my ($self, $name) = @_;

    return ($self->_has_tag() && ($self->tag() eq $name));

sub is_open
    my $self = shift;

    return ($self->type() eq "open");

sub is_open_or_close
    my $self = shift;

    return (($self->type() eq "open") || ($self->type() eq "close"));


=head2 $event->is_tag_of_name($name)

Determines if the $event is a tag and of name $name.

=head2 $event->is_open()

Returns true if the $event 's type is "open".

=head2 $event->is_open_or_close()

Returns true if the $event 's type is either "open" or "close".

=head2 $self->meta()

Leftover from Mouse.

=head1 AUTHOR

Shlomi Fish, L<>.

=head1 BUGS

Please report any bugs or feature requests to
C<bug-xml-grammar-fiction at>, or through the web interface at
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.



Copyright 2007 Shlomi Fish, all rights reserved.

This program is released under the following license: MIT X11.