Merge remote-tracking branch 'origin/master'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLabSuite / Core / Template.grammar.js
CommitLineData
fd61a04b
TD
1
2
3define(function(require){
9433de87 4var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,48],$V1=[5,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,29,31,32,33,35,36,37,39,40,41,42,44,46,48],$V2=[1,33],$V3=[1,37],$V4=[1,38],$V5=[1,43],$V6=[1,39],$V7=[1,42],$V8=[1,40],$V9=[1,45],$Va=[11,12,14,15,17,18,20,21,22,23],$Vb=[11,12,14,15,16,17,18,19,20,21,22,23],$Vc=[9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,29,31,33,36,39,40,41,42,44,46],$Vd=[28,44,46],$Ve=[12,14];
fd61a04b
TD
5var parser = {trace: function trace() { },
6yy: {},
9433de87 7symbols_: {"error":2,"TEMPLATE":3,"CHUNK_STAR":4,"EOF":5,"CHUNK_STAR_repetition0":6,"CHUNK":7,"PLAIN_ANY":8,"T_LITERAL":9,"COMMAND":10,"T_ANY":11,"}":12,"{":13,"T_WS":14,"]":15,"[":16,")":17,"(":18,".":19,"=":20,"T_VARIABLE":21,"T_VARIABLE_NAME":22,"T_QUOTED_STRING":23,"{if":24,"COMMAND_PARAMETERS":25,"COMMAND_repetition0":26,"COMMAND_option0":27,"{/if}":28,"{include":29,"COMMAND_PARAMETER_LIST":30,"{implode":31,"{/implode}":32,"{foreach":33,"COMMAND_option1":34,"{/foreach}":35,"{lang}":36,"{/lang}":37,"VARIABLE":38,"{#":39,"{@":40,"{ldelim}":41,"{rdelim}":42,"ELSE":43,"{else}":44,"ELSE_IF":45,"{elseif":46,"FOREACH_ELSE":47,"{foreachelse}":48,"VARIABLE_repetition0":49,"VARIABLE_SUFFIX":50,"VARIABLE_SUFFIX_option0":51,"COMMAND_PARAMETER_VALUE":52,"COMMAND_PARAMETERS_repetition_plus0":53,"COMMAND_PARAMETER":54,"$accept":0,"$end":1},
fd61a04b 8terminals_: {2:"error",5:"EOF",9:"T_LITERAL",11:"T_ANY",12:"}",13:"{",14:"T_WS",15:"]",16:"[",17:")",18:"(",19:".",20:"=",21:"T_VARIABLE",22:"T_VARIABLE_NAME",23:"T_QUOTED_STRING",24:"{if",28:"{/if}",29:"{include",31:"{implode",32:"{/implode}",33:"{foreach",35:"{/foreach}",36:"{lang}",37:"{/lang}",39:"{#",40:"{@",41:"{ldelim}",42:"{rdelim}",44:"{else}",46:"{elseif",48:"{foreachelse}"},
9433de87 9productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[8,1],[8,1],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[10,7],[10,3],[10,5],[10,6],[10,3],[10,3],[10,3],[10,3],[10,1],[10,1],[43,2],[45,4],[47,2],[38,3],[50,3],[50,2],[50,3],[30,5],[30,3],[52,1],[52,1],[25,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,3],[6,0],[6,2],[26,0],[26,2],[27,0],[27,1],[34,0],[34,1],[49,0],[49,2],[51,0],[51,1],[53,1],[53,2]],
fd61a04b
TD
10performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
11/* this == yyval */
12
13var $0 = $$.length - 1;
14switch (yystate) {
15case 1:
16 return $$[$0-1] + ";";
17break;
18case 2:
19
20 var result = $$[$0].reduce(function (carry, item) {
21 if (item.encode && !carry[1]) carry[0] += " + '" + item.value;
22 else if (item.encode && carry[1]) carry[0] += item.value;
23 else if (!item.encode && carry[1]) carry[0] += "' + " + item.value;
24 else if (!item.encode && !carry[1]) carry[0] += " + " + item.value;
25
26 carry[1] = item.encode;
27 return carry;
28 }, [ "''", false ]);
29 if (result[1]) result[0] += "'";
30
31 this.$ = result[0];
32
33break;
34case 3: case 4:
35this.$ = { encode: true, value: $$[$0].replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/(\r\n|\n|\r)/g, '\\n') };
36break;
37case 5:
38this.$ = { encode: false, value: $$[$0] };
39break;
9433de87 40case 8:
fd61a04b
TD
41this.$ = $$[$0-1] + $$[$0];
42break;
43case 19:
44
45 this.$ = "(function() { if (" + $$[$0-5] + ") { return " + $$[$0-3] + "; } " + $$[$0-2].join(' ') + " " + ($$[$0-1] || '') + " return ''; })()";
46
47break;
48case 20:
49
50 if (!$$[$0-1]['file']) throw new Error('Missing parameter file');
51
52 this.$ = $$[$0-1]['file'] + ".fetch(v)";
53
54break;
55case 21:
56
57 if (!$$[$0-3]['from']) throw new Error('Missing parameter from');
58 if (!$$[$0-3]['item']) throw new Error('Missing parameter item');
59 if (!$$[$0-3]['glue']) $$[$0-3]['glue'] = "', '";
60
61 this.$ = "(function() { return " + $$[$0-3]['from'] + ".map(function(item) { v[" + $$[$0-3]['item'] + "] = item; return " + $$[$0-1] + "; }).join(" + $$[$0-3]['glue'] + "); })()";
62
63break;
64case 22:
65
66 if (!$$[$0-4]['from']) throw new Error('Missing parameter from');
67 if (!$$[$0-4]['item']) throw new Error('Missing parameter item');
68
69 this.$ = "(function() {"
70 + "var looped = false, result = '';"
71 + "if (" + $$[$0-4]['from'] + " instanceof Array) {"
72 + "for (var i = 0; i < " + $$[$0-4]['from'] + ".length; i++) { looped = true;"
73 + "v[" + $$[$0-4]['key'] + "] = i;"
74 + "v[" + $$[$0-4]['item'] + "] = " + $$[$0-4]['from'] + "[i];"
75 + "result += " + $$[$0-2] + ";"
76 + "}"
77 + "} else {"
78 + "for (var key in " + $$[$0-4]['from'] + ") {"
79 + "if (!" + $$[$0-4]['from'] + ".hasOwnProperty(key)) continue;"
80 + "looped = true;"
81 + "v[" + $$[$0-4]['key'] + "] = key;"
82 + "v[" + $$[$0-4]['item'] + "] = " + $$[$0-4]['from'] + "[key];"
83 + "result += " + $$[$0-2] + ";"
84 + "}"
85 + "}"
86 + "return (looped ? result : " + ($$[$0-1] || "''") + "); })()"
87
88break;
89case 23:
ad35859f 90this.$ = "Language.get(" + $$[$0-1] + ")";
fd61a04b
TD
91break;
92case 24:
ad35859f 93this.$ = "StringUtil.escapeHTML(" + $$[$0-1] + ")";
fd61a04b
TD
94break;
95case 25:
ad35859f 96this.$ = "StringUtil.formatNumeric(" + $$[$0-1] + ")";
fd61a04b
TD
97break;
98case 26:
99this.$ = $$[$0-1];
100break;
101case 27:
102this.$ = "'{'";
103break;
104case 28:
105this.$ = "'}'";
106break;
107case 29:
108this.$ = "else { return " + $$[$0] + "; }";
109break;
110case 30:
111this.$ = "else if (" + $$[$0-2] + ") { return " + $$[$0] + "; }";
112break;
113case 31:
114this.$ = $$[$0];
115break;
9433de87 116case 32:
fd61a04b
TD
117this.$ = "v['" + $$[$0-1] + "']" + $$[$0].join('');;
118break;
9433de87 119case 33:
fd61a04b
TD
120this.$ = $$[$0-2] + $$[$0-1] + $$[$0];
121break;
9433de87 122case 34:
fd61a04b
TD
123this.$ = "['" + $$[$0] + "']";
124break;
9433de87 125case 35: case 47:
fd61a04b
TD
126this.$ = $$[$0-2] + ($$[$0-1] || '') + $$[$0];
127break;
9433de87 128case 36:
fd61a04b
TD
129 this.$ = $$[$0]; this.$[$$[$0-4]] = $$[$0-2];
130break;
9433de87 131case 37:
fd61a04b
TD
132 this.$ = {}; this.$[$$[$0-2]] = $$[$0];
133break;
9433de87 134case 40:
fd61a04b
TD
135this.$ = $$[$0].join('');
136break;
9433de87 137case 48: case 50: case 56:
fd61a04b
TD
138this.$ = [];
139break;
9433de87 140case 49: case 51: case 57: case 61:
fd61a04b
TD
141$$[$0-1].push($$[$0]);
142break;
9433de87 143case 60:
fd61a04b
TD
144this.$ = [$$[$0]];
145break;
146}
147},
9433de87
TD
148table: [o([5,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,29,31,33,36,39,40,41,42],$V0,{3:1,4:2,6:3}),{1:[3]},{5:[1,4]},o([5,28,32,35,37,44,46,48],[2,2],{7:5,8:6,10:8,9:[1,7],11:[1,9],12:[1,10],13:[1,11],14:[1,21],15:[1,12],16:[1,13],17:[1,14],18:[1,15],19:[1,16],20:[1,17],21:[1,18],22:[1,19],23:[1,20],24:[1,22],29:[1,23],31:[1,24],33:[1,25],36:[1,26],39:[1,27],40:[1,28],41:[1,29],42:[1,30]}),{1:[2,1]},o($V1,[2,49]),o($V1,[2,3]),o($V1,[2,4]),o($V1,[2,5]),o($V1,[2,6]),o($V1,[2,7]),{14:[1,31],21:$V2,38:32},o($V1,[2,9]),o($V1,[2,10]),o($V1,[2,11]),o($V1,[2,12]),o($V1,[2,13]),o($V1,[2,14]),o($V1,[2,15]),o($V1,[2,16]),o($V1,[2,17]),o($V1,[2,18]),{11:$V3,14:$V4,18:$V5,20:$V6,21:$V2,22:$V7,23:$V8,25:34,38:41,53:35,54:36},{22:$V9,30:44},{22:$V9,30:46},{22:$V9,30:47},o([9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,29,31,33,36,37,39,40,41,42],$V0,{6:3,4:48}),{21:$V2,38:49},{21:$V2,38:50},o($V1,[2,27]),o($V1,[2,28]),o($V1,[2,8]),{12:[1,51]},{22:[1,52]},{12:[1,53]},o([12,15,17],[2,40],{38:41,54:54,11:$V3,14:$V4,18:$V5,20:$V6,21:$V2,22:$V7,23:$V8}),o($Va,[2,60]),o($Va,[2,41]),o($Va,[2,42]),o($Va,[2,43]),o($Va,[2,44]),o($Va,[2,45]),o($Va,[2,46]),{11:$V3,14:$V4,18:$V5,20:$V6,21:$V2,22:$V7,23:$V8,25:55,38:41,53:35,54:36},{12:[1,56]},{20:[1,57]},{12:[1,58]},{12:[1,59]},{37:[1,60]},{12:[1,61]},{12:[1,62]},o($V1,[2,24]),o($Vb,[2,56],{49:63}),o($Vc,$V0,{6:3,4:64}),o($Va,[2,61]),{17:[1,65]},o($V1,[2,20]),{21:$V2,23:[1,67],38:68,52:66},o([9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,29,31,32,33,36,39,40,41,42],$V0,{6:3,4:69}),o([9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,29,31,33,35,36,39,40,41,42,48],$V0,{6:3,4:70}),o($V1,[2,23]),o($V1,[2,25]),o($V1,[2,26]),o([11,12,14,15,17,20,21,22,23],[2,32],{50:71,16:[1,72],18:[1,74],19:[1,73]}),o($Vd,[2,50],{26:75}),o($Va,[2,47]),{12:[2,37],14:[1,76]},o($Ve,[2,38]),o($Ve,[2,39]),{32:[1,77]},{34:78,35:[2,54],47:79,48:[1,80]},o($Vb,[2,57]),{11:$V3,14:$V4,18:$V5,20:$V6,21:$V2,22:$V7,23:$V8,25:81,38:41,53:35,54:36},{22:[1,82]},{11:$V3,14:$V4,17:[2,58],18:$V5,20:$V6,21:$V2,22:$V7,23:$V8,25:84,38:41,51:83,53:35,54:36},{27:85,28:[2,52],43:87,44:[1,89],45:86,46:[1,88]},{22:$V9,30:90},o($V1,[2,21]),{35:[1,91]},{35:[2,55]},o([9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,29,31,33,35,36,39,40,41,42],$V0,{6:3,4:92}),{15:[1,93]},o($Vb,[2,34]),{17:[1,94]},{17:[2,59]},{28:[1,95]},o($Vd,[2,51]),{28:[2,53]},{11:$V3,14:$V4,18:$V5,20:$V6,21:$V2,22:$V7,23:$V8,25:96,38:41,53:35,54:36},o([9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28,29,31,33,36,39,40,41,42],$V0,{6:3,4:97}),{12:[2,36]},o($V1,[2,22]),{35:[2,31]},o($Vb,[2,33]),o($Vb,[2,35]),o($V1,[2,19]),{12:[1,98]},{28:[2,29]},o($Vc,$V0,{6:3,4:99}),o($Vd,[2,30])],
149defaultActions: {4:[2,1],79:[2,55],84:[2,59],87:[2,53],90:[2,36],92:[2,31],97:[2,29]},
fd61a04b
TD
150parseError: function parseError(str, hash) {
151 if (hash.recoverable) {
152 this.trace(str);
153 } else {
6ebad43d
MM
154 function _parseError (msg, hash) {
155 this.message = msg;
156 this.hash = hash;
157 }
158 _parseError.prototype = Error;
159
160 throw new _parseError(str, hash);
fd61a04b
TD
161 }
162},
163parse: function parse(input) {
164 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
165 var args = lstack.slice.call(arguments, 1);
166 var lexer = Object.create(this.lexer);
167 var sharedState = { yy: {} };
168 for (var k in this.yy) {
169 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
170 sharedState.yy[k] = this.yy[k];
171 }
172 }
173 lexer.setInput(input, sharedState.yy);
174 sharedState.yy.lexer = lexer;
175 sharedState.yy.parser = this;
176 if (typeof lexer.yylloc == 'undefined') {
177 lexer.yylloc = {};
178 }
179 var yyloc = lexer.yylloc;
180 lstack.push(yyloc);
181 var ranges = lexer.options && lexer.options.ranges;
182 if (typeof sharedState.yy.parseError === 'function') {
183 this.parseError = sharedState.yy.parseError;
184 } else {
185 this.parseError = Object.getPrototypeOf(this).parseError;
186 }
187 function popStack(n) {
188 stack.length = stack.length - 2 * n;
189 vstack.length = vstack.length - n;
190 lstack.length = lstack.length - n;
191 }
192 _token_stack:
6ebad43d 193 var lex = function () {
fd61a04b
TD
194 var token;
195 token = lexer.lex() || EOF;
196 if (typeof token !== 'number') {
197 token = self.symbols_[token] || token;
198 }
199 return token;
6ebad43d 200 };
fd61a04b
TD
201 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
202 while (true) {
203 state = stack[stack.length - 1];
204 if (this.defaultActions[state]) {
205 action = this.defaultActions[state];
206 } else {
207 if (symbol === null || typeof symbol == 'undefined') {
208 symbol = lex();
209 }
210 action = table[state] && table[state][symbol];
211 }
212 if (typeof action === 'undefined' || !action.length || !action[0]) {
213 var errStr = '';
214 expected = [];
215 for (p in table[state]) {
216 if (this.terminals_[p] && p > TERROR) {
217 expected.push('\'' + this.terminals_[p] + '\'');
218 }
219 }
220 if (lexer.showPosition) {
221 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
222 } else {
223 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
224 }
225 this.parseError(errStr, {
226 text: lexer.match,
227 token: this.terminals_[symbol] || symbol,
228 line: lexer.yylineno,
229 loc: yyloc,
230 expected: expected
231 });
232 }
233 if (action[0] instanceof Array && action.length > 1) {
234 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
235 }
236 switch (action[0]) {
237 case 1:
238 stack.push(symbol);
239 vstack.push(lexer.yytext);
240 lstack.push(lexer.yylloc);
241 stack.push(action[1]);
242 symbol = null;
243 if (!preErrorSymbol) {
244 yyleng = lexer.yyleng;
245 yytext = lexer.yytext;
246 yylineno = lexer.yylineno;
247 yyloc = lexer.yylloc;
248 if (recovering > 0) {
249 recovering--;
250 }
251 } else {
252 symbol = preErrorSymbol;
253 preErrorSymbol = null;
254 }
255 break;
256 case 2:
257 len = this.productions_[action[1]][1];
258 yyval.$ = vstack[vstack.length - len];
259 yyval._$ = {
260 first_line: lstack[lstack.length - (len || 1)].first_line,
261 last_line: lstack[lstack.length - 1].last_line,
262 first_column: lstack[lstack.length - (len || 1)].first_column,
263 last_column: lstack[lstack.length - 1].last_column
264 };
265 if (ranges) {
266 yyval._$.range = [
267 lstack[lstack.length - (len || 1)].range[0],
268 lstack[lstack.length - 1].range[1]
269 ];
270 }
271 r = this.performAction.apply(yyval, [
272 yytext,
273 yyleng,
274 yylineno,
275 sharedState.yy,
276 action[1],
277 vstack,
278 lstack
279 ].concat(args));
280 if (typeof r !== 'undefined') {
281 return r;
282 }
283 if (len) {
284 stack = stack.slice(0, -1 * len * 2);
285 vstack = vstack.slice(0, -1 * len);
286 lstack = lstack.slice(0, -1 * len);
287 }
288 stack.push(this.productions_[action[1]][0]);
289 vstack.push(yyval.$);
290 lstack.push(yyval._$);
291 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
292 stack.push(newState);
293 break;
294 case 3:
295 return true;
296 }
297 }
298 return true;
299}};
300
301/* generated by jison-lex 0.3.4 */
302var lexer = (function(){
303var lexer = ({
304
305EOF:1,
306
307parseError:function parseError(str, hash) {
308 if (this.yy.parser) {
309 this.yy.parser.parseError(str, hash);
310 } else {
311 throw new Error(str);
312 }
313 },
314
315// resets the lexer, sets new input
316setInput:function (input, yy) {
317 this.yy = yy || this.yy || {};
318 this._input = input;
319 this._more = this._backtrack = this.done = false;
320 this.yylineno = this.yyleng = 0;
321 this.yytext = this.matched = this.match = '';
322 this.conditionStack = ['INITIAL'];
323 this.yylloc = {
324 first_line: 1,
325 first_column: 0,
326 last_line: 1,
327 last_column: 0
328 };
329 if (this.options.ranges) {
330 this.yylloc.range = [0,0];
331 }
332 this.offset = 0;
333 return this;
334 },
335
336// consumes and returns one char from the input
337input:function () {
338 var ch = this._input[0];
339 this.yytext += ch;
340 this.yyleng++;
341 this.offset++;
342 this.match += ch;
343 this.matched += ch;
344 var lines = ch.match(/(?:\r\n?|\n).*/g);
345 if (lines) {
346 this.yylineno++;
347 this.yylloc.last_line++;
348 } else {
349 this.yylloc.last_column++;
350 }
351 if (this.options.ranges) {
352 this.yylloc.range[1]++;
353 }
354
355 this._input = this._input.slice(1);
356 return ch;
357 },
358
359// unshifts one char (or a string) into the input
360unput:function (ch) {
361 var len = ch.length;
362 var lines = ch.split(/(?:\r\n?|\n)/g);
363
364 this._input = ch + this._input;
365 this.yytext = this.yytext.substr(0, this.yytext.length - len);
366 //this.yyleng -= len;
367 this.offset -= len;
368 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
369 this.match = this.match.substr(0, this.match.length - 1);
370 this.matched = this.matched.substr(0, this.matched.length - 1);
371
372 if (lines.length - 1) {
373 this.yylineno -= lines.length - 1;
374 }
375 var r = this.yylloc.range;
376
377 this.yylloc = {
378 first_line: this.yylloc.first_line,
379 last_line: this.yylineno + 1,
380 first_column: this.yylloc.first_column,
381 last_column: lines ?
382 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
383 + oldLines[oldLines.length - lines.length].length - lines[0].length :
384 this.yylloc.first_column - len
385 };
386
387 if (this.options.ranges) {
388 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
389 }
390 this.yyleng = this.yytext.length;
391 return this;
392 },
393
394// When called from action, caches matched text and appends it on next action
395more:function () {
396 this._more = true;
397 return this;
398 },
399
400// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
401reject:function () {
402 if (this.options.backtrack_lexer) {
403 this._backtrack = true;
404 } else {
405 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
406 text: "",
407 token: null,
408 line: this.yylineno
409 });
410
411 }
412 return this;
413 },
414
415// retain first n characters of the match
416less:function (n) {
417 this.unput(this.match.slice(n));
418 },
419
420// displays already matched input, i.e. for error messages
421pastInput:function () {
422 var past = this.matched.substr(0, this.matched.length - this.match.length);
423 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
424 },
425
426// displays upcoming input, i.e. for error messages
427upcomingInput:function () {
428 var next = this.match;
429 if (next.length < 20) {
430 next += this._input.substr(0, 20-next.length);
431 }
432 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
433 },
434
435// displays the character position where the lexing error occurred, i.e. for error messages
436showPosition:function () {
437 var pre = this.pastInput();
438 var c = new Array(pre.length + 1).join("-");
439 return pre + this.upcomingInput() + "\n" + c + "^";
440 },
441
442// test the lexed token: return FALSE when not a match, otherwise return token
443test_match:function (match, indexed_rule) {
444 var token,
445 lines,
446 backup;
447
448 if (this.options.backtrack_lexer) {
449 // save context
450 backup = {
451 yylineno: this.yylineno,
452 yylloc: {
453 first_line: this.yylloc.first_line,
454 last_line: this.last_line,
455 first_column: this.yylloc.first_column,
456 last_column: this.yylloc.last_column
457 },
458 yytext: this.yytext,
459 match: this.match,
460 matches: this.matches,
461 matched: this.matched,
462 yyleng: this.yyleng,
463 offset: this.offset,
464 _more: this._more,
465 _input: this._input,
466 yy: this.yy,
467 conditionStack: this.conditionStack.slice(0),
468 done: this.done
469 };
470 if (this.options.ranges) {
471 backup.yylloc.range = this.yylloc.range.slice(0);
472 }
473 }
474
475 lines = match[0].match(/(?:\r\n?|\n).*/g);
476 if (lines) {
477 this.yylineno += lines.length;
478 }
479 this.yylloc = {
480 first_line: this.yylloc.last_line,
481 last_line: this.yylineno + 1,
482 first_column: this.yylloc.last_column,
483 last_column: lines ?
484 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
485 this.yylloc.last_column + match[0].length
486 };
487 this.yytext += match[0];
488 this.match += match[0];
489 this.matches = match;
490 this.yyleng = this.yytext.length;
491 if (this.options.ranges) {
492 this.yylloc.range = [this.offset, this.offset += this.yyleng];
493 }
494 this._more = false;
495 this._backtrack = false;
496 this._input = this._input.slice(match[0].length);
497 this.matched += match[0];
498 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
499 if (this.done && this._input) {
500 this.done = false;
501 }
502 if (token) {
503 return token;
504 } else if (this._backtrack) {
505 // recover context
506 for (var k in backup) {
507 this[k] = backup[k];
508 }
509 return false; // rule action called reject() implying the next rule should be tested instead.
510 }
511 return false;
512 },
513
514// return next match in input
515next:function () {
516 if (this.done) {
517 return this.EOF;
518 }
519 if (!this._input) {
520 this.done = true;
521 }
522
523 var token,
524 match,
525 tempMatch,
526 index;
527 if (!this._more) {
528 this.yytext = '';
529 this.match = '';
530 }
531 var rules = this._currentRules();
532 for (var i = 0; i < rules.length; i++) {
533 tempMatch = this._input.match(this.rules[rules[i]]);
534 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
535 match = tempMatch;
536 index = i;
537 if (this.options.backtrack_lexer) {
538 token = this.test_match(tempMatch, rules[i]);
539 if (token !== false) {
540 return token;
541 } else if (this._backtrack) {
542 match = false;
543 continue; // rule action called reject() implying a rule MISmatch.
544 } else {
545 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
546 return false;
547 }
548 } else if (!this.options.flex) {
549 break;
550 }
551 }
552 }
553 if (match) {
554 token = this.test_match(match, rules[index]);
555 if (token !== false) {
556 return token;
557 }
558 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
559 return false;
560 }
561 if (this._input === "") {
562 return this.EOF;
563 } else {
564 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
565 text: "",
566 token: null,
567 line: this.yylineno
568 });
569 }
570 },
571
572// return next match that has a token
573lex:function lex() {
574 var r = this.next();
575 if (r) {
576 return r;
577 } else {
578 return this.lex();
579 }
580 },
581
582// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
583begin:function begin(condition) {
584 this.conditionStack.push(condition);
585 },
586
587// pop the previously active lexer condition state off the condition stack
588popState:function popState() {
589 var n = this.conditionStack.length - 1;
590 if (n > 0) {
591 return this.conditionStack.pop();
592 } else {
593 return this.conditionStack[0];
594 }
595 },
596
597// produce the lexer rule set which is active for the currently active lexer condition state
598_currentRules:function _currentRules() {
599 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
600 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
601 } else {
602 return this.conditions["INITIAL"].rules;
603 }
604 },
605
606// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
607topState:function topState(n) {
608 n = this.conditionStack.length - 1 - Math.abs(n || 0);
609 if (n >= 0) {
610 return this.conditionStack[n];
611 } else {
612 return "INITIAL";
613 }
614 },
615
616// alias for begin(condition)
617pushState:function pushState(condition) {
618 this.begin(condition);
619 },
620
621// return the number of states currently on the stack
622stateStackSize:function stateStackSize() {
623 return this.conditionStack.length;
624 },
625options: {},
626performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
627var YYSTATE=YY_START;
628switch($avoiding_name_collisions) {
629case 0:/* comment */
630break;
631case 1: yy_.yytext = yy_.yytext.substring(9, yy_.yytext.length - 10); return 9;
632break;
633case 2:return 23;
634break;
635case 3:return 23;
636break;
637case 4:return 21;
638break;
639case 5: return 22;
640break;
641case 6:return 19;
642break;
643case 7:return 16;
644break;
645case 8:return 15;
646break;
647case 9:return 18;
648break;
649case 10:return 17;
650break;
651case 11:return 20;
652break;
653case 12:return 41;
654break;
655case 13:return 42;
656break;
657case 14:return 39;
658break;
659case 15:return 40;
660break;
661case 16: this.begin('command'); return 24;
662break;
663case 17: this.begin('command'); return 46;
664break;
665case 18: this.begin('command'); return 46;
666break;
667case 19:return 44;
668break;
669case 20:return 28;
670break;
671case 21:return 36;
672break;
673case 22:return 37;
674break;
675case 23: this.begin('command'); return 29;
676break;
677case 24: this.begin('command'); return 31;
678break;
679case 25:return 32;
680break;
681case 26: this.begin('command'); return 33;
682break;
683case 27:return 48;
684break;
685case 28:return 35;
686break;
687case 29:return 13;
688break;
689case 30: this.popState(); return 12;
690break;
691case 31:return 12;
692break;
693case 32:return 14;
694break;
695case 33:return 5;
696break;
697case 34:return 11;
698break;
699}
700},
6ebad43d 701rules: [/^(?:\{\*[\s\S]*?\*\})/,/^(?:\{literal\}[\s\S]*?\{\/literal\})/,/^(?:"([^"]|\\\.)*")/,/^(?:'([^']|\\\.)*')/,/^(?:\$)/,/^(?:[_a-zA-Z][_a-zA-Z0-9]*)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:=)/,/^(?:\{ldelim\})/,/^(?:\{rdelim\})/,/^(?:\{#)/,/^(?:\{@)/,/^(?:\{if )/,/^(?:\{else if )/,/^(?:\{elseif )/,/^(?:\{else\})/,/^(?:\{\/if\})/,/^(?:\{lang\})/,/^(?:\{\/lang\})/,/^(?:\{include )/,/^(?:\{implode )/,/^(?:\{\/implode\})/,/^(?:\{foreach )/,/^(?:\{foreachelse\})/,/^(?:\{\/foreach\})/,/^(?:\{)/,/^(?:\})/,/^(?:\})/,/^(?:\s+)/,/^(?:$)/,/^(?:[^{])/],
fd61a04b
TD
702conditions: {"command":{"rules":[0,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],"inclusive":true},"INITIAL":{"rules":[0,1,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,31,32,33,34],"inclusive":true}}
703});
704return lexer;
705})();
706parser.lexer = lexer;
707return parser;
708});