aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-11 09:05:04 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-11-11 09:05:04 +0100
commit6e854e85824bc3af64236912ec0e336d9d6315bc (patch)
tree9728efffb33aebfaaa7247a945bb5a595b408ebc /Visitor/Interpreter.php
parentfaa9e89f6254898cd0ed4c375d32260323b7883e (diff)
downloadPraspel-6e854e85824bc3af64236912ec0e336d9d6315bc.zip
Praspel-6e854e85824bc3af64236912ec0e336d9d6315bc.tar.gz
Praspel-6e854e85824bc3af64236912ec0e336d9d6315bc.tar.bz2
Interpreter can bind a class on the specification.
Diffstat (limited to 'Visitor/Interpreter.php')
-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;
+ }
}
}