aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Visitor/Interpreter.php42
1 files changed, 39 insertions, 3 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index 6d70df8..3f01e3d 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -89,21 +89,28 @@ class Interpreter implements \Hoa\Visitor\Visit {
*
* @var \Hoa\Praspel\Model\Specification object
*/
- protected $_root = null;
+ protected $_root = null;
/**
* Current clause.
*
* @var \Hoa\Praspel\Model\Clause object
*/
- protected $_clause = null;
+ protected $_clause = null;
/**
* Current object.
*
* @var \Hoa\Praspel\Model object
*/
- protected $_current = null;
+ protected $_current = null;
+
+ /**
+ * Classname to bind to the specification.
+ *
+ * @var \Hoa\Praspel\Visitor\Interpreter string
+ */
+ protected $_classnameToBind = null;
@@ -129,6 +136,9 @@ class Interpreter implements \Hoa\Visitor\Visit {
= $this->_root
= new \Hoa\Praspel\Model\Specification();
+ if(null !== $classname = $this->getBindedClass())
+ $this->_root->bindToClass($classname);
+
foreach($element->getChildren() as $child)
$child->accept($this, $handle, $eldnah);
@@ -625,6 +635,32 @@ class Interpreter implements \Hoa\Visitor\Visit {
return $this->_clause;
}
+
+ /**
+ * Set classname to bind.
+ *
+ * @access public
+ * @param string $classname Classname.
+ * @return string
+ */
+ public function bindToClass ( $classname ) {
+
+ $old = $this->_classnameToBind;
+ $this->_classnameToBind = $classname;
+
+ return $old;
+ }
+
+ /**
+ * Get classname to bind.
+ *
+ * @access public
+ * @return string
+ */
+ public function getBindedClass ( ) {
+
+ return $this->_classnameToBind;
+ }
}
}