Пример #1
0
 function enterPlaceholder(Placeholder $node)
 {
     $vs = $this->values;
     $namedValues = $vs[0];
     $unNamedValues = $vs[1];
     $name = $node->getName();
     // normal placeholder
     if (gettype($name) == 'integer' && isset($unNamedValues[$name])) {
         $v = $unNamedValues[$name];
         $this->setValues($node, $v);
         // named placeholder
     } elseif (isset($namedValues[$name])) {
         $v = $namedValues[$name];
         $this->setValues($node, $v);
         // default values
     } else {
         $default = $this->getDefault($node);
         if ($default) {
             $this->setValues($node, $default);
         } else {
             throw new SyntaxErrorException(sprintf('plz supply values for placeholder [[%s]]', $node->getName()));
         }
     }
 }
Пример #2
0
 public function __construct($first)
 {
     parent::__construct(array(), null);
     $this->first = $first;
 }
Пример #3
0
 protected function parsePlaceholder($buf)
 {
     $regex = '/
         @@@(?P<name>\\w+)?  # explicit tag name ( %tagname )
         /xA';
     if ($buf->match($regex, $match)) {
         $name = array_key_exists('name', $match) ? $match['name'] : $this->unnamedPlaceholderIndex++;
         $node = new Placeholder($match['pos'][0], $name);
         $buf->skipWs();
         if (null !== ($nested = $this->parseStatement($buf))) {
             $node->setContent($nested);
         }
         return $node;
     }
 }