Acme-ButFirst

 view release on metacpan or  search on metacpan

lib/Acme/ButFirst.pm  view on Meta::CPAN

			(?> [^{}]+ )		# Non-curlies no backtracking.
			|
			(??{ $block })		# An embedded block
		)*
	}					# Close-curly
}x;

sub _butfirstify {

	# Continue to re-write our code until no more butfirst
	# sections exist.

	# We enclose each pair of blocks transposed inside their
	# own block.  This allows chained but-firsts and
	# butfirst modifiers on loops to work 'correctly'.

	1 while s{ ($block) \s* but \s* first \s* ($block) }
                 {{$2\n$1}}gxs;

};



( run in 0.874 second using v1.01-cache-2.11-cpan-39bf76dae61 )