Code

New sieve filter, not yet finished.
[gosa.git] / include / sieve / class_My_Parser.inc
1 <?php
3 class My_Parser extends Parser 
4 {
5         function parse($script) 
6         {
7         $this->status_text = "incomplete";
8         $this->script_ = $script;
9         $this->tree_ = new My_Tree(Scanner::scriptStart());
10         $this->tree_->setDumpFunc(array(&$this, 'dumpToken_'));
11         $this->scanner_ = new Scanner($this->script_);
12         $this->scanner_->setCommentFunc(array($this, 'comment_'));
14         if ($this->commands_($this->tree_->getRoot()) &&
15             $this->scanner_->nextTokenIs('script-end'))
16         {
17             return $this->success_('success');
18         }
20         return $this->status_;
21         }
23         function dumpToken_(&$token)
24         {
25                 if (is_array($token))
26                 {
27                         $str = "<" . $token['text'] . "> ";
28                         foreach ($token as $k => $v)
29                         {
30                                 $str .= " $k:$v";
31                         }
32                         return $str;
33                 }
34                 return strval($token);
35         }
36 }
37 ?>