Sign in to PrePAN

CSS::Parser::Regexp a regexp-based CSS parser with at-rule support



use CSS::Parser::Regexp;
use Data::Dumper;

$\ = "\n";

my $css = <<CSS
.someclass {
    color: limegreen;
    font-size: 12pt;

my $p = CSS::Parser::Regexp->new;


print Dumper($p->rules);

print Dumper($p->to_tree);

print $p->stringify;


A regexp-based CSS parser with at-rule support

Key features:

  • only core dependencies
  • support for nested at-rules
  • tree and list structure output
  • stringification (and as a consequence, de-obfuscation)
  • tested against bootstrap.css, normalize.css, pure.css

I'd welcome feedback and comments. I'm especially interested to know if this group feels it's good enough to upload to CPAN, and if there is a better name I should use (see briandfoy's comment here


I find the name appropriate. So somebody else has room to create a CSS::Parser::Marpa or so. And a fictional CSS::Parser could act as a frontend module for all this modules.
I think it's OK to upload to CPAN as it is. You can decide the name but I tend to find that long names become something of a typing burden after a while so I usually end up shortening them to things like Trans::Table or Trav::Dir or something like that.

Please sign up to post a review.