Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | package Psh::Strategy::Debug; |
2 | ||
3 | =item * C<debug> | |
4 | ||
5 | Entering "? commandline" will show information about the | |
6 | way Perl Shell processes the input | |
7 | ||
8 | This has to be beautified a lot and should not use Data::Dumper. | |
9 | ||
10 | =cut | |
11 | ||
12 | require Psh::Strategy; | |
13 | require Psh::Support::Debug; | |
14 | ||
15 | @Psh::Strategy::Debug::ISA=('Psh::Strategy'); | |
16 | ||
17 | sub new { Psh::Strategy::new(@_) } | |
18 | ||
19 | sub consumes { | |
20 | return Psh::Strategy::CONSUME_LINE; | |
21 | } | |
22 | ||
23 | sub runs_before { | |
24 | return qw(executable auto_cd built_in); | |
25 | } | |
26 | ||
27 | sub applies { | |
28 | my $fnname= ${$_[1]}; | |
29 | ||
30 | if ($fnname=~/^\?/) { | |
31 | return "debug $fnname"; | |
32 | } | |
33 | return ''; | |
34 | } | |
35 | ||
36 | sub execute { | |
37 | my $fnname= ${$_[1]}; | |
38 | my @tmp= Psh::Parser::make_tokens(substr($fnname,1),1); | |
39 | use Data::Dumper; | |
40 | print "Wordsplit:\n"; | |
41 | print Dumper(\@tmp); | |
42 | @tmp= Psh::Parser::make_tokens(substr($fnname,1)); | |
43 | print "Tokenization:\n"; | |
44 | print Psh::Support::Debug::explain_tokens(\@tmp)."\n"; | |
45 | @tmp= Psh::Parser::parse_line(substr($fnname,1)); | |
46 | print Dumper(\@tmp); | |
47 | return (1,undef); | |
48 | } | |
49 | ||
50 | 1; |