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