1 | <?php |
||
25 | class Token |
||
26 | { |
||
27 | // RegExps |
||
28 | const VARNAME_SEARCH = '/(\\[[^\\]]+\\]|[^\\[\\]\\.]+)/'; |
||
29 | |||
30 | // Positions of matched token |
||
31 | const POS_LOTHER = 1; |
||
32 | const POS_LSPACE = 2; |
||
33 | const POS_BEGINTAG = 3; |
||
34 | const POS_LSPACECTL = 4; |
||
35 | const POS_BEGINRAW = 5; |
||
36 | const POS_OP = 6; |
||
37 | const POS_INNERTAG = 7; |
||
38 | const POS_ENDRAW = 8; |
||
39 | const POS_RSPACECTL = 9; |
||
40 | const POS_ENDTAG = 10; |
||
41 | const POS_RSPACE = 11; |
||
42 | const POS_ROTHER = 12; |
||
43 | const POS_BACKFILL = 13; |
||
44 | |||
45 | /** |
||
46 | * Setup delimiter by default or provided string |
||
47 | * |
||
48 | * @param array<string,array|string|integer> $context Current context |
||
49 | * @param string|null $left left string of a token |
||
50 | * @param string|null $right right string of a token |
||
51 | */ |
||
52 | 795 | public static function setDelimiter(&$context, $left = null, $right = null) |
|
74 | |||
75 | /** |
||
76 | * return token string |
||
77 | * |
||
78 | * @param string[] $token detected handlebars {{ }} token |
||
79 | * @param string[]|null $merge list of token strings to be merged |
||
80 | * |
||
81 | * @return string Return whole token |
||
82 | * |
||
83 | * @expect 'c' when input array(0, 'a', 'b', 'c', 'd', 'e') |
||
84 | * @expect 'cd' when input array(0, 'a', 'b', 'c', 'd', 'e', 'f') |
||
85 | * @expect 'qd' when input array(0, 'a', 'b', 'c', 'd', 'e', 'f'), array(3 => 'q') |
||
86 | */ |
||
87 | 754 | public static function toString($token, $merge = null) |
|
94 | } |
||
95 |