Regexp::Parser::Handlers

Regexp::Parser::Handlers is a Perl module with handlers for Perl 5 regexes.
Download

Regexp::Parser::Handlers Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jeff Pinyan
  • Publisher web site:
  • http://search.cpan.org/~pinyan/YAPE-Regex-3.03/Regex/Element.pm

Regexp::Parser::Handlers Tags


Regexp::Parser::Handlers Description

Regexp::Parser::Handlers is a Perl module with handlers for Perl 5 regexes. Regexp::Parser::Handlers is a Perl module with handlers for Perl 5 regexes.This module holds the init() method for the Regexp::Parser class, which installs all the handlers for standard Perl 5 regexes. This documentation contains a sub-classing tutorial.SUB-CLASSINGI will present two example sub-classes, Regexp::NoCode, and Regexp::AndBranch.Parser InternalsThe parser object is a hash reference with the following keys:regexA reference to the original string representation of the regex.lenThe length of the original string representation of the regex.treeDuring the first pass, tree is undef, which instructs the object() method not to actually create any objects. Afterwards, it is an array reference of (node) objects.stackInitially an array reference, used to store the tree as a new scope is entered and then exited. The general concept is: if (into_scope) { push STACK, TREE; TREE = CURRENT->DATA; } if (outof_scope) { TREE = pop STACK; }After the tree has been created, this key is deleted; this gives the code a way to be sure compilation was successful.maxparThe highest number of parentheses. It will end up being identical to nparen, but it is incremented during the initial pass, so that on the second pass (the tree-building), it can distinguish back-references from octal escapes. (The source code to Perl's regex compiler does the same thing.)nparenThe number of OPENs (capturing groups) in the regex.capturesAn array reference to the 'open' nodes.flagsAn array reference of flag values. When a scope is entered, the top value is copied and pushed onto the stack. When a scope is left, the top value is popped and discarded.It is important to do this copy-and-push before you do any flag-parsing, if you're adding a handle that might parse flags, because you do not want to accidentally affect the previous scope's flag values.Here is example code from the handler for (?ismx) and (?ismx:...): # (?i:...) Requirements: · Perl


Regexp::Parser::Handlers Related Software