blob: 11cd74ad23119d331d14646b405cdea691e83e30 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
package Pod::Simple::IrssiSignalParser;
use base qw/Pod::Simple::PullParser/;
use Data::Dumper;
sub run {
my $self = shift;
my ($seen_start, $seen_end) = (0,0);
my $text_token;
Token:
while(my $token = $self->get_token()) {
#print "PRocessing token: $token\n";
if (!$seen_start && $token->is_start) {
if ($token->tag eq 'Data') {
print "Start Data token: $token\n";
$text_token = $self->get_token;
if ($text_token->is_text && $text_token->text =~ /START/) {
print "Found start!\n\n";
$seen_start = 1;
}
}
}
}
}
package main;
my $input_file = $ARGV[0] // 'Signals.pm';
my $parser = Pod::Simple::IrssiSignalParser->new;
$parser->accept_targets('irssi_signal_defs', 'irssi_signal_types');
my $tree = $parser->parse_file($input_file);
# if ($type eq 'Data' && $text =~ /START OF SIGNAL DEFINITIONS/) {
# $seen_start = 1;
# }
# if ($type eq 'Data' && $text =~ /END OF SIGNAL DEFINITIONS/) {
# $seen_end = 1;
# }
|