annotate Lib/IMPL/Text/Parser/Player.pm @ 254:fb52014f6931

updated web-session creation
author sergey
date Thu, 06 Dec 2012 19:58:42 +0400
parents 4267a2ac3d46
children 4ddb27ff4a0b
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: 41
diff changeset
1 package IMPL::Text::Parser::Player;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
4
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 49
diff changeset
5 use parent qw(IMPL::Object);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
7 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
9 use IMPL::Text::Parser::Chunk;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
11 my %opCodesMap = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
12 IMPL::Text::Parser::Chunk::OP_REGEXP , &MatchRegexp ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
13 IMPL::Text::Parser::Chunk::OP_STRING , &MatchString ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
14 IMPL::Text::Parser::Chunk::OP_REFERENCE , &MatchReference ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
15 IMPL::Text::Parser::Chunk::OP_CHUNK , &PlayChunk ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
16 IMPL::Text::Parser::Chunk::OP_SWITCH , &MatchSwitch ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
17 IMPL::Text::Parser::Chunk::OP_REPEAT , &MatchRepeat
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
18 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
20 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
21 private _direct property _data => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
22 private _direct property _current => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
23 private _direct property _states => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
24 private _direct property _document => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
25
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
26 public _direct property errorLast => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
27 public _direct property Punctuation => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
28 public _direct property Delimier => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
29 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
30
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
31 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
32 my ($this,$document) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
34 $this->{$_document} = $document or die new IMPL::InvalidArgumentException("The first parameter must be a document");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
35 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
36
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
37 sub LoadString {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
38 my ($this,$string) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
39
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
40 my $rxDelim = /(\s+|[.,;!-+*~$^&|%()`@\\\/])/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
41
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
42 my $line = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
43
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
44 $this->{$_data} = [
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
45 map {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
46 $line++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
47 map {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
48 [$line,$_]
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
49 } split $rxDelim, $_
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
50 } split /\n/, $string
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
51 ]
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
52 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
53
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
54 sub Play {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
55 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
56 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
57
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
58 sub PlayChunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
59 my ($this,$chunk) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
60
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
61 my $end = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
62
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
63 my $name = $chunk->chunkName;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
64
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
65 $this->enter($name) if $name;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
67 foreach my $op ( @{$chunk->opStream} ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
68 $this->leave(0) and return $this->error("no more data") if $end;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
69
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
70 $opCodesMap{shift @$op}->(@$op) || return $this->leave(0) ;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
71 $this->moveNext or $end = 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
72 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
73
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
74 return $this->leave(1);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
75 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
76
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
77 sub MatchRegexp {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
78 my ($this,$rx) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
79
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
80 $this->{$_current}{token} =~ $rx ? ($this->data() and return 1) : return $this->error("Expected: $rx");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
81 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
82
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
83 sub MatchString {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
84 my ($this,$string) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
85
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
86 $this->{$_current}{token} eq $string ? ($this->data() and return 1) : return $this->error("Expected: $string");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
87 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
88
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
89 sub MatchReference {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
90 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
91
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
92 my $chunk = $this->ResolveChunk($name) || return $this->error("Invalid reference: $name");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
93 return $this->PlayChunk($chunk);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
94 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
95
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
96 sub MatchSwitch {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
97 my ($this,@chunks) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
98
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
99 foreach my $chunk (@chunks) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
100 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
101 if ( $this->PlayChunk($chunk) ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
102 $this->apply;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
103 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
104 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
105 $this->restore;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
106 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
107 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
108
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
109 return 0; # passthrough last error
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
110 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
111
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
112 sub MatchRepeat {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
113 my ($this,$chunk, $min, $max) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
114
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
115 my $count = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
116
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
117 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
118 while (1) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
119 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
120 if ($this->PlayChunk($chunk)) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
121 $count ++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
122 $this->apply;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
123 $this->apply and return 1 if ($count >= $max)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
124 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
125 $this->restore;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
126 $count >= $min ?
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
127 ($this->apply() and return 1) :
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
128 ($this->restore() and return $this->error("Expected at least $min occurances, got only $count"));
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
129 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
130 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
131
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
132 # we should never get here
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
133 die new IMPL::InvalidOperationException("unexpected error");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
134 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
135
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
136 sub moveNext {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
137 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
138
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
139 my $pos = $this->{$_current}{pos};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
140
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
141 $pos ++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
142
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
143 if ($pos < @{$this->{$_data}}) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
144
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
145 $this->{$_current} = {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
146 pos => $pos,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
147 token => $this->{$_data}[$pos][1],
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
148 line => $this->{$_data}
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
149 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
150
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
151 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
152 $this->{$_current} = {};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
153 return undef;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
154 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
155 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
156
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
157 sub ResolveChunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
158 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
159 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
160
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
161 sub save {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
162 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
163
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
164 push @{$this->{$_states}}, $this->{$_current};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
165 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
166
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
167 sub restore {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
168 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
169
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
170 $this->{$_current} = pop @{$this->{$_states}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
171 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
172
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
173 sub apply {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
174 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
175
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
176 pop @{$this->{$_states}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
177 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
178
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
179 sub error {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
180 my ($this,$message) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
181
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
182 $this->{$errorLast} = {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
183 message => $message,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
184 line => $this->{$_current}{line},
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
185 token => $this->{$_current}{token}
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
186 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
187
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
188 return 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
189 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
190
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
191 sub __debug {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
192
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
193 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
194 sub enter {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
195 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
196
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
197 #always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
198 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
199 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
200
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
201 sub leave {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
202 my ($this,$isEmpty) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
203
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
204 #always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
205 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
206 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
207
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
208 sub data {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
209 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
210
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
211 my $data = $this->{$_current}{token};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
212
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
213 # always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
214 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
215 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
216
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
217 1;