Exemplo n.º 1
0
 function visitSequenceNode(PiBX_ParseTree_Tree $tree)
 {
     $this->plowTypesForLevel($tree->getLevel());
     $logMessage = $tree->getLevel() . " " . str_pad("  ", $tree->getLevel()) . " ";
     $logMessage .= "sequence (" . $tree->getElementCount() . ")";
     $this->log($logMessage);
     if ($this->currentType() instanceof PiBX_AST_Type) {
         /**
          * A sequence witin a Type means a list of
          * attributes are incoming.
          */
         $this->currentType()->setAttributeCount($tree->getElementCount());
     } elseif ($this->currentType() instanceof PiBX_AST_TypeAttribute) {
         $newType = new PiBX_AST_Collection();
         $sf = new PiBX_CodeGen_ASTStackFrame($tree->getLevel(), $newType);
         array_push($this->stack, $sf);
     } elseif ($tree->getElementCount() < 0) {
         $c = new PiBX_AST_Collection();
         $sf = new PiBX_CodeGen_ASTStackFrame($tree->getLevel(), $c);
         array_push($this->stack, $sf);
     } else {
         throw new RuntimeException('invalid sequence state');
     }
     $this->lastLevel = $tree->getLevel();
 }