line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JavaScript::Beautifier; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
80730
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
113
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:FAYLAND'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
14
|
use base 'Exporter'; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
201
|
|
10
|
2
|
|
|
2
|
|
12
|
use vars qw/@EXPORT_OK/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8628
|
|
11
|
|
|
|
|
|
|
@EXPORT_OK = qw/js_beautify/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ( @input, @output, @modes ); |
14
|
|
|
|
|
|
|
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 ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @whitespace = split('', "\n\r\t "); |
17
|
|
|
|
|
|
|
my @wordchar = split('', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'); |
18
|
|
|
|
|
|
|
my @digits = split('', '0123456789'); |
19
|
|
|
|
|
|
|
# ') { |
|
|
|
100
|
|
|
|
|
676
|
6
|
|
|
|
|
8
|
$parser_pos += 2; |
677
|
6
|
50
|
|
|
|
20
|
if ($wanted_newline) { |
678
|
6
|
|
|
|
|
13
|
print_newline(); |
679
|
|
|
|
|
|
|
} |
680
|
6
|
|
|
|
|
23
|
return ['-->', 'TK_COMMENT']; |
681
|
|
|
|
|
|
|
} |
682
|
|
|
|
|
|
|
|
683
|
475
|
100
|
|
|
|
886
|
if ( grep { $c eq $_ } @punct ) { |
|
19475
|
|
|
|
|
38925
|
|
684
|
430
|
|
66
|
|
|
1415
|
while ( $parser_pos < scalar @input && (grep { $c . $input[$parser_pos] eq $_ } @punct) ) { |
|
19516
|
|
|
|
|
44088
|
|
685
|
46
|
|
|
|
|
100
|
$c .= $input[$parser_pos]; |
686
|
46
|
|
|
|
|
68
|
$parser_pos++; |
687
|
46
|
50
|
|
|
|
232
|
last if ( $parser_pos >= scalar @input ); |
688
|
|
|
|
|
|
|
} |
689
|
430
|
|
|
|
|
1785
|
return [$c, 'TK_OPERATOR']; |
690
|
|
|
|
|
|
|
} |
691
|
45
|
|
|
|
|
168
|
return [$c, 'TK_UNKNOWN']; |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
1; |
695
|
|
|
|
|
|
|
__END__ |