Gene Sullivan > YAPE-Regex-4.00 > YAPE::Regex

Download:
YAPE-Regex-4.00.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  4
Open  1
View/Report Bugs
Module Version: 4.00   Source  

NAME ^

YAPE::Regex - Yet Another Parser/Extractor for Regular Expressions

VERSION ^

This document refers to YAPE::Regex version 4.00.

SYNOPSIS ^

  use YAPE::Regex;
  use strict;
  
  my $regex = qr/reg(ular\s+)?exp?(ression)?/i;
  my $parser = YAPE::Regex->new($regex);
  
  # here is the tokenizing part
  while (my $chunk = $parser->next) {
    # ...
  }

YAPE MODULES ^

The YAPE hierarchy of modules is an attempt at a unified means of parsing and extracting content. It attempts to maintain a generic interface, to promote simplicity and reusability. The API is powerful, yet simple. The modules do tokenization (which can be intercepted) and build trees, so that extraction of specific nodes is doable.

DESCRIPTION ^

This module is yet another (?) parser and tree-builder for Perl regular expressions. It builds a tree out of a regex, but at the moment, the extent of the extraction tool for the tree is quite limited (see "Extracting Sections"). However, the tree can be useful to extension modules.

USAGE ^

In addition to the base class, YAPE::Regex, there is the auxiliary class YAPE::Regex::Element (common to all YAPE base classes) that holds the individual nodes' classes. There is documentation for the node classes in that module's documentation.

Methods for YAPE::Regex

Extracting Sections

While extraction of nodes is the goal of the YAPE modules, the author is at a loss for words as to what needs to be extracted from a regex. At the current time, all the extract method does is allow you access to the regex's set of back-references:

  my $extor = $parser->extract;
  while (my $backref = $extor->()) {
    # ...
  }

japhy is very open to suggestions as to the approach to node extraction (in how the API should look, in addition to what should be proffered). Preliminary ideas include extraction keywords like the output of -Dr (or the re module's debug option).

EXTENSIONS ^

TO DO ^

This is a listing of things to add to future versions of this module.

API

BUGS ^

Following is a list of known or reported bugs.

Pending

SEE ALSO ^

The YAPE::Regex::Element documentation, for information on the node classes. Also, Text::Balanced, Damian Conway's excellent module, used for the matching of (?{ ... }) and (??{ ... }) blocks.

AUTHOR ^

The original author is Jeff "japhy" Pinyan (CPAN ID: PINYAN).

Gene Sullivan (gsullivan@cpan.org) is a co-maintainer.

LICENSE ^

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

syntax highlighting: