1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: * @package Nette\Latte
11: */
12:
13:
14:
15: /**
16: * Macro element node.
17: *
18: * @author David Grudl
19: * @package Nette\Latte
20: */
21: class MacroNode extends Object
22: {
23: const PREFIX_INNER = 'inner',
24: PREFIX_TAG = 'tag';
25:
26: /** @var IMacro */
27: public $macro;
28:
29: /** @var string */
30: public $name;
31:
32: /** @var bool */
33: public $isEmpty = FALSE;
34:
35: /** @var string raw arguments */
36: public $args;
37:
38: /** @var string raw modifier */
39: public $modifiers;
40:
41: /** @var bool */
42: public $closing = FALSE;
43:
44: /** @var MacroTokenizer */
45: public $tokenizer;
46:
47: /** @var MacroNode */
48: public $parentNode;
49:
50: /** @var string */
51: public $openingCode;
52:
53: /** @var string */
54: public $closingCode;
55:
56: /** @var string */
57: public $attrCode;
58:
59: /** @var string */
60: public $content;
61:
62: /** @var \stdClass user data */
63: public $data;
64:
65: /** @var HtmlNode for n:attr macros */
66: public $htmlNode;
67:
68: /** @var string for n:attr macros (NULL, PREFIX_INNER, PREFIX_TAG) */
69: public $prefix;
70:
71: public $saved;
72:
73:
74: public function __construct(IMacro $macro, $name, $args = NULL, $modifiers = NULL, MacroNode $parentNode = NULL, HtmlNode $htmlNode = NULL, $prefix = NULL)
75: {
76: $this->macro = $macro;
77: $this->name = (string) $name;
78: $this->modifiers = (string) $modifiers;
79: $this->parentNode = $parentNode;
80: $this->htmlNode = $htmlNode;
81: $this->prefix = $prefix;
82: $this->tokenizer = new MacroTokenizer($this->args);
83: $this->data = new stdClass;
84: $this->setArgs($args);
85: }
86:
87:
88: public function setArgs($args)
89: {
90: $this->args = (string) $args;
91: $this->tokenizer->tokenize($this->args);
92: }
93:
94: }
95: