[Bast-commits] r4751 - in trunk/Devel-REPL: .
lib/Devel/REPL/Plugin/MultiLine
Sartak at dev.catalyst.perl.org
Sartak at dev.catalyst.perl.org
Tue Aug 12 22:11:14 BST 2008
Author: Sartak
Date: 2008-08-12 22:11:14 +0100 (Tue, 12 Aug 2008)
New Revision: 4751
Modified:
trunk/Devel-REPL/
trunk/Devel-REPL/lib/Devel/REPL/Plugin/MultiLine/PPI.pm
Log:
r69376 at onn: sartak | 2008-08-12 17:10:55 -0400
Improve the MultiLine::PPI plugin by checking whether adding ;; will end in PPI::Statement::Null. If not, then there must be some incomplete structure
Property changes on: trunk/Devel-REPL
___________________________________________________________________
Name: svk:merge
- 08e7d58d-de06-4458-8c15-335e402ab116:/local/Devel-REPL:69325
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80567
+ 08e7d58d-de06-4458-8c15-335e402ab116:/local/Devel-REPL:69376
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80567
Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/MultiLine/PPI.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/MultiLine/PPI.pm 2008-08-12 17:36:14 UTC (rev 4750)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/MultiLine/PPI.pm 2008-08-12 21:11:14 UTC (rev 4751)
@@ -52,15 +52,24 @@
{
my $repl = shift;
my $line = shift;
+
+ # add this so we can test whether the document ends in PPI::Statement::Null
+ $line .= "\n;;";
+
my $document = PPI::Document->new(\$line);
return 0 if !defined($document);
+ # adding ";" to a complete document adds a PPI::Statement::Null. we added a ;;
+ # so if it doesn't end in null then there's probably something that's
+ # incomplete
+ return 0 if $document->child(-1)->isa('PPI::Statement::Null');
+
# this could use more logic, such as returning 1 on s/foo/ba<Enter>
my $unfinished_structure = sub
{
my ($document, $element) = @_;
return 0 unless $element->isa('PPI::Structure');
- return 1 unless $element->start && $element->finish;
+ return 1 unless $element->finish;
return 0;
};
More information about the Bast-commits
mailing list