aboutsummaryrefslogtreecommitdiffstats
path: root/Visitor/Interpreter.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 16:15:55 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-04-16 16:15:55 +0200
commita47252b81b7f6cb207b27fb4ae3f290d0496c3ea (patch)
treef5a1675595d9a04224376c2d67ca00dad0b58420 /Visitor/Interpreter.php
parentc2c368e07a224f7817c033e9a9761ff0241d76ae (diff)
downloadPraspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.zip
Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.gz
Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.bz2
Introduce collection of clauses.
Clauses can have variables, so that they extend Declaration. But a specification or a behavior can have a collection of other clauses, such as a collection of behavior, represented by an identifier. To build a collection of clauses, we need to instance the Collection class with a preset clause and post-clone function. For each new offset in the collection, the associated value is a clone from the preset clause with the post-clone function applied on this clone. This mechanism allows us to build modular collection of clauses.
Diffstat (limited to 'Visitor/Interpreter.php')
-rw-r--r--Visitor/Interpreter.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/Visitor/Interpreter.php b/Visitor/Interpreter.php
index fb3948e..22a03b6 100644
--- a/Visitor/Interpreter.php
+++ b/Visitor/Interpreter.php
@@ -149,12 +149,13 @@ class Interpreter implements \Hoa\Visitor\Visit {
case '#behavior':
$children = $element->getChildren();
$child0 = array_shift($children);
+ $identifier = $child0->accept($this, $handle, false);
$previous = $this->_current;
+
$this->_clause = $this->_current
- = $this->_current->getClause('behavior');
- $this->_clause->setIdentifier(
- $child0->accept($this, $handle, false)
- );
+ = $this->_current
+ ->getClause('behavior')
+ ->get($identifier);
foreach($children as $child)
$child->accept($this, $handle, $eldnah);