The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Title

Text::CaffeinatedMarkup::PullParser

Synopsis

  use Text::CaffeinatedMarkup::PullParser;

  my $parser = Text::CaffeinatedMarkup::PullParser->new( pml => 'Parse **this**' );

  my @tokens = $parser->get_all_tokens;

  # or

  while (my $token = $parser->get_next_token) {
         # ...
  }

Description

This module implements a Pull Parser for The Caffeinated Markup Language. For details on the syntax that CML implements, please see the Github wiki.

This module isn't designed to be used directly in a client, but instead used by a formatter such as Text::CaffeinatedMarkup::HTMLFormatter.

Methods

This module implements the following methods.

get_next_token

  my $token = $parser->get_next_token;

Whilst there is a token to return, this method will return it. If there are no tokens left then this will return 0 (zero).

get_all_tokens

  my @tokens   = $parser->get_all_tokens;
  my $tokens_r = $parser->get_all_tokens;
  

Returns all the tokens from the parsed document.

Please note, this uses get_next_token internally so, if you've already called get_next_token a couple of times and rhen call get_all_tokens, then get_all_tokens will return all the rest of the tokens from that point onwards and not the entire document.

See Also

The Github wiki

Author

J Gregory <jgregory@cpan.org>