line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JavaScript::Beautifier; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
103175
|
use warnings; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
50
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
37
|
|
5
|
2
|
|
|
2
|
|
600
|
use JavaScript::Packer1 qw/js_packer/; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
115
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:FAYLAND'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
12
|
use base 'Exporter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
109
|
|
11
|
2
|
|
|
2
|
|
10
|
use vars qw/@EXPORT_OK/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
5497
|
|
12
|
|
|
|
|
|
|
@EXPORT_OK = qw/js_beautify/; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ( @input, @output, @modes ); |
15
|
|
|
|
|
|
|
my ( $token_text, $last_type, $last_text, $last_last_text, $last_word, $current_mode, $indent_string, $parser_pos, $in_case, $prefix, $token_type, $do_block_just_closed, $var_line, $var_line_tainted, $if_line_flag, $wanted_newline, $just_added_newline ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @whitespace = split('', "\n\r\t "); |
18
|
|
|
|
|
|
|
my @wordchar = split('', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'); |
19
|
|
|
|
|
|
|
my @digits = split('', '0123456789'); |
20
|
|
|
|
|
|
|
# ') { |
|
|
|
100
|
|
|
|
|
679
|
6
|
|
|
|
|
8
|
$parser_pos += 2; |
680
|
6
|
50
|
|
|
|
12
|
if ($wanted_newline) { |
681
|
6
|
|
|
|
|
9
|
print_newline(); |
682
|
|
|
|
|
|
|
} |
683
|
6
|
|
|
|
|
14
|
return ['-->', 'TK_COMMENT']; |
684
|
|
|
|
|
|
|
} |
685
|
|
|
|
|
|
|
|
686
|
484
|
100
|
|
|
|
713
|
if ( grep { $c eq $_ } @punct ) { |
|
19844
|
|
|
|
|
24752
|
|
687
|
434
|
|
66
|
|
|
866
|
while ( $parser_pos < scalar @input && (grep { $c . $input[$parser_pos] eq $_ } @punct) ) { |
|
19680
|
|
|
|
|
28266
|
|
688
|
46
|
|
|
|
|
73
|
$c .= $input[$parser_pos]; |
689
|
46
|
|
|
|
|
51
|
$parser_pos++; |
690
|
46
|
50
|
|
|
|
113
|
last if ( $parser_pos >= scalar @input ); |
691
|
|
|
|
|
|
|
} |
692
|
434
|
|
|
|
|
938
|
return [$c, 'TK_OPERATOR']; |
693
|
|
|
|
|
|
|
} |
694
|
50
|
|
|
|
|
93
|
return [$c, 'TK_UNKNOWN']; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
1; |
698
|
|
|
|
|
|
|
__END__ |