You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/09/17 22:22:43 UTC
[lucy-commits] svn commit: r1172059 -
/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm
Author: marvin
Date: Sat Sep 17 20:22:43 2011
New Revision: 1172059
URL: http://svn.apache.org/viewvc?rev=1172059&view=rev
Log:
Change Clownfish::Parser from is-a Parse::RecDescent to has-a.
Modified:
incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm
Modified: incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm?rev=1172059&r1=1172058&r2=1172059&view=diff
==============================================================================
--- incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm (original)
+++ incubator/lucy/branches/clownfish_lemon/clownfish/lib/Clownfish/Parser.pm Sat Sep 17 20:22:43 2011
@@ -17,7 +17,6 @@ use strict;
use warnings;
package Clownfish::Parser;
-use base qw( Parse::RecDescent );
use Clownfish::Parcel;
use Clownfish::Type;
@@ -29,6 +28,7 @@ use Clownfish::Class;
use Clownfish::CBlock;
use Clownfish::File;
use Carp;
+use Parse::RecDescent;
our $grammar = <<'END_GRAMMAR';
@@ -314,7 +314,28 @@ eofile:
END_GRAMMAR
-sub new { return shift->SUPER::new($grammar) }
+our %inner_parser;
+
+sub new {
+ my $self = bless {}, __PACKAGE__;
+ $inner_parser{$self} = Parse::RecDescent->new($grammar);
+ return $self;
+}
+
+sub DESTROY {
+ my $self = shift;
+ delete $inner_parser{$self};
+}
+
+our $AUTOLOAD;
+
+sub AUTOLOAD {
+ my $self = shift;
+ my $inner_parser = $inner_parser{$self};
+ my ($meth) = $AUTOLOAD =~ /Clownfish::Parser::(\w+)/;
+ #die "No method '$AUTOLOAD'" unless $inner_parser->can($AUTOLOAD);
+ return $inner_parser->$meth(@_);
+}
sub strip_plain_comments {
my ( $self, $text ) = @_;