aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2012-12-18 09:39:46 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2012-12-18 09:39:46 +0100
commit22fa6e5f8f73e283e98c95b64f1d97f5c1ad0172 (patch)
tree81bf70af248cf2756e3b2f22d32a0772569d5052 /Visitor/Interpreter.php
parentc600c7f731c50442a5b2b9254358a9f85d4f44e4 (diff)
downloadPraspel-22fa6e5f8f73e283e98c95b64f1d97f5c1ad0172.zip
Praspel-22fa6e5f8f73e283e98c95b64f1d97f5c1ad0172.tar.gz
Praspel-22fa6e5f8f73e283e98c95b64f1d97f5c1ad0172.tar.bz2
Add variable in realdom arguments support.
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php38
1 files changed, 29 insertions, 9 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index a5cec2b..f8c6421 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -180,7 +180,7 @@ class Interpreter implements \Hoa\Visitor\Visit {
case '#declaration':
$variable = $element->getChild(0)
- ->accept($this, $handle, $eldnah);
+ ->accept($this, $handle, false);
$this->_clause[$variable]->in = $element->getChild(1)
->accept($this, $handle, $eldnah);
break;
@@ -190,23 +190,23 @@ class Interpreter implements \Hoa\Visitor\Visit {
$variable = $this->_clause[array_shift($children)->accept(
$this,
$handle,
- $eldnah
+ false
)];
foreach($children as $child)
- $variable->is($child->accept($this, $handle, $eldnah));
+ $variable->is($child->accept($this, $handle, false));
break;
case '#contains':
- $variable = $element->getChild(0)->accept($this, $handle, $eldnah);
- $value = $element->getChild(1)->accept($this, $handle, $eldnah);
+ $variable = $element->getChild(0)->accept($this, $handle, false);
+ $value = $element->getChild(1)->accept($this, $handle, false);
$this->_clause[$variable]->contains($value);
break;
case '#domainof':
- $left = $element->getChild(0)->accept($this, $handle, $eldnah);
- $right = $element->getChild(1)->accept($this, $handle, $eldnah);
+ $left = $element->getChild(0)->accept($this, $handle, false);
+ $right = $element->getChild(1)->accept($this, $handle, false);
$this->_clause[$left]->domainof($right);
break;
@@ -236,7 +236,7 @@ class Interpreter implements \Hoa\Visitor\Visit {
case '#realdom':
$children = $element->getChildren();
$child0 = array_shift($children);
- $name = $child0->accept($this, $handle, $eldnah);
+ $name = $child0->accept($this, $handle, false);
$arguments = array();
foreach($children as $child) {
@@ -378,8 +378,12 @@ class Interpreter implements \Hoa\Visitor\Visit {
switch($tId) {
- case 'content':
case 'identifier':
+ if(false !== $eldnah)
+ return $this->getIdentifier($value);
+ return $value;
+
+ case 'content':
case 'pure':
case 'result':
return $value;
@@ -474,6 +478,22 @@ class Interpreter implements \Hoa\Visitor\Visit {
}
/**
+ * Get identifier object.
+ *
+ * @access public
+ * @return \Hoa\Praspel\Model\Variable
+ */
+ public function getIdentifier ( $identifier ) {
+
+ if(!isset($this->_clause[$identifier]))
+ throw new \Hoa\Praspel\Exception\Interpreter(
+ 'The identifier %s does not exist on clause %s.',
+ 3, array($identifier, $this->_clause->getName()));
+
+ return $this->_clause[$identifier];
+ }
+
+ /**
* Get root.
*
* @access public