line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JavaScript::Beautifier; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
110712
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
38
|
|
5
|
2
|
|
|
2
|
|
728
|
use JavaScript::Packer1 qw/js_packer/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
123
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.25'; |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:FAYLAND'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
12
|
use base 'Exporter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
101
|
|
11
|
2
|
|
|
2
|
|
9
|
use vars qw/@EXPORT_OK/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
6156
|
|
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
|
|
|
|
|
16
|
$parser_pos += 2; |
680
|
6
|
50
|
|
|
|
20
|
if ($wanted_newline) { |
681
|
6
|
|
|
|
|
18
|
print_newline(); |
682
|
|
|
|
|
|
|
} |
683
|
6
|
|
|
|
|
26
|
return ['-->', 'TK_COMMENT']; |
684
|
|
|
|
|
|
|
} |
685
|
|
|
|
|
|
|
|
686
|
486
|
100
|
|
|
|
830
|
if ( grep { $c eq $_ } @punct ) { |
|
19926
|
|
|
|
|
28705
|
|
687
|
434
|
|
66
|
|
|
1109
|
while ( $parser_pos < scalar @input && (grep { $c . $input[$parser_pos] eq $_ } @punct) ) { |
|
19680
|
|
|
|
|
30790
|
|
688
|
46
|
|
|
|
|
80
|
$c .= $input[$parser_pos]; |
689
|
46
|
|
|
|
|
65
|
$parser_pos++; |
690
|
46
|
50
|
|
|
|
144
|
last if ( $parser_pos >= scalar @input ); |
691
|
|
|
|
|
|
|
} |
692
|
434
|
|
|
|
|
1107
|
return [$c, 'TK_OPERATOR']; |
693
|
|
|
|
|
|
|
} |
694
|
52
|
|
|
|
|
126
|
return [$c, 'TK_UNKNOWN']; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
1; |
698
|
|
|
|
|
|
|
__END__ |