annotate Lib/IMPL/Text/Parser/Chunk.pm @ 96:4c55aed00ff2

Minor changes
author wizard
date Fri, 30 Apr 2010 15:03:38 +0400
parents 16ada169ca75
children 4267a2ac3d46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
1 package IMPL::Text::Parser::Chunk;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
5 use base qw(IMPL::Object IMPL::Object::Autofill);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
6
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
7 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
8 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
10 use constant {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
11 OP_REGEXP => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
12 OP_STRING => 2,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
13 OP_REFERENCE => 3,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
14 OP_CHUNK => 4,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
15 OP_SWITCH => 5,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
16 OP_REPEAT => 7
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
17 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
18
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
19 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
20 public _direct property chunkName => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
21 public _direct property opStream => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
22 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
23
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
24 sub Regexp {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
25 my ($this,$rx) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
27 if (ref $rx eq 'Regexp') {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
28
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
29 } elsif (not ref $rx) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
30 $rx = q/$rx/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
31 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
32 die new IMPL::InvalidArgumentException('A regular expression required');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
33 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
34
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
35 push @{$this->{$opStream}}, [OP_REGEXP, $rx];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
36 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
37
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
38 sub String {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
39 my ($this,$str) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
41 die new IMPL::InvalidArgumentException("A simple value is required") if ref $str;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
43 push @{$this->{$opStream}}, [OP_STRING, $str];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
44 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
45
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
46 sub Reference {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
47 my ($this,$ref) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
48
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
49 die new IMPL::InvalidArgumentException("A simple value is reqiured") if ref $ref;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
50
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
51 push @{$this->{$opStream}}, [OP_REFERENCE, $ref];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
52 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
53
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
54 sub Chunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
55 my ($this,$chunk) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
56
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
57 die new IMPL::InvalidArgumentException unless UNIVERSAL::isa($chunk,'IMPL::Text::Parser::Chunk');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
58
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
59 push @{$this->{$opStream}}, [OP_CHUNK, $chunk];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
60 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
61
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
62 sub Switch {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
63 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
64
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
65 push @{$this->{$opStream}}, [OP_SWITCH, @_];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
66 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
67
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
68 sub Repeat {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
69 my ($this,$chunk,$min,$max) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
70
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
71 die new IMPL::InvalidArgumentException unless UNIVERSAL::isa($chunk,'IMPL::Text::Parser::Chunk');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
72
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
73 push @{$this->{$opStream}}, [OP_REPEAT, $chunk, $min, $max ];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
74 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
75
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
76 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
77
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
78 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
79
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
80 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
81
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
82 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
83 Именованный поток операций
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
84
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
85 =head1 MEMBERS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
86
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
87 =level
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
88
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
89 =item C<<$obj->>>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
90
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
91 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
92
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
93 =cut