Exemple #1
0
 function _tokenize_named_arguments($statement, $type = '', $static_vars = true)
 {
     //$this->_generate_tokens_stack($statement);
     $_context_transitions = FlageParser::$_context_transitions;
     $_transitions = FlageParser::$_transitions;
     if ($static_vars) {
         FlageParser::$_context_transitions = FlageParser::$_context_transitions_arguments;
         FlageParser::$_transitions = FlageParser::$_transitions_arguments;
     }
     // Generate new state, which is counted as a function
     $state2 = new FlageState(null, $this->line, $this->col, false);
     // New function node
     $state2->node->next = new FlageNodeFunction(null, $this->line, $this->col, false);
     // Previous node of the function is the created state
     $state2->node->next->prev = $state2->node;
     // parent node is argument node, as we do not need function name
     $state2->parent_node = $state2->node = $state2->node->next->arguments->nextArgumentNode($this->line, $this->col);
     $state2->type = '';
     // Group type is a function
     $state2->group_type = 'block';
     // We need to tokenize only arguments
     $state = $this->_tokenize($statement, $state2);
     $nodes = $state->entry_node->next->arguments->nodes;
     $arguments = array();
     for ($i = 1; $i < count($nodes); $i++) {
         //$argument->
         if ($nodes[$i][0]) {
             $name = $nodes[$i][0]->generate($this);
             $value = $nodes[$i][1]->generate($this);
         } else {
             $name = $nodes[$i][1]->generate($this);
             $value = "'{$name}'";
         }
         //print "$name=$value\n";
         $arguments[$name] = $value;
     }
     //$retState = $state;
     //$retState = $this->_tokenize($statement,$type);
     if ($static_vars) {
         FlageParser::$_context_transitions = $_context_transitions;
         FlageParser::$_transitions = $_transitions;
     }
     return $arguments;
 }