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: class Token
15: {
16: use Strict;
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_BEGIN = 'htmlAttributeBegin',
23: HTML_ATTRIBUTE_END = 'htmlAttributeEnd',
24: COMMENT = 'comment'; // latte comment
25:
26: /** @var string token type [TEXT | MACRO_TAG | HTML_TAG_BEGIN | HTML_TAG_END | HTML_ATTRIBUTE_BEGIN | HTML_ATTRIBUTE_END | COMMENT] */
27: public $type;
28:
29: /** @var string original text content of the token */
30: public $text;
31:
32: /** @var int line number */
33: public $line;
34:
35: /** @var string name of macro tag, HTML tag or attribute; used for types MACRO_TAG, HTML_TAG_BEGIN, HTML_ATTRIBUTE_BEGIN */
36: public $name;
37:
38: /** @var string value of macro tag or HTML attribute; used for types MACRO_TAG, HTML_ATTRIBUTE_BEGIN */
39: public $value;
40:
41: /** @var string macro modifiers; used for type MACRO_TAG */
42: public $modifiers;
43:
44: /** @var bool is closing macro or HTML tag </tag>? used for types MACRO_TAG, HTML_TAG_BEGIN */
45: public $closing;
46:
47: /** @var bool is tag empty {name/}? used for type MACRO_TAG */
48: public $empty;
49: }
50: