Code

Updated comment handling
[gosa.git] / include / sieve / class_My_Parser.inc
index 6d796cd8ae23d84fe9a22f31a53574ca8d0bbad4..912422360f1cedd5cc95741e3c2ff4375ed6fa2d 100644 (file)
@@ -1,16 +1,30 @@
 <?php
 
-
+define("SIEVE_INDENT_TAB","  ");
 
 /* This class is inherited from the original 'Parser'
  *  class written by Heiko Hund
  */
 class My_Parser extends Parser 
 {
+       var $parent = NULL;
+
+       function My_Parser($parent)
+       {
+               $this->parent = $parent;
+       }
 
        function execute()
        {
-               return($this->dumpParseTree());
+               $ret = $this->dumpParseTree();
+               return($ret);
+       }
+       
+
+       /* Check if there are errors, collect them and return them */
+       function check()
+       {
+               return($this->tree_->check());
        }
        
 
@@ -21,7 +35,7 @@ class My_Parser extends Parser
        {
         $this->status_text = "incomplete";
         $this->script_ = $script;
-        $this->tree_ = new My_Tree(@Scanner::scriptStart());
+        $this->tree_ = new My_Tree(@Scanner::scriptStart(),$this);
         $this->tree_->setDumpFunc(array(&$this, 'dumpToken_'));
         $this->scanner_ = new Scanner($this->script_);
         $this->scanner_->setCommentFunc(array($this, 'comment_'));
@@ -35,7 +49,13 @@ class My_Parser extends Parser
         return $this->status_;
        }
 
-               
+       
+       function get_sieve_script()
+       {
+               return($this->tree_->get_sieve_script());
+       }               
+
+       
        function save_object()
        {
                $this->tree_->save_object();
@@ -56,5 +76,11 @@ class My_Parser extends Parser
                }
                return strval($token);
        }
+
+
+       function dumpParseTree()
+       {
+               return $this->tree_->execute();
+       }
 }
 ?>