1: <?php
2:
3: /**
4: * This file is part of the Latte (https://latte.nette.org)
5: * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Latte;
9:
10:
11: /**
12: * Latte parser token.
13: *
14: * @author David Grudl
15: */
16: class Token extends Object
17: {
18: const TEXT = 'text',
19: MACRO_TAG = 'macroTag', // latte macro tag
20: HTML_TAG_BEGIN = 'htmlTagBegin', // begin of HTML tag or comment
21: HTML_TAG_END = 'htmlTagEnd', // end of HTML tag or comment
22: HTML_ATTRIBUTE = 'htmlAttribute',
23: COMMENT = 'comment'; // latte comment
24:
25: /** @var string token type [TEXT | MACRO_TAG | HTML_TAG_BEGIN | HTML_TAG_END | HTML_ATTRIBUTE | COMMENT] */
26: public $type;
27:
28: /** @var string original text content of the token */
29: public $text;
30:
31: /** @var int line number */
32: public $line;
33:
34: /** @var string name of macro tag, HTML tag or attribute; used for types MACRO_TAG, HTML_TAG_BEGIN, HTML_ATTRIBUTE */
35: public $name;
36:
37: /** @var string value of macro tag or HTML attribute; used for types MACRO_TAG, HTML_ATTRIBUTE */
38: public $value;
39:
40: /** @var string macro modifiers; used for type MACRO_TAG */
41: public $modifiers;
42:
43: /** @var bool is closing HTML tag </tag>? used for type HTML_TAG_BEGIN */
44: public $closing;
45:
46: /** @var bool is tag empty {name/}? used for type MACRO_TAG */
47: public $empty;
48:
49: }
50: