[Bast-commits] r6140 -
Devel-Declare/1.000/trunk/lib/Devel/Declare/Context
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed May 6 00:23:24 GMT 2009
Author: rafl
Date: 2009-05-06 00:23:24 +0000 (Wed, 06 May 2009)
New Revision: 6140
Modified:
Devel-Declare/1.000/trunk/lib/Devel/Declare/Context/Simple.pm
Log:
Implement skip_declarator in terms of scan_word in Context::Simple.
Modified: Devel-Declare/1.000/trunk/lib/Devel/Declare/Context/Simple.pm
===================================================================
--- Devel-Declare/1.000/trunk/lib/Devel/Declare/Context/Simple.pm 2009-05-05 20:36:03 UTC (rev 6139)
+++ Devel-Declare/1.000/trunk/lib/Devel/Declare/Context/Simple.pm 2009-05-06 00:23:24 UTC (rev 6140)
@@ -1,9 +1,10 @@
package Devel::Declare::Context::Simple;
+use strict;
+use warnings;
use Devel::Declare ();
use B::Hooks::EndOfScope;
-use strict;
-use warnings;
+use Carp qw/confess/;
sub new {
my $class = shift;
@@ -33,7 +34,17 @@
sub skip_declarator {
my $self = shift;
- $self->inc_offset(Devel::Declare::toke_move_past_token($self->offset));
+ my $decl = $self->declarator;
+ my $len = Devel::Declare::toke_scan_word($self->offset, 0);
+ confess "Couldn't find declarator '$decl'"
+ unless $len;
+
+ my $linestr = $self->get_linestr;
+ my $name = substr($linestr, $self->offset, $len);
+ confess "Expected declarator '$decl', got '${name}'"
+ unless $name eq $decl;
+
+ $self->inc_offset($len);
}
sub skipspace {
More information about the Bast-commits
mailing list