getNotation() public method

public getNotation ( )
Beispiel #1
0
 /**
  * New node is found.
  * @return bool
  */
 public function nodeOpened(Latte\MacroNode $node)
 {
     if ($node->modifiers) {
         throw new Latte\CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
     $this->used = TRUE;
     $node->empty = FALSE;
     $node->openingCode = Latte\PhpWriter::using($node)->write('<?php if (Nette\\Bridges\\CacheLatte\\CacheMacro::createCache($this->global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) { ?>', Nette\Utils\Random::generate());
 }
Beispiel #2
0
 /**
  * {status ...}
  */
 public function macroStatus(MacroNode $node, PhpWriter $writer)
 {
     trigger_error('Macro {status} is deprecated.', E_USER_DEPRECATED);
     if ($node->modifiers) {
         throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
     return $writer->write((substr($node->args, -1) === '?' ? 'if (!headers_sent()) ' : '') . 'http_response_code(%0.var);', (int) $node->args);
 }
Beispiel #3
0
 /**
  * {inputError ...}
  */
 public function macroInputError(MacroNode $node, PhpWriter $writer)
 {
     if ($node->modifiers) {
         throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
     $name = $node->tokenizer->fetchWord();
     $node->replaced = true;
     if (!$name) {
         return $writer->write('echo %escape($_input->getError());');
     } elseif ($name[0] === '$') {
         return $writer->write('$_input = is_object(%0.word) ? %0.word : end($this->global->formsStack)[%0.word]; echo %escape($_input->getError());', $name);
     } else {
         return $writer->write('echo %escape(end($this->global->formsStack)[%0.word]->getError());', $name);
     }
 }
Beispiel #4
0
 public function texyOpened(Latte\MacroNode $node)
 {
     if ($node->modifiers) {
         throw new Latte\CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
 }
Beispiel #5
0
 /** @internal */
 protected function checkExtraArgs(MacroNode $node)
 {
     if ($node->tokenizer->isNext()) {
         $args = Latte\Runtime\Filters::truncate($node->tokenizer->joinAll(), 20);
         trigger_error("Unexpected arguments '{$args}' in " . $node->getNotation());
     }
 }
Beispiel #6
0
 /**
  * {ifCurrent destination [,] [params]}
  */
 public function macroIfCurrent(MacroNode $node, PhpWriter $writer)
 {
     if ($node->modifiers) {
         throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
     return $writer->write($node->args ? 'if ($this->global->uiPresenter->isLinkCurrent(%node.word, %node.array?)) {' : 'if ($this->global->uiPresenter->getLastCreatedRequestFlag("current")) {');
 }
Beispiel #7
0
 /**
  * {ifset block}
  * {elseifset block}
  */
 public function macroIfset(MacroNode $node, PhpWriter $writer)
 {
     if ($node->modifiers) {
         throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
     }
     if (!preg_match('~#|[\\w-]+\\z~A', $node->args)) {
         return FALSE;
     }
     $list = [];
     while (($name = $node->tokenizer->fetchWord()) !== FALSE) {
         $list[] = preg_match('~#|[\\w-]+\\z~A', $name) ? '$this->blockQueue["' . ltrim($name, '#') . '"]' : $writer->formatArgs(new Latte\MacroTokens($name));
     }
     return ($node->name === 'elseifset' ? '} else' : '') . 'if (isset(' . implode(', ', $list) . ')) {';
 }