]> git.pld-linux.org Git - packages/kannel.git/blame - kannel-bison.patch
- updated to 1.4.5
[packages/kannel.git] / kannel-bison.patch
CommitLineData
696776f7
AG
1bison 3.0+ support, patch from https://redmine.kannel.org/issues/699
2
3diff -ur gateway-1.4.5.orig/wmlscript/wsgram.y gateway-1.4.5/wmlscript/wsgram.y
4--- gateway-1.4.5.orig/wmlscript/wsgram.y 2013-12-17 05:50:51.000000000 -0500
5+++ gateway-1.4.5/wmlscript/wsgram.y 2018-08-17 15:43:57.000000000 -0500
6@@ -14,18 +14,9 @@
7
8 #include "wmlscript/wsint.h"
9
10-/* The required yyerror() function. This is actually not used but to
11- report the internal parser errors. All other errors are reported
12- by using the `wserror.h' functions. */
13-extern void yyerror(char *msg);
14-
15-#if WS_DEBUG
16-/* Just for debugging purposes. */
17-WsCompilerPtr global_compiler = NULL;
18-#endif /* WS_DEBUG */
19-
20 %}
21
22+
23 /* The possible semantic values. */
24 %union
25 {
26@@ -45,6 +36,19 @@
27 WsExpression *expr;
28 }
29
30+%{
31+/* The required yyerror() function. This is actually not used but to
32+ report the internal parser errors. All other errors are reported
33+ by using the `wserror.h' functions. */
34+extern void yyerror(YYLTYPE* locp, WsCompiler* compiler, const char* msg);
35+
36+#if WS_DEBUG
37+/* Just for debugging purposes. */
38+WsCompilerPtr global_compiler = NULL;
39+#endif /* WS_DEBUG */
40+
41+%}
42+
43 /* Tokens. */
44
45 /* Language literals. */
46@@ -106,6 +110,8 @@
47
48 /* Generate reentrant parser. */
49 %pure-parser
50+%parse-param { WsCompiler* compiler }
51+%lex-param { WsCompiler* compiler }
52
53 /* This grammar has one shift-reduce conflict. It comes from the
54 if-else statement. */
55@@ -119,7 +125,7 @@
56 Pragmas FunctionDeclarations
57 | FunctionDeclarations
58 | error
59- { ws_error_syntax(pctx, @1.first_line); }
60+ { ws_error_syntax(compiler, @1.first_line); }
61 ;
62
63 /* Pragmas. */
64@@ -132,7 +138,7 @@
65 Pragma:
66 tUSE PragmaDeclaration ';'
67 | error
68- { ws_error_syntax(pctx, @1.first_line); }
69+ { ws_error_syntax(compiler, @1.first_line); }
70 ;
71
72 PragmaDeclaration:
73@@ -143,7 +149,7 @@
74
75 ExternalCompilationUnitPragma:
76 tURL tIDENTIFIER tSTRING
77- { ws_pragma_use(pctx, @2.first_line, $2, $3); }
78+ { ws_pragma_use(compiler, @2.first_line, $2, $3); }
79 ;
80
81 AccessControlPragma:
82@@ -153,28 +159,23 @@
83 AccessControlSpecifier:
84 tDOMAIN tSTRING
85 {
86- WsCompiler *compiler = (WsCompiler *) pctx;
87-
88 /* Pass this to the byte-code */
89 if (!ws_bc_add_pragma_access_domain(compiler->bc, $2->data,
90 $2->len))
91- ws_error_memory(pctx);
92+ ws_error_memory(compiler);
93 ws_lexer_free_utf8(compiler, $2);
94 }
95 | tPATH tSTRING
96 {
97- WsCompiler *compiler = (WsCompiler *) pctx;
98-
99 /* Pass this to the byte-code */
100 if (!ws_bc_add_pragma_access_path(compiler->bc, $2->data,
101 $2->len))
102- ws_error_memory(pctx);
103+ ws_error_memory(compiler);
104
105 ws_lexer_free_utf8(compiler, $2);
106 }
107 | tDOMAIN tSTRING tPATH tSTRING
108 {
109- WsCompiler *compiler = (WsCompiler *) pctx;
110 WsBool success = WS_TRUE;
111
112 /* Pass these to the byte-code */
113@@ -187,7 +188,7 @@
114 success = WS_FALSE;
115
116 if (!success)
117- ws_error_memory(pctx);
118+ ws_error_memory(compiler);
119
120 ws_lexer_free_utf8(compiler, $2);
121 ws_lexer_free_utf8(compiler, $4);
122@@ -207,8 +208,6 @@
123 MetaName:
124 tNAME MetaBody
125 {
126- WsCompiler *compiler = (WsCompiler *) pctx;
127-
128 /* Meta information for the origin servers. Show it
129 * to the user if requested. */
130 if (compiler->params.meta_name_cb)
131@@ -225,8 +224,6 @@
132 MetaHttpEquiv:
133 tHTTP tEQUIV MetaBody
134 {
135- WsCompiler *compiler = (WsCompiler *) pctx;
136-
137 /* Meta information HTTP header that should be
138 * included to an HTTP response header. Show it to
139 * the user if requested. */
140@@ -246,7 +243,6 @@
141 tUSER tAGENT MetaBody
142 {
143 WsBool success;
144- WsCompiler *compiler = (WsCompiler *) pctx;
145
146 /* Pass this pragma to the byte-code */
147 if ($3) {
148@@ -272,16 +268,16 @@
149 ws_pragma_meta_body_free(compiler, $3);
150
151 if (!success)
152- ws_error_memory(pctx);
153+ ws_error_memory(compiler);
154 }
155 }
156 ;
157
158 MetaBody:
159 MetaPropertyName MetaContent
160- { $$ = ws_pragma_meta_body(pctx, $1, $2, NULL); }
161+ { $$ = ws_pragma_meta_body(compiler, $1, $2, NULL); }
162 | MetaPropertyName MetaContent MetaScheme
163- { $$ = ws_pragma_meta_body(pctx, $1, $2, $3); }
164+ { $$ = ws_pragma_meta_body(compiler, $1, $2, $3); }
165 ;
166
167 MetaPropertyName: tSTRING;
168@@ -301,12 +297,12 @@
169 {
170 char *name = ws_strdup($3);
171
172- ws_lexer_free_block(pctx, $3);
173+ ws_lexer_free_block(compiler, $3);
174
175 if (name)
176- ws_function(pctx, $1, name, @3.first_line, $5, $7);
177+ ws_function(compiler, $1, name, @3.first_line, $5, $7);
178 else
179- ws_error_memory(pctx);
180+ ws_error_memory(compiler);
181 }
182 ;
183
184@@ -317,7 +313,7 @@
185
186 FormalParameterListOpt:
187 /* empty */
188- { $$ = ws_list_new(pctx); }
189+ { $$ = ws_list_new(compiler); }
190 | FormalParameterList
191 ;
192
193@@ -332,17 +328,17 @@
194 char *id;
195 WsFormalParm *parm;
196
197- id = ws_f_strdup(((WsCompiler *) pctx)->pool_stree, $1);
198- parm = ws_formal_parameter(pctx, @1.first_line, id);
199+ id = ws_f_strdup((compiler)->pool_stree, $1);
200+ parm = ws_formal_parameter(compiler, @1.first_line, id);
201
202- ws_lexer_free_block(pctx, $1);
203+ ws_lexer_free_block(compiler, $1);
204
205 if (id == NULL || parm == NULL) {
206- ws_error_memory(pctx);
207+ ws_error_memory(compiler);
208 $$ = NULL;
209 } else {
210- $$ = ws_list_new(pctx);
211- ws_list_append(pctx, $$, parm);
212+ $$ = ws_list_new(compiler);
213+ ws_list_append(compiler, $$, parm);
214 }
215 }
216 | FormalParameterList ',' tIDENTIFIER
217@@ -350,16 +346,16 @@
218 char *id;
219 WsFormalParm *parm;
220
221- id = ws_f_strdup(((WsCompiler *) pctx)->pool_stree, $3);
222- parm = ws_formal_parameter(pctx, @1.first_line, id);
223+ id = ws_f_strdup(compiler->pool_stree, $3);
224+ parm = ws_formal_parameter(compiler, @1.first_line, id);
225
226- ws_lexer_free_block(pctx, $3);
227+ ws_lexer_free_block(compiler, $3);
228
229 if (id == NULL || parm == NULL) {
230- ws_error_memory(pctx);
231+ ws_error_memory(compiler);
232 $$ = NULL;
233 } else
234- ws_list_append(pctx, $1, parm);
235+ ws_list_append(compiler, $1, parm);
236 }
237 ;
238
239@@ -369,22 +365,22 @@
240 Block
241 {
242 if ($1)
243- $$ = ws_stmt_block(pctx, $1->first_line, $1->last_line,
244+ $$ = ws_stmt_block(compiler, $1->first_line, $1->last_line,
245 $1);
246 else
247 $$ = NULL;
248 }
249 | VariableStatement
250 | ';' /* EmptyStatement */
251- { $$ = ws_stmt_empty(pctx, @1.first_line); }
252+ { $$ = ws_stmt_empty(compiler, @1.first_line); }
253 | Expression ';' /* ExpressionStatement */
254- { $$ = ws_stmt_expr(pctx, $1->line, $1); }
255+ { $$ = ws_stmt_expr(compiler, $1->line, $1); }
256 | IfStatement
257 | IterationStatement
258 | tCONTINUE ';' /* ContinueStatement */
259- { $$ = ws_stmt_continue(pctx, @1.first_line); }
260+ { $$ = ws_stmt_continue(compiler, @1.first_line); }
261 | tBREAK ';' /* BreakStatement */
262- { $$ = ws_stmt_break(pctx, @1.first_line); }
263+ { $$ = ws_stmt_break(compiler, @1.first_line); }
264 | ReturnStatement
265 ;
266
267@@ -398,56 +394,56 @@
268 }
269 | error
270 {
271- ws_error_syntax(pctx, @1.first_line);
272+ ws_error_syntax(compiler, @1.first_line);
273 $$ = NULL;
274 }
275 ;
276
277 StatementListOpt:
278 /* empty */
279- { $$ = ws_list_new(pctx); }
280+ { $$ = ws_list_new(compiler); }
281 | StatementList
282 ;
283
284 StatementList:
285 Statement
286 {
287- $$ = ws_list_new(pctx);
288- ws_list_append(pctx, $$, $1);
289+ $$ = ws_list_new(compiler);
290+ ws_list_append(compiler, $$, $1);
291 }
292 | StatementList Statement
293- { ws_list_append(pctx, $1, $2); }
294+ { ws_list_append(compiler, $1, $2); }
295 ;
296
297 VariableStatement:
298 tVAR VariableDeclarationList ';'
299- { $$ = ws_stmt_variable(pctx, @1.first_line, $2); }
300+ { $$ = ws_stmt_variable(compiler, @1.first_line, $2); }
301 | tVAR error
302- { ws_error_syntax(pctx, @2.first_line); }
303+ { ws_error_syntax(compiler, @2.first_line); }
304 ;
305
306 VariableDeclarationList:
307 VariableDeclaration
308 {
309- $$ = ws_list_new(pctx);
310- ws_list_append(pctx, $$, $1);
311+ $$ = ws_list_new(compiler);
312+ ws_list_append(compiler, $$, $1);
313 }
314 | VariableDeclarationList ',' VariableDeclaration
315- { ws_list_append(pctx, $1, $3); }
316+ { ws_list_append(compiler, $1, $3); }
317 ;
318
319 VariableDeclaration:
320 tIDENTIFIER VariableInitializedOpt
321 {
322- char *id = ws_f_strdup(((WsCompiler *) pctx)->pool_stree,
323+ char *id = ws_f_strdup(compiler->pool_stree,
324 $1);
325
326- ws_lexer_free_block(pctx, $1);
327+ ws_lexer_free_block(compiler, $1);
328 if (id == NULL) {
329- ws_error_memory(pctx);
330+ ws_error_memory(compiler);
331 $$ = NULL;
332 } else
333- $$ = ws_variable_declaration(pctx, id, $2);
334+ $$ = ws_variable_declaration(compiler, id, $2);
335 }
336 ;
337
338@@ -460,29 +456,29 @@
339
340 IfStatement:
341 tIF '(' Expression ')' Statement tELSE Statement
342- { $$ = ws_stmt_if(pctx, @1.first_line, $3, $5, $7); }
343+ { $$ = ws_stmt_if(compiler, @1.first_line, $3, $5, $7); }
344 | tIF '(' Expression ')' Statement
345- { $$ = ws_stmt_if(pctx, @1.first_line, $3, $5, NULL); }
346+ { $$ = ws_stmt_if(compiler, @1.first_line, $3, $5, NULL); }
347 ;
348
349 IterationStatement:
350 tWHILE '(' Expression ')' Statement
351- { $$ = ws_stmt_while(pctx, @1.first_line, $3, $5); }
352+ { $$ = ws_stmt_while(compiler, @1.first_line, $3, $5); }
353 | ForStatement
354 ;
355
356 ForStatement:
357 tFOR '(' ExpressionOpt ';' ExpressionOpt ';' ExpressionOpt ')'
358 Statement
359- { $$ = ws_stmt_for(pctx, @1.first_line, NULL, $3, $5, $7, $9); }
360+ { $$ = ws_stmt_for(compiler, @1.first_line, NULL, $3, $5, $7, $9); }
361 | tFOR '(' tVAR VariableDeclarationList ';' ExpressionOpt ';'
362 ExpressionOpt ')' Statement
363- { $$ = ws_stmt_for(pctx, @1.first_line, $4, NULL, $6, $8, $10); }
364+ { $$ = ws_stmt_for(compiler, @1.first_line, $4, NULL, $6, $8, $10); }
365 ;
366
367 ReturnStatement:
368 tRETURN ExpressionOpt ';'
369- { $$ = ws_stmt_return(pctx, @1.first_line, $2); }
370+ { $$ = ws_stmt_return(compiler, @1.first_line, $2); }
371 ;
372
373 /* Expressions. */
374@@ -496,135 +492,135 @@
375 Expression:
376 AssignmentExpression
377 | Expression ',' AssignmentExpression
378- { $$ = ws_expr_comma(pctx, @2.first_line, $1, $3); }
379+ { $$ = ws_expr_comma(compiler, @2.first_line, $1, $3); }
380 ;
381
382 AssignmentExpression:
383 ConditionalExpression
384 | tIDENTIFIER '=' AssignmentExpression
385- { $$ = ws_expr_assign(pctx, @1.first_line, $1, '=', $3); }
386+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, '=', $3); }
387 | tIDENTIFIER tMULA AssignmentExpression
388- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tMULA, $3); }
389+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tMULA, $3); }
390 | tIDENTIFIER tDIVA AssignmentExpression
391- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tDIVA, $3); }
392+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tDIVA, $3); }
393 | tIDENTIFIER tREMA AssignmentExpression
394- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tREMA, $3); }
395+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tREMA, $3); }
396 | tIDENTIFIER tADDA AssignmentExpression
397- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tADDA, $3); }
398+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tADDA, $3); }
399 | tIDENTIFIER tSUBA AssignmentExpression
400- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tSUBA, $3); }
401+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tSUBA, $3); }
402 | tIDENTIFIER tLSHIFTA AssignmentExpression
403- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tLSHIFTA, $3); }
404+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tLSHIFTA, $3); }
405 | tIDENTIFIER tRSSHIFTA AssignmentExpression
406- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tRSSHIFTA, $3); }
407+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tRSSHIFTA, $3); }
408 | tIDENTIFIER tRSZSHIFTA AssignmentExpression
409- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tRSZSHIFTA, $3); }
410+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tRSZSHIFTA, $3); }
411 | tIDENTIFIER tANDA AssignmentExpression
412- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tANDA, $3); }
413+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tANDA, $3); }
414 | tIDENTIFIER tXORA AssignmentExpression
415- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tXORA, $3); }
416+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tXORA, $3); }
417 | tIDENTIFIER tORA AssignmentExpression
418- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tORA, $3); }
419+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tORA, $3); }
420 | tIDENTIFIER tIDIVA AssignmentExpression
421- { $$ = ws_expr_assign(pctx, @1.first_line, $1, tIDIVA, $3); }
422+ { $$ = ws_expr_assign(compiler, @1.first_line, $1, tIDIVA, $3); }
423 ;
424
425 ConditionalExpression:
426 LogicalORExpression
427 | LogicalORExpression '?' AssignmentExpression ':' AssignmentExpression
428- { $$ = ws_expr_conditional(pctx, @2.first_line, $1, $3, $5); }
429+ { $$ = ws_expr_conditional(compiler, @2.first_line, $1, $3, $5); }
430 ;
431
432 LogicalORExpression:
433 LogicalANDExpression
434 | LogicalORExpression tOR LogicalANDExpression
435- { $$ = ws_expr_logical(pctx, @2.first_line, WS_ASM_SCOR, $1, $3); }
436+ { $$ = ws_expr_logical(compiler, @2.first_line, WS_ASM_SCOR, $1, $3); }
437 ;
438
439 LogicalANDExpression:
440 BitwiseORExpression
441 | LogicalANDExpression tAND BitwiseORExpression
442- { $$ = ws_expr_logical(pctx, @2.first_line, WS_ASM_SCAND, $1, $3); }
443+ { $$ = ws_expr_logical(compiler, @2.first_line, WS_ASM_SCAND, $1, $3); }
444 ;
445
446 BitwiseORExpression:
447 BitwiseXORExpression
448 | BitwiseORExpression '|' BitwiseXORExpression
449- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_OR, $1, $3); }
450+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_OR, $1, $3); }
451 ;
452
453 BitwiseXORExpression:
454 BitwiseANDExpression
455 | BitwiseXORExpression '^' BitwiseANDExpression
456- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_XOR, $1, $3); }
457+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_XOR, $1, $3); }
458 ;
459
460 BitwiseANDExpression:
461 EqualityExpression
462 | BitwiseANDExpression '&' EqualityExpression
463- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_AND, $1, $3); }
464+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_AND, $1, $3); }
465 ;
466
467 EqualityExpression:
468 RelationalExpression
469 | EqualityExpression tEQ RelationalExpression
470- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_EQ, $1, $3); }
471+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_EQ, $1, $3); }
472 | EqualityExpression tNE RelationalExpression
473- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_NE, $1, $3); }
474+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_NE, $1, $3); }
475 ;
476
477 RelationalExpression:
478 ShiftExpression
479 | RelationalExpression '<' ShiftExpression
480- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_LT, $1, $3); }
481+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_LT, $1, $3); }
482 | RelationalExpression '>' ShiftExpression
483- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_GT, $1, $3); }
484+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_GT, $1, $3); }
485 | RelationalExpression tLE ShiftExpression
486- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_LE, $1, $3); }
487+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_LE, $1, $3); }
488 | RelationalExpression tGE ShiftExpression
489- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_GE, $1, $3); }
490+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_GE, $1, $3); }
491 ;
492
493 ShiftExpression:
494 AdditiveExpression
495 | ShiftExpression tLSHIFT AdditiveExpression
496- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_LSHIFT, $1, $3); }
497+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_LSHIFT, $1, $3); }
498 | ShiftExpression tRSSHIFT AdditiveExpression
499- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_RSSHIFT, $1, $3); }
500+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_RSSHIFT, $1, $3); }
501 | ShiftExpression tRSZSHIFT AdditiveExpression
502- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_B_RSZSHIFT, $1, $3); }
503+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_B_RSZSHIFT, $1, $3); }
504 ;
505
506 AdditiveExpression:
507 MultiplicativeExpression
508 | AdditiveExpression '+' MultiplicativeExpression
509- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_ADD, $1, $3); }
510+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_ADD, $1, $3); }
511 | AdditiveExpression '-' MultiplicativeExpression
512- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_SUB, $1, $3); }
513+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_SUB, $1, $3); }
514 ;
515
516 MultiplicativeExpression:
517 UnaryExpression
518 | MultiplicativeExpression '*' UnaryExpression
519- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_MUL, $1, $3); }
520+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_MUL, $1, $3); }
521 | MultiplicativeExpression '/' UnaryExpression
522- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_DIV, $1, $3); }
523+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_DIV, $1, $3); }
524 | MultiplicativeExpression tIDIV UnaryExpression
525- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_IDIV, $1, $3); }
526+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_IDIV, $1, $3); }
527 | MultiplicativeExpression '%' UnaryExpression
528- { $$ = ws_expr_binary(pctx, @2.first_line, WS_ASM_REM, $1, $3); }
529+ { $$ = ws_expr_binary(compiler, @2.first_line, WS_ASM_REM, $1, $3); }
530 ;
531
532 UnaryExpression:
533 PostfixExpression
534 | tTYPEOF UnaryExpression
535- { $$ = ws_expr_unary(pctx, @1.first_line, WS_ASM_TYPEOF, $2); }
536+ { $$ = ws_expr_unary(compiler, @1.first_line, WS_ASM_TYPEOF, $2); }
537 | tISVALID UnaryExpression
538- { $$ = ws_expr_unary(pctx, @1.first_line, WS_ASM_ISVALID, $2); }
539+ { $$ = ws_expr_unary(compiler, @1.first_line, WS_ASM_ISVALID, $2); }
540 | tPLUSPLUS tIDENTIFIER
541- { $$ = ws_expr_unary_var(pctx, @1.first_line, WS_TRUE, $2); }
542+ { $$ = ws_expr_unary_var(compiler, @1.first_line, WS_TRUE, $2); }
543 | tMINUSMINUS tIDENTIFIER
544- { $$ = ws_expr_unary_var(pctx, @1.first_line, WS_FALSE, $2); }
545+ { $$ = ws_expr_unary_var(compiler, @1.first_line, WS_FALSE, $2); }
546 | '+' UnaryExpression
547 {
548 /* There is no direct way to compile unary `+'.
549@@ -638,65 +634,65 @@
550 * because binary `+' accepts strings, which makes the
551 * type conversion different.
552 */
553- $$ = ws_expr_binary(pctx, @1.first_line, WS_ASM_SUB, $2,
554- ws_expr_const_integer(pctx, @1.first_line, 0));
555+ $$ = ws_expr_binary(compiler, @1.first_line, WS_ASM_SUB, $2,
556+ ws_expr_const_integer(compiler, @1.first_line, 0));
557 }
558 | '-' UnaryExpression
559- { $$ = ws_expr_unary(pctx, @1.first_line, WS_ASM_UMINUS, $2); }
560+ { $$ = ws_expr_unary(compiler, @1.first_line, WS_ASM_UMINUS, $2); }
561 | '~' UnaryExpression
562- { $$ = ws_expr_unary(pctx, @1.first_line, WS_ASM_B_NOT, $2); }
563+ { $$ = ws_expr_unary(compiler, @1.first_line, WS_ASM_B_NOT, $2); }
564 | '!' UnaryExpression
565- { $$ = ws_expr_unary(pctx, @1.first_line, WS_ASM_NOT, $2); }
566+ { $$ = ws_expr_unary(compiler, @1.first_line, WS_ASM_NOT, $2); }
567 ;
568
569 PostfixExpression:
570 CallExpression
571 | tIDENTIFIER tPLUSPLUS
572- { $$ = ws_expr_postfix_var(pctx, @1.first_line, WS_TRUE, $1); }
573+ { $$ = ws_expr_postfix_var(compiler, @1.first_line, WS_TRUE, $1); }
574 | tIDENTIFIER tMINUSMINUS
575- { $$ = ws_expr_postfix_var(pctx, @1.first_line, WS_FALSE, $1); }
576+ { $$ = ws_expr_postfix_var(compiler, @1.first_line, WS_FALSE, $1); }
577 ;
578
579 CallExpression:
580 PrimaryExpression
581 | tIDENTIFIER Arguments /* LocalScriptFunctionCall */
582 {
583- WsFunctionHash *f = ws_function_hash(pctx, $1);
584+ WsFunctionHash *f = ws_function_hash(compiler, $1);
585
586 /* Add an usage count for the local script function. */
587 if (f)
588 f->usage_count++;
589
590- $$ = ws_expr_call(pctx, @1.first_line, ' ', NULL, $1, $2);
591+ $$ = ws_expr_call(compiler, @1.first_line, ' ', NULL, $1, $2);
592 }
593 | tIDENTIFIER '#' tIDENTIFIER Arguments /* ExternalScriptFunctionCall*/
594- { $$ = ws_expr_call(pctx, @3.first_line, '#', $1, $3, $4); }
595+ { $$ = ws_expr_call(compiler, @3.first_line, '#', $1, $3, $4); }
596 | tIDENTIFIER '.' tIDENTIFIER Arguments /* LibraryFunctionCall */
597- { $$ = ws_expr_call(pctx, @3.first_line, '.', $1, $3, $4); }
598+ { $$ = ws_expr_call(compiler, @3.first_line, '.', $1, $3, $4); }
599 ;
600
601 PrimaryExpression:
602 tIDENTIFIER
603- { $$ = ws_expr_symbol(pctx, @1.first_line, $1); }
604+ { $$ = ws_expr_symbol(compiler, @1.first_line, $1); }
605 | tINVALID
606- { $$ = ws_expr_const_invalid(pctx, @1.first_line); }
607+ { $$ = ws_expr_const_invalid(compiler, @1.first_line); }
608 | tTRUE
609- { $$ = ws_expr_const_true(pctx, @1.first_line); }
610+ { $$ = ws_expr_const_true(compiler, @1.first_line); }
611 | tFALSE
612- { $$ = ws_expr_const_false(pctx, @1.first_line); }
613+ { $$ = ws_expr_const_false(compiler, @1.first_line); }
614 | tINTEGER
615- { $$ = ws_expr_const_integer(pctx, @1.first_line, $1); }
616+ { $$ = ws_expr_const_integer(compiler, @1.first_line, $1); }
617 | tFLOAT
618- { $$ = ws_expr_const_float(pctx, @1.first_line, $1); }
619+ { $$ = ws_expr_const_float(compiler, @1.first_line, $1); }
620 | tSTRING
621- { $$ = ws_expr_const_string(pctx, @1.first_line, $1); }
622+ { $$ = ws_expr_const_string(compiler, @1.first_line, $1); }
623 | '(' Expression ')'
624 { $$ = $2; }
625 ;
626
627 Arguments:
628 '(' ')'
629- { $$ = ws_list_new(pctx); }
630+ { $$ = ws_list_new(compiler); }
631 | '(' ArgumentList ')'
632 { $$ = $2; }
633 ;
634@@ -704,17 +700,17 @@
635 ArgumentList:
636 AssignmentExpression
637 {
638- $$ = ws_list_new(pctx);
639- ws_list_append(pctx, $$, $1);
640+ $$ = ws_list_new(compiler);
641+ ws_list_append(compiler, $$, $1);
642 }
643 | ArgumentList ',' AssignmentExpression
644- { ws_list_append(pctx, $1, $3); }
645+ { ws_list_append(compiler, $1, $3); }
646 ;
647
648 %%
649
650 void
651-yyerror(char *msg)
652+yyerror(YYLTYPE* locp, WsCompiler* compiler, const char* msg)
653 {
654 #if WS_DEBUG
655 fprintf(stderr, "*** %s:%ld: wsc: %s - this msg will be removed ***\n",
656diff -ur gateway-1.4.5.orig/wmlscript/wsint.h gateway-1.4.5/wmlscript/wsint.h
657--- gateway-1.4.5.orig/wmlscript/wsint.h 2018-01-17 04:24:38.000000000 -0500
658+++ gateway-1.4.5/wmlscript/wsint.h 2018-08-17 15:45:26.000000000 -0500
659@@ -269,9 +269,6 @@
660
661 /********************* Lexer and parser *********************************/
662
663-#define YYPARSE_PARAM pctx
664-#define YYLEX_PARAM pctx
665-
666 /* The lexer. */
667 extern int yylex();
668
669@@ -293,6 +290,6 @@
670 void ws_lexer_free_utf8(WsCompiler *compiler, WsUtf8String *string);
671
672 /* The parser. */
673-int ws_yy_parse(void *context);
674+int ws_yy_parse(WsCompiler* compiler);
675
676 #endif /* not WSINT_H */
677diff -ur gateway-1.4.5.orig/wmlscript/wslexer.c gateway-1.4.5/wmlscript/wslexer.c
678--- gateway-1.4.5.orig/wmlscript/wslexer.c 2018-01-17 04:24:38.000000000 -0500
679+++ gateway-1.4.5/wmlscript/wslexer.c 2018-08-17 15:15:28.000000000 -0500
680@@ -218,9 +218,8 @@
681
682 /********************* Global functions *********************************/
683
684-int ws_yy_lex(YYSTYPE *yylval, YYLTYPE *yylloc, void *context)
685+int ws_yy_lex(YYSTYPE *yylval, YYLTYPE *yylloc, WsCompiler* compiler)
686 {
687- WsCompiler *compiler = (WsCompiler *) context;
688 WsUInt32 ch, ch2;
689 WsBuffer buffer;
690 unsigned char *p;
This page took 0.182526 seconds and 4 git commands to generate.