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