-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandlebars-ast.stub.php
200 lines (173 loc) · 3.62 KB
/
handlebars-ast.stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
namespace Handlebars;
class Tokenizer
{
/**
* Tokenize a template and return an array of tokens
*
* @param string $tmpl
* @return array
*/
public static function lex(string $tmpl): array {}
/**
* Tokenize a template and return a readable string representation of the tokens
*
* @param string $tmpl
* @return string
*/
public static function lexPrint(string $tmpl): string {}
}
class Opcode
{
/**
* @var string
* This uses a typed property on >= PHP 7.4
*/
public /*string*/ $opcode;
/**
* @var array
* This uses a typed property on >= PHP 7.4
*/
public /*array*/ $args;
/**
* Constructor
*
* @param string $opcode
* @param array $args
*/
public function __construct(string $opcode, array $args) {
$this->opcode = $opcode;
$this->args = $args;
}
}
class Parser
{
/**
* Parse a template and return the AST
*
* @param string $tmpl
* @return array
* @throws \Handlebars\ParseException
*/
public static function parse(string $tmpl): array {}
/**
* Parse a template and return a readable string representation of the AST
*
* @param string $tmpl
* @return string
* @throws \Handlebars\ParseException
*/
public static function parsePrint(string $tmpl): string {}
}
class Compiler
{
const NONE = 0;
const USE_DEPTHS = 1;
const STRING_PARAMS = 2;
const TRACK_IDS = 4;
const NO_ESCAPE = 8;
const KNOWN_HELPERS_ONLY = 16;
const PREVENT_INDENT = 32;
const USE_DATA = 64;
const EXPLICIT_PARTIAL_CONTEXT = 128;
const IGNORE_STANDALONE = 256;
const ALTERNATE_DECORATORS = 512;
const STRICT = 1024;
const ASSUME_OBJECTS = 2048;
const COMPAT = 1;
const MUSTACHE_STYLE_LAMBDAS = 4096;
const ALL = 8191;
const USE_PARTIAL = 2;
const IS_SIMPLE = 4;
const USE_DECORATORS = 8;
const RESULT_ALL = 15;
/**
* Compile a template and return the opcodes
*
* @param string $tmpl
* @param array $options
* @return array
* @throws \Handlebars\CompileException
*/
public static function compile(string $tmpl, array $options = null): array {}
/**
* Compile a template and return a readable string representation of the opcodes
*
* @param string $tmpl
* @param array $options
* @return string
* @throws \Handlebars\CompileException
*/
public static function compilePrint(string $tmpl, array $options = null): string {}
}
class Token
{
/**
* @var string
* This uses a typed property on >= PHP 7.4
*/
public /*string*/ $name;
/**
* @var string
* This uses a typed property on >= PHP 7.4
*/
public /*string*/ $text;
/**
* Constructor
*
* @param string $name
* @param string $text
*/
public function __construct(string $name, string $text) {
$this->name = $name;
$this->text = $text;
}
}
class Program
{
/**
* @var Opcode[]
*/
public $opcodes;
/**
* @var Program[]
*/
public $children;
/**
* @var Program[]
*/
public $decorators;
/**
* @var boolean
*/
public $isSimple;
/**
* @var boolean
*/
public $useDepths;
/**
* @var boolean
*/
public $usePartial;
/**
* @var boolean
*/
public $useDecorators;
/**
* @var integer
*/
public $blockParams;
/**
* @var boolean
*/
public $stringParams;
/**
* @var boolean
*/
public $trackIds;
public function __construct(array $opcodes, array $children, int $blockParams) {
$this->opcodes = $opcodes;
$this->children = $children;
$this->blockParams = $blockParams;
}
}