aboutsummaryrefslogtreecommitdiffstats
path: root/Praspel.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-07 18:25:41 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-07 18:25:41 +0200
commitfaba6ec19b03e8ae2e37d4a8a5bb01e7107b7cb3 (patch)
tree4659126770bfcd20a65af9497213b5fda46e3075 /Praspel.php
parent7dc37050c60678f7bb6248a3d9b8fd341988c521 (diff)
downloadPraspel-faba6ec19b03e8ae2e37d4a8a5bb01e7107b7cb3.zip
Praspel-faba6ec19b03e8ae2e37d4a8a5bb01e7107b7cb3.tar.gz
Praspel-faba6ec19b03e8ae2e37d4a8a5bb01e7107b7cb3.tar.bz2
Use Visitor\Praspel for better exception messages.
Diffstat (limited to 'Praspel.php')
-rw-r--r--Praspel.php35
1 files changed, 31 insertions, 4 deletions
diff --git a/Praspel.php b/Praspel.php
index 7556ecb..4dce900 100644
--- a/Praspel.php
+++ b/Praspel.php
@@ -79,6 +79,11 @@ from('Hoa')
-> import('Praspel.Visitor.Interpreter')
/**
+ * \Hoa\Praspel\Visitor\Praspel
+ */
+-> import('Praspel.Visitor.Praspel')
+
+/**
* \Hoa\Compiler\Llk
*/
-> import('Compiler.Llk.~')
@@ -109,21 +114,28 @@ class Praspel {
*
* @var \Hoa\Praspel\Model\Specification object
*/
- protected $_specification = null;
+ protected $_specification = null;
/**
* Data of the specification.
*
* @var \Hoa\Praspel array
*/
- protected $_data = null;
+ protected $_data = null;
/**
* Callable to validate and verify.
*
* @var \Hoa\Core\Consistency\Xcallable object
*/
- protected $_callable = null;
+ protected $_callable = null;
+
+ /**
+ * Visitor Praspel.
+ *
+ * @var \Hoa\Praspel\Visitor\Praspel object
+ */
+ protected $_visitorPraspel = null;
@@ -271,7 +283,8 @@ class Praspel {
if(false === $_verdict)
$exceptions[] = new $exception(
'Variable %s does not verify the constraint %s.',
- 0, array($name, $variable->getDomains()->toPraspel()));
+ 0,
+ array($name, $this->getVisitorPraspel()->visit($variable)));
$verdict = $_verdict && $verdict;
}
@@ -380,6 +393,20 @@ class Praspel {
}
/**
+ * Get visitor Praspel.
+ *
+ * @access protected
+ * @return \Hoa\Praspel\Visitor\Praspel
+ */
+ protected function getVisitorPraspel ( ) {
+
+ if(null === $this->_visitorPraspel)
+ $this->_visitorPraspel = new Visitor\Praspel();
+
+ return $this->_visitorPraspel;
+ }
+
+ /**
* Short interpreter.
*
* @access public