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