line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shishi; |
2
|
1
|
|
|
1
|
|
7469
|
use Shishi::Prototype; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
5
|
use Shishi::Node; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
5
|
use Shishi::Decision; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
6
|
1
|
|
|
1
|
|
4
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
146
|
|
7
|
|
|
|
|
|
|
@Shishi::ISA = qw( Exporter ); |
8
|
|
|
|
|
|
|
@Shishi::EXPORT_OK = qw( ACTION_FINISH ACTION_REDUCE ACTION_CODE |
9
|
|
|
|
|
|
|
ACTION_SHIFT ACTION_CONTINUE ACTION_FAIL); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Shishi::Prototype - Internal use prototype for the Shishi regex/parser |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $parser = new Shishi ("test parser"); |
18
|
|
|
|
|
|
|
$parser->start_node->add_decision( |
19
|
|
|
|
|
|
|
new Shishi::Decision(target => 'a', type => 'char', action => 4, |
20
|
|
|
|
|
|
|
next_node => Shishi::Node->new->add_decision( |
21
|
|
|
|
|
|
|
new Shishi::Decision(target => 'b', type => 'char', action => 4, |
22
|
|
|
|
|
|
|
next_node => Shishi::Node->new->add_decision( |
23
|
|
|
|
|
|
|
new Shishi::Decision(target => 'c', type => 'char', action => 0) |
24
|
|
|
|
|
|
|
)) |
25
|
|
|
|
|
|
|
)) |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
$parser->start_node->add_decision( |
28
|
|
|
|
|
|
|
new Shishi::Decision(type => 'skip', next_node => $parser->start_node, |
29
|
|
|
|
|
|
|
action => 4) |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
$parser->parse_text("babdabc"); |
32
|
|
|
|
|
|
|
if ($parser->execute()) { |
33
|
|
|
|
|
|
|
print "Successfully matched\n" |
34
|
|
|
|
|
|
|
} else { |
35
|
|
|
|
|
|
|
print "Match failed\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This is a prototype only. The real library (C) will come once |
41
|
|
|
|
|
|
|
this prototype is finalised. The interface will remain the same. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
As this is only a prototype, don't try doing anything with it yet. |
44
|
|
|
|
|
|
|
However, feel free to use Shishi applications such as |
45
|
|
|
|
|
|
|
C. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
When C itself is released, you can uninstall this module and |
48
|
|
|
|
|
|
|
install C and everything ought to work as normal. (Except |
49
|
|
|
|
|
|
|
perhaps somewhat faster.) However, since we're still firming up the |
50
|
|
|
|
|
|
|
interface with this prototype, it's best not to depend on it; hence, the |
51
|
|
|
|
|
|
|
interface is not currently documented. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Simon Cozens, C |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |