annotate Lib/IMPL/Text/Parser/Chunk.pm @ 278:4ddb27ff4a0b

core refactoring
author cin
date Mon, 04 Feb 2013 02:10:37 +0400
parents d1676be8afcc
children
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
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 49
diff changeset
5 use parent qw(IMPL::Object IMPL::Object::Autofill);
49
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
9 use constant {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
10 OP_REGEXP => 1,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
11 OP_STRING => 2,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
12 OP_REFERENCE => 3,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
13 OP_CHUNK => 4,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
14 OP_SWITCH => 5,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
15 OP_REPEAT => 7
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
16 };
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 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
19 public _direct property chunkName => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
20 public _direct property opStream => prop_get;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
21 }
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 sub Regexp {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
24 my ($this,$rx) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
25
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
26 if (ref $rx eq 'Regexp') {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
27
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
28 } elsif (not ref $rx) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
29 $rx = q/$rx/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
30 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
31 die new IMPL::InvalidArgumentException('A regular expression required');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
32 }
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 push @{$this->{$opStream}}, [OP_REGEXP, $rx];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
35 }
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 sub String {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
38 my ($this,$str) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
39
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
40 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
41
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
42 push @{$this->{$opStream}}, [OP_STRING, $str];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
43 }
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 sub Reference {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
46 my ($this,$ref) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
47
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
48 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
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
50 push @{$this->{$opStream}}, [OP_REFERENCE, $ref];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
51 }
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 sub Chunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
54 my ($this,$chunk) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
55
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
56 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
57
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
58 push @{$this->{$opStream}}, [OP_CHUNK, $chunk];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
59 }
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 sub Switch {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
62 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
63
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
64 push @{$this->{$opStream}}, [OP_SWITCH, @_];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
65 }
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 sub Repeat {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
68 my ($this,$chunk,$min,$max) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
69
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
70 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
71
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
72 push @{$this->{$opStream}}, [OP_REPEAT, $chunk, $min, $max ];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
73 }
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 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
76
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
77 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
78
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
79 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
80
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
81 =head1 DESCRIPTION
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
82 Именованный поток операций
49
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 =head1 MEMBERS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
85
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
86 =level
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
87
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
88 =item C<<$obj->>>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
89
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
90 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
91
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 39
diff changeset
92 =cut