1: <?php
2:
3: /**
4: * This file is part of the Nette Framework.
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * This source file is subject to the "Nette license", and/or
9: * GPL license. For more information please see http://nette.org
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:
75: public function __construct(IMacro $macro, $name, $args = NULL, $modifiers = NULL, MacroNode $parentNode = NULL, HtmlNode $htmlNode = NULL, $prefix = NULL)
76: {
77: $this->macro = $macro;
78: $this->name = (string) $name;
79: $this->modifiers = (string) $modifiers;
80: $this->parentNode = $parentNode;
81: $this->htmlNode = $htmlNode;
82: $this->prefix = $prefix;
83: $this->tokenizer = new MacroTokenizer($this->args);
84: $this->data = new stdClass;
85: $this->setArgs($args);
86: }
87:
88:
89:
90: public function setArgs($args)
91: {
92: $this->args = (string) $args;
93: $this->tokenizer->tokenize($this->args);
94: }
95:
96: }
97: