NAME
App::Colorist::Ruleset - Helper syntax for building colorist rulesets
VERSION
version 0.150460
SYNOPSIS
ruleset {
rule qr{Starting (\S+)\.\.\.}, qw( message program );
rule qr{Finished processing (http://([\w.]+)/) \.\.\.}, qw(
message url hostname
);
}
DESCRIPTION
This defines a special syntax that may be used in ruleset configuration files for defining a ruleset.
DIRECTIVES
ruleset
ruleset {
# rules go in here ...
}
There may only be exactly one ruleset
per ruleset configuration and all "rule" directives must be placed inside it.
rule
rule qr{Starting (\S+)\.\.\.}, qw( message program );
Within a "ruleset", there may be zero or more rule
directives. Each is given a regular expression to be used to match against a single line of text. Every match starts with an implicit "^" and ends with an implicit "$", so it must match an entire line.
After the regular expression, you must include a list of color names to assign each part of the match. This list must have at least one element in it, which is used for the entire line match. There must also be one for each group of parenthesis in the regular expression.
It is perfectly acceptable to use nested matches. As of this writing, there must be a fixed number of group matches, though. If you need to match groups like (...)*
, there's no way to name them at this time, so don't do that.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.