# HG changeset patch
# User Sergey
# Date 1255614729 -14400
# Node ID c529d386d80e8e620bf8c4346ed23ba0178cb290
# Parent 9dd67fa91ee319891c8fbfcad69550c348fb7c7a
Text services in progress
diff -r 9dd67fa91ee3 -r c529d386d80e Lib/IMPL/Text/Parser/Builder.pm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/Text/Parser/Builder.pm Thu Oct 15 17:52:09 2009 +0400
@@ -0,0 +1,7 @@
+package IMPL::Text::Parser::Builder;
+use strict;
+use warnings;
+
+
+
+1;
diff -r 9dd67fa91ee3 -r c529d386d80e Lib/IMPL/Text/Parser/Chunk.pm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/Text/Parser/Chunk.pm Thu Oct 15 17:52:09 2009 +0400
@@ -0,0 +1,100 @@
+package IMPL::Text::Parser::Chunk;
+use strict;
+use warnings;
+
+use base qw(IMPL::Object);
+
+use IMPL::Class::Property;
+use IMPL::Class::Property::Direct;
+
+use constant {
+ OP_REGEXP => 1,
+ OP_STRING => 2,
+ OP_REFERENCE => 3,
+ OP_CHUNK => 4,
+ OP_THROW => 5,
+ OP_TRYCATCH => 6
+};
+
+BEGIN {
+ public _direct property chunkName => prop_get;
+ public _direct property opStream => prop_get;
+}
+
+sub Regexp {
+ my ($this,$rx) = @_;
+
+ if (ref $rx eq 'Regexp') {
+
+ } elsif (not ref $rx) {
+ $rx = q/$rx/;
+ } else {
+ die new IMPL::InvalidArgumentException('A regular expression required');
+ }
+
+ push @{$this->{$opStream}}, [OP_REGEXP, $rx];
+}
+
+sub String {
+ my ($this,$str) = @_;
+
+ die new IMPL::InvalidArgumentException("A simple value is required") if ref $str;
+
+ push @{$this->{$opStream}}, [OP_STRING, $str];
+}
+
+sub Reference {
+ my ($this,$ref) = @_;
+
+ die new IMPL::InvalidArgumentException("A simple value is reqiured") if ref $ref;
+
+ push @{$this->{$opStream}}, [OP_REFERENCE, $ref];
+}
+
+sub Chunk {
+ my ($this,$chunk) = @_;
+
+ die new IMPL::InvalidArgumentException unless UNIVERSAL::isa($chunk,'IMPL::Text::Parser::Chunk');
+
+ push @{$this->{$opStream}}, [OP_CHUNK, $chunk];
+}
+
+sub Throw {
+ my ($this, $msg) = @_;
+
+ push @{$this->{$opStream}}, [OP_THROW, $msg];
+}
+
+sub TryCatch {
+ my ($this,$chunkTry,$chunkCatch) = @_;
+
+ push @{$this->{$opStream}}, [OP_TRYCATCH, $chunkTry, $chunkCatch];
+}
+
+sub compile {
+ my ($this) = @_;
+
+ my $text = '';
+
+ if ($this->{$opStream}) {
+ foreach my $op (@{$this->{$opStream}}) {
+ my $code = shift @$op;
+
+ if ($code == OP_REGEXP) {
+
+ } elsif ($code == OP_STRING) {
+
+ } elsif ($code == OP_REFERENCE) {
+
+ } elsif ($code == OP_CHUNK) {
+
+ } elsif ($code == OP_THROW) {
+
+ } elsif ($code == OP_TRYCATCH) {
+
+ }
+ }
+ }
+}
+
+1;
diff -r 9dd67fa91ee3 -r c529d386d80e Lib/IMPL/Text/Schema.pm
--- a/Lib/IMPL/Text/Schema.pm Tue Oct 13 17:51:25 2009 +0400
+++ b/Lib/IMPL/Text/Schema.pm Thu Oct 15 17:52:09 2009 +0400
@@ -25,11 +25,36 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
=head1 DESCRIPTION
@@ -44,7 +69,7 @@
Допускаются следующие операторы
1. Повтор
-2.
+2. Ветвление
=head1 METHODS
@@ -56,5 +81,7 @@
=back
+=head1 INTERNALS
+
=cut