annotate Lib/IMPL/Text/Parser/Player.pm @ 282:68d905f8dc43

*IMPL::SQL fixed warnings
author cin
date Tue, 12 Feb 2013 01:24:36 +0400
parents 4ddb27ff4a0b
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: 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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
8 use IMPL::Text::Parser::Chunk;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
10 my %opCodesMap = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
11 IMPL::Text::Parser::Chunk::OP_REGEXP , &MatchRegexp ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
12 IMPL::Text::Parser::Chunk::OP_STRING , &MatchString ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
13 IMPL::Text::Parser::Chunk::OP_REFERENCE , &MatchReference ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
14 IMPL::Text::Parser::Chunk::OP_CHUNK , &PlayChunk ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
15 IMPL::Text::Parser::Chunk::OP_SWITCH , &MatchSwitch ,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
16 IMPL::Text::Parser::Chunk::OP_REPEAT , &MatchRepeat
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
17 );
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 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
20 private _direct property _data => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
21 private _direct property _current => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
22 private _direct property _states => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
23 private _direct property _document => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
24
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
25 public _direct property errorLast => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
26 public _direct property Punctuation => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
27 public _direct property Delimier => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
28 }
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 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
31 my ($this,$document) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
32
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
33 $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
34 }
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 sub LoadString {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
37 my ($this,$string) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
39 my $rxDelim = /(\s+|[.,;!-+*~$^&|%()`@\\\/])/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
41 my $line = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
43 $this->{$_data} = [
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
44 map {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
45 $line++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
46 map {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
47 [$line,$_]
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
48 } split $rxDelim, $_
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
49 } split /\n/, $string
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
50 ]
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 sub Play {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
54 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
55 }
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 sub PlayChunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
58 my ($this,$chunk) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
59
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
60 my $end = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
61
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
62 my $name = $chunk->chunkName;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
63
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
64 $this->enter($name) if $name;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
65
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
66 foreach my $op ( @{$chunk->opStream} ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
67 $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
68
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
69 $opCodesMap{shift @$op}->(@$op) || return $this->leave(0) ;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
70 $this->moveNext or $end = 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
71 }
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 return $this->leave(1);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
74 }
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 sub MatchRegexp {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
77 my ($this,$rx) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
78
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
79 $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
80 }
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 sub MatchString {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
83 my ($this,$string) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
84
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
85 $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
86 }
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 sub MatchReference {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
89 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
90
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
91 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
92 return $this->PlayChunk($chunk);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
93 }
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 sub MatchSwitch {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
96 my ($this,@chunks) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
97
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
98 foreach my $chunk (@chunks) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
99 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
100 if ( $this->PlayChunk($chunk) ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
101 $this->apply;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
102 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
103 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
104 $this->restore;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
105 }
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 return 0; # passthrough last error
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
109 }
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 sub MatchRepeat {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
112 my ($this,$chunk, $min, $max) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
113
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
114 my $count = 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
115
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
116 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
117 while (1) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
118 $this->save;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
119 if ($this->PlayChunk($chunk)) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
120 $count ++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
121 $this->apply;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
122 $this->apply and return 1 if ($count >= $max)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
123 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
124 $this->restore;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
125 $count >= $min ?
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
126 ($this->apply() and return 1) :
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
127 ($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
128 }
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 # we should never get here
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
132 die new IMPL::InvalidOperationException("unexpected error");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
133 }
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 sub moveNext {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
136 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
137
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
138 my $pos = $this->{$_current}{pos};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
139
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
140 $pos ++;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
141
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
142 if ($pos < @{$this->{$_data}}) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
143
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
144 $this->{$_current} = {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
145 pos => $pos,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
146 token => $this->{$_data}[$pos][1],
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
147 line => $this->{$_data}
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
148 };
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 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
151 $this->{$_current} = {};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
152 return undef;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
153 }
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 sub ResolveChunk {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
157 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
158 }
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 sub save {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
161 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
162
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
163 push @{$this->{$_states}}, $this->{$_current};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
164 }
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 sub restore {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
167 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
168
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
169 $this->{$_current} = pop @{$this->{$_states}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
170 }
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 sub apply {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
173 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
174
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
175 pop @{$this->{$_states}};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
176 }
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 sub error {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
179 my ($this,$message) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
180
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
181 $this->{$errorLast} = {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
182 message => $message,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
183 line => $this->{$_current}{line},
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
184 token => $this->{$_current}{token}
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
185 };
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 return 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
188 }
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 sub __debug {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
191
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 sub enter {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
194 my ($this,$name) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
195
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
196 #always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
197 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
198 }
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 sub leave {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
201 my ($this,$isEmpty) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
202
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
203 #always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
204 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
205 }
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 sub data {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
208 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
209
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
210 my $data = $this->{$_current}{token};
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
211
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
212 # always return true;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
213 return 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 41
diff changeset
214 }
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 1;