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