}
}
+ # keep 'bareword-' together, but only if there is no space between
+ # the word and dash. Do not keep together if there is a space.
+ # example 'use perl6-alpha'
+ elsif ( $type eq 'w' && $next_type eq 'm' ) { $bond_str = NO_BREAK }
+
# Breaking before a ? before a quote can cause trouble if
# they are not separated by a blank.
# Example: a syntax error occurs if you break before the ? here
# treat bare word followed by open paren like qw(
if ( $next_nonblank_token eq '(' ) {
+
+ # TODO: This works, but if $tok eq 'prototype' then we
+ # should really parse the prototype separately here so
+ # that we have its properties. This requires updating
+ # do_scan_sub to keep the subname available until we
+ # see the opening brace. So something like
+ # if ($tok eq 'prototype' ) {scan_prototype()}
+ # else {
+
+ # All other attribute lists must be parsed as quotes
+ # (see 'signatures.t' for good examples)
$in_quote = $quote_items{'q'};
$allowed_quote_modifiers = $quote_modifiers{'q'};
$type = 'q';
=over 4
+=item b<Prevent syntax error by breaking dashed package names>
+
+In stress testing perltidy with the -extrude option, the following test snippet
+
+ use perl6-alpha;
+
+was broken into sepate lines
+
+ use
+ perl6
+ -
+ alpha
+ ;
+
+A rule was added to prevent breaking around a dash separating two barewords.
+Rerunning gives
+
+ use
+ perl6-alpha
+ ;
=item b<Prevent syntax error by breaking dashed barewords>
-In random testing with the following test snippet with the -extrude option
+In stress testing perltidy with the -extrude option, using the following test snippet
my %var;
{
$var{m} = 1;
}
-a syntax error was created in the resulting file when newlines were placed
+a syntax error was created when newlines were placed
before or after the dashes. It is necessary to always keep a dash on the same
line with its surrounding tokens. A rule was added to do this. The new
'extruded' result for the above snippet is: