1 /* $Id: swf4compiler.y,v 1.1 2004/05/08 17:17:35 kramm Exp $ */
13 #define YYPARSE_PARAM buffer
20 SWFActionFunction function
;
21 SWFGetUrl2Method getURLMethod
;
71 /* high level functions */
74 /* these three are strdup'ed in compiler.flex, so free them here */
77 %token
<str
> IDENTIFIER
80 %token
<getURLMethod
> GETURL_METHOD
101 /* ascending order of ops ..? */
103 %right
'=' "*=" "/=" "+=" "-="
106 %left
"==" "!=" "===" "!=="
107 %left
'<' '>' "<=" ">=" "<=>"
111 %right
"++" "--" UMINUS
'!'
118 %type
<action
> statements
119 %type
<action
> if_stmt
120 %type
<action
> iter_stmt
121 %type
<action
> cont_stmt
122 %type
<action
> break_stmt
123 %type
<action
> expr_opt
124 %type
<action
> void_function_call
125 %type
<action
> function_call
126 %type
<action
> lhs_expr
127 %type
<action
> pf_expr
128 %type
<action
> rhs_expr
129 %type
<action
> assign_stmt
130 %type
<action
> assign_stmts
131 %type
<action
> assign_stmts_opt
133 %type
<action
> program
135 /* make sure to free these, too! */
145 { *((Buffer
*)buffer
) = $1; }
152 { bufferConcat
($1, $2); }
160 : '{' '}' { $$
= NULL
; }
161 |
'{' statements
'}' { $$
= $2; }
172 | assign_stmts
',' assign_stmt
{ bufferConcat
($1, $3); }
176 : /* empty */ { $$
= NULL
; }
179 { bufferConcat
($1, $2); }
183 /* XXX- I haven't tested the frameloaded() stuff yet.. */
185 : IF
'(' FRAMELOADED
'(' NUMBER
')' ')' stmt ELSE stmt
187 bufferWriteU8
($$
, SWFACTION_WAITFORFRAME
);
188 bufferWriteS16
($$
, 3);
189 bufferWriteS16
($$
, atoi
($5));
191 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
192 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
193 bufferWriteS16
($$
, 2);
194 bufferWriteS16
($$
, bufferLength
($10)+5);
195 bufferConcat
($$
, $10); /* ..here */
196 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
197 bufferWriteS16
($$
, 2);
198 bufferWriteS16
($$
, bufferLength
($8));
199 bufferConcat
($$
, $8); }
201 | IF
'(' FRAMELOADED
'(' NUMBER
')' ')' stmt
203 bufferWriteU8
($$
, SWFACTION_WAITFORFRAME
);
204 bufferWriteS16
($$
, 3);
205 bufferWriteS16
($$
, atoi
($5));
207 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
208 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
209 bufferWriteS16
($$
, 2);
210 bufferWriteS16
($$
, 5);
211 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
); /* ..here */
212 bufferWriteS16
($$
, 2);
213 bufferWriteS16
($$
, bufferLength
($8)); /* ..and then out */
214 bufferConcat
($$
, $8); }
216 /* make this case cleaner.. */
217 | IF
'(' '!' FRAMELOADED
'(' NUMBER
')' ')' stmt
219 bufferWriteU8
($$
, SWFACTION_WAITFORFRAME
);
220 bufferWriteS16
($$
, 3);
221 bufferWriteS16
($$
, atoi
($6));
223 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
224 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
225 bufferWriteS16
($$
, 2);
226 bufferWriteS16
($$
, bufferLength
($9));
227 bufferConcat
($$
, $9); } /* ..here */
229 | IF
'(' FRAMELOADED
'(' expr
')' ')' stmt ELSE stmt
231 bufferWriteU8
($$
, SWFACTION_WAITFORFRAMEEXPRESSION
);
232 bufferWriteS16
($$
, 1);
233 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
234 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
235 bufferWriteS16
($$
, 2);
236 bufferWriteS16
($$
, bufferLength
($10)+5);
237 bufferConcat
($$
, $10); /* ..here */
238 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
239 bufferWriteS16
($$
, 2);
240 bufferWriteS16
($$
, bufferLength
($8));
241 bufferConcat
($$
, $8); }
243 | IF
'(' FRAMELOADED
'(' expr
')' ')' stmt
245 bufferWriteU8
($$
, SWFACTION_WAITFORFRAMEEXPRESSION
);
246 bufferWriteS16
($$
, 1);
247 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
248 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
249 bufferWriteS16
($$
, 2);
250 bufferWriteS16
($$
, 5);
251 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
); /* ..here */
252 bufferWriteS16
($$
, 2);
253 bufferWriteS16
($$
, bufferLength
($8)); /* ..and then out */
254 bufferConcat
($$
, $8); }
256 /* make this case cleaner.. */
257 | IF
'(' '!' FRAMELOADED
'(' expr
')' ')' stmt
259 bufferWriteU8
($$
, SWFACTION_WAITFORFRAMEEXPRESSION
);
260 bufferWriteS16
($$
, 1);
261 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
262 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
263 bufferWriteS16
($$
, 2);
264 bufferWriteS16
($$
, bufferLength
($9));
265 bufferConcat
($$
, $9); } /* ..here */
267 | IF
'(' expr
')' stmt ELSE stmt
268 { bufferWriteU8
($3, SWFACTION_BRANCHIFTRUE
);
269 bufferWriteS16
($3, 2);
270 bufferWriteS16
($3, bufferLength
($7)+5);
271 bufferConcat
($3, $7);
272 bufferWriteU8
($3, SWFACTION_BRANCHALWAYS
);
273 bufferWriteS16
($3, 2);
274 bufferWriteS16
($3, bufferLength
($5));
275 bufferConcat
($3, $5);
278 | IF
'(' expr
')' stmt
279 { bufferWriteU8
($3, SWFACTION_LOGICALNOT
);
280 bufferWriteU8
($3, SWFACTION_BRANCHIFTRUE
);
281 bufferWriteS16
($3, 2);
282 bufferWriteS16
($3, bufferLength
($5));
283 bufferConcat
($3, $5);
288 : /* empty */ { $$
= NULL
; }
292 /* not thought out yet..
294 : SWITCH '(' expr ')' '{'
298 { bufferConcat($$, $7); }
302 : switch_cases switch_case
307 : CASE INTEGER ':' stmt
308 { $$ = newBuffer(); }
313 : WHILE
'(' '!' FRAMELOADED
'(' NUMBER
')' ')' stmt
315 bufferWriteU8
($$
, SWFACTION_WAITFORFRAME
);
316 bufferWriteS16
($$
, 3);
317 bufferWriteS16
($$
, atoi
($6));
319 bufferWriteU8
($$
, 1); /* if not loaded, jump to.. */
320 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
321 bufferWriteS16
($$
, 2);
322 bufferWriteS16
($$
, bufferLength
($9)+5);
323 bufferConcat
($$
, $9); /* ..here */
324 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
325 bufferWriteS16
($$
, 2);
326 bufferWriteS16
($$
, -(bufferLength
($$
)+2)); }
328 | WHILE
'(' expr
')' stmt
330 bufferWriteU8
($$
, SWFACTION_LOGICALNOT
);
331 bufferWriteU8
($$
, SWFACTION_BRANCHIFTRUE
);
332 bufferWriteS16
($$
, 2);
333 bufferWriteS16
($$
, bufferLength
($5)+5);
334 bufferConcat
($$
, $5);
335 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
336 bufferWriteS16
($$
, 2);
337 bufferWriteS16
($$
, -(bufferLength
($$
)+2));
338 bufferResolveJumps
($$
); }
340 | DO stmt WHILE
'(' expr
')'
342 bufferConcat
($$
, $5);
343 bufferWriteU8
($$
, SWFACTION_BRANCHIFTRUE
);
344 bufferWriteS16
($$
, 2);
345 bufferWriteS16
($$
, -(bufferLength
($$
)+2));
346 bufferResolveJumps
($$
); }
348 | FOR
'(' assign_stmts_opt
';' expr_opt
';' assign_stmts_opt
')' stmt
352 bufferWriteU8
($5, SWFACTION_LOGICALNOT
);
353 bufferWriteU8
($5, SWFACTION_BRANCHIFTRUE
);
354 bufferWriteS16
($5, 2);
355 bufferWriteS16
($5, bufferLength
($9)+bufferLength
($7)+5);
357 bufferConcat
($5, $9);
358 bufferConcat
($5, $7);
359 bufferWriteU8
($5, SWFACTION_BRANCHALWAYS
);
360 bufferWriteS16
($5, 2);
361 bufferWriteS16
($5, -(bufferLength
($5)+2));
362 bufferResolveJumps
($5);
364 if
(!$$
) $$
= newBuffer
();
365 bufferConcat
($$
, $5);
370 : /* empty */ { $$
= NULL
; }
377 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
378 bufferWriteS16
($$
, 2);
379 bufferWriteS16
($$
, MAGIC_CONTINUE_NUMBER
); }
385 bufferWriteU8
($$
, SWFACTION_BRANCHALWAYS
);
386 bufferWriteS16
($$
, 2);
387 bufferWriteS16
($$
, MAGIC_BREAK_NUMBER
); }
391 : STOPDRAG
'(' ')' /* no args */
393 bufferWriteU8
($$
, SWFACTION_STOPDRAGMOVIE
); }
395 | CALLFRAME
'(' variable
')'
397 bufferWriteString
($$
, $3, strlen
($3)+1);
398 bufferWriteU8
($$
, SWFACTION_CALLFRAME
);
399 bufferWriteS16
($$
, 0);
402 | CALLFRAME
'(' STRING
')'
404 bufferWriteString
($$
, $3, strlen
($3)+1);
405 bufferWriteU8
($$
, SWFACTION_CALLFRAME
);
406 bufferWriteS16
($$
, 0);
409 | REMOVECLIP
'(' expr
')'
411 bufferWriteU8
($$
, SWFACTION_REMOVECLIP
); }
415 bufferWriteU8
($$
, SWFACTION_TRACE
); }
417 /* getURL2(url, window, [method]) */
418 | GETURL
'(' expr
',' expr
')'
420 bufferConcat
($$
, $5);
421 bufferWriteU8
($$
, SWFACTION_GETURL2
);
422 bufferWriteS16
($$
, 1);
423 bufferWriteU8
($$
, GETURL_METHOD_NOSEND
); }
425 | GETURL
'(' expr
',' expr
',' GETURL_METHOD
')'
427 bufferConcat
($$
, $5);
428 bufferWriteU8
($$
, SWFACTION_GETURL2
);
429 bufferWriteS16
($$
, 1);
430 bufferWriteU8
($$
, $7); }
432 | GETURL1
'(' STRING
',' STRING
')'
434 bufferWriteU8
($$
, SWFACTION_GETURL
);
435 bufferWriteS16
($$
, strlen
($3) + strlen
($5) + 2);
436 bufferWriteHardString
($$
, (byte
*)$3, strlen
($3));
437 bufferWriteU8
($$
, 0);
438 bufferWriteHardString
($$
, (byte
*)$5, strlen
($5));
439 bufferWriteU8
($$
, 0); }
441 | LOADMOVIE
'(' expr
',' expr
')'
443 bufferConcat
($$
, $5);
444 bufferWriteU8
($$
, SWFACTION_GETURL2
);
445 bufferWriteS16
($$
, 1);
446 bufferWriteU8
($$
, GETURL_METHOD_NOSEND | GETURL_LOADMOVIE
); }
448 | LOADMOVIE
'(' expr
',' expr
',' GETURL_METHOD
')'
450 bufferConcat
($$
, $5);
451 bufferWriteU8
($$
, SWFACTION_GETURL2
);
452 bufferWriteS16
($$
, 1);
453 bufferWriteU8
($$
, $7 | GETURL_LOADMOVIE
); }
455 | LOADVARIABLES
'(' expr
',' expr
')'
457 bufferConcat
($$
, $5);
458 bufferWriteU8
($$
, SWFACTION_GETURL2
);
459 bufferWriteS16
($$
, 1);
460 bufferWriteU8
($$
, GETURL_METHOD_NOSEND | GETURL_LOADVARIABLES
); }
462 | LOADVARIABLES
'(' expr
',' expr
',' GETURL_METHOD
')'
464 bufferConcat
($$
, $5);
465 bufferWriteU8
($$
, SWFACTION_GETURL2
);
466 bufferWriteS16
($$
, 1);
467 bufferWriteU8
($$
, $7 | GETURL_LOADVARIABLES
); }
469 /* startDrag(target, lock, [left, right, top, bottom]) */
470 | STARTDRAG
'(' expr
',' expr
')'
472 bufferWriteString
($$
, "0", 2); /* no constraint */
473 bufferConcat
($$
, $5);
474 bufferConcat
($$
, $3);
475 bufferWriteU8
($$
, SWFACTION_STARTDRAGMOVIE
); }
477 | STARTDRAG
'(' expr
',' expr
',' expr
',' expr
',' expr
',' expr
')'
479 bufferConcat
($$
, $7);
480 bufferConcat
($$
, $11);
481 bufferConcat
($$
, $9);
482 bufferConcat
($$
, $13);
483 bufferWriteString
($$
, "1", 2); /* has constraint */
484 bufferConcat
($$
, $5);
485 bufferConcat
($$
, $3);
486 bufferWriteU8
($$
, SWFACTION_STARTDRAGMOVIE
); }
488 /* duplicateClip(target, new, depth) */
489 | DUPLICATECLIP
'(' expr
',' expr
',' expr
')'
491 bufferConcat
($$
, $5);
492 bufferConcat
($$
, $7);
493 bufferWriteWTHITProperty
($$
);
494 bufferWriteU8
($$
, SWFACTION_ADD
); /* see docs for explanation */
495 bufferWriteU8
($$
, SWFACTION_DUPLICATECLIP
); }
500 bufferWriteU8
($$
, SWFACTION_NEXTFRAME
); }
504 bufferWriteU8
($$
, SWFACTION_PREVFRAME
); }
508 bufferWriteU8
($$
, SWFACTION_PLAY
); }
512 bufferWriteU8
($$
, SWFACTION_STOP
); }
514 | TOGGLEQUALITY
'(' ')'
516 bufferWriteU8
($$
, SWFACTION_TOGGLEQUALITY
); }
520 bufferWriteU8
($$
, SWFACTION_STOPSOUNDS
); }
522 | GOTOFRAME
'(' NUMBER
')'
524 bufferWriteU8
($$
, SWFACTION_GOTOFRAME
);
525 bufferWriteS16
($$
, 2);
526 bufferWriteS16
($$
, atoi
($3));
529 | GOTOFRAME
'(' STRING
')'
531 bufferWriteU8
($$
, SWFACTION_GOTOLABEL
);
532 bufferWriteS16
($$
, strlen
($3)+1);
533 bufferWriteHardString
($$
, (byte
*)$3, strlen
($3)+1);
536 | GOTOFRAME
'(' expr
')'
538 bufferWriteU8
($$
, SWFACTION_GOTOEXPRESSION
);
539 bufferWriteS16
($$
, 1);
540 bufferWriteU8
($$
, 0); } /* XXX - and stop */
542 | GOTOANDPLAY
'(' expr
')'
544 bufferWriteU8
($$
, SWFACTION_GOTOEXPRESSION
);
545 bufferWriteS16
($$
, 1);
546 bufferWriteU8
($$
, 1); } /* XXX - and play */
548 | SETTARGET
'(' STRING
')'
550 bufferWriteU8
($$
, SWFACTION_SETTARGET
);
551 bufferWriteS16
($$
, strlen
($3)+1);
552 bufferWriteHardString
($$
, (byte
*)$3, strlen
($3)+1);
555 | SETTARGET
'(' expr
')'
557 bufferWriteU8
($$
, SWFACTION_SETTARGETEXPRESSION
); }
559 | TELLTARGET
'(' STRING
')' stmt
561 /* SetTarget(STRING) */
562 bufferWriteU8
($$
, SWFACTION_SETTARGET
);
563 bufferWriteS16
($$
, strlen
($3)+1);
564 bufferWriteHardString
($$
, (byte
*)$3, strlen
($3)+1);
566 bufferConcat
($$
, $5);
568 bufferWriteU8
($$
, SWFACTION_SETTARGET
);
569 bufferWriteS16
($$
, 1);
570 bufferWriteU8
($$
, 0);
573 | TELLTARGET
'(' expr
')' stmt
575 /* SetTarget(expr) */
576 bufferWriteU8
($$
, SWFACTION_SETTARGETEXPRESSION
);
578 bufferConcat
($$
, $5);
580 bufferWriteU8
($$
, SWFACTION_SETTARGET
);
581 bufferWriteS16
($$
, 1);
582 bufferWriteU8
($$
, 0); }
588 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
); }
592 bufferWriteU8
($$
, SWFACTION_GETTIMER
); }
594 | RANDOM
'(' expr
')'
596 bufferWriteU8
($$
, SWFACTION_RANDOM
); }
598 | LENGTH
'(' expr
')'
600 bufferWriteU8
($$
, SWFACTION_STRINGLENGTH
); }
604 bufferWriteU8
($$
, SWFACTION_INT
); }
608 bufferWriteU8
($$
, SWFACTION_ORD
); }
612 bufferWriteU8
($$
, SWFACTION_CHR
); }
614 | CONCAT
'(' expr
',' expr
')'
616 bufferConcat
($$
, $5);
617 bufferWriteU8
($$
, SWFACTION_STRINGCONCAT
); }
619 | SUBSTR
'(' expr
',' expr
',' expr
')'
621 bufferConcat
($$
, $5);
622 bufferConcat
($$
, $7);
623 bufferWriteU8
($$
, SWFACTION_SUBSTRING
); }
625 | GETPROPERTY
'(' expr
',' STRING
')'
627 bufferConcat
($$
, $3);
628 bufferWriteGetProperty
($$
, $5);
629 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
634 : lhs_expr
"++" %prec POSTFIX
636 bufferWriteBuffer
($$
, $1);
637 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
638 bufferWriteBuffer
($$
, $1);
639 bufferConcat
($$
, $1);
640 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
641 bufferWriteString
($$
, "1", 2);
642 bufferWriteU8
($$
, SWFACTION_ADD
);
643 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
); }
645 | lhs_expr
"--" %prec POSTFIX
647 bufferWriteBuffer
($$
, $1);
648 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
649 bufferWriteBuffer
($$
, $1);
650 bufferConcat
($$
, $1);
651 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
652 bufferWriteString
($$
, "1", 2);
653 bufferWriteU8
($$
, SWFACTION_SUBTRACT
);
654 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
); }
657 /* these leave a value on the stack */
666 bufferWriteString
($$
, $1, strlen
($1)+1);
669 |
'-' NUMBER %prec NEGATE
671 bufferWriteString
($$
, "-", 2);
672 bufferWriteString
($$
, $2, strlen
($2)+1);
677 bufferWriteString
($$
, $1, strlen
($1)+1);
682 bufferWriteString
($$
, $1, strlen
($1)+1);
683 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
688 bufferWriteString
($$
, $1, strlen
($1)+1);
691 | sprite
'.' IDENTIFIER
693 bufferWriteString
($$
, $1, strlen
($1)+1);
694 bufferWriteGetProperty
($$
, $3);
695 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
699 |
"++" sprite
'.' IDENTIFIER
701 bufferWriteString
($$
, $2, strlen
($2)+1);
702 bufferWriteGetProperty
($$
, $4);
703 bufferWriteString
($$
, $2, strlen
($2)+1);
704 bufferWriteSetProperty
($$
, $4);
705 bufferWriteString
($$
, $2, strlen
($2)+1);
706 bufferWriteGetProperty
($$
, $4);
707 bufferWriteString
($$
, "1", 2);
708 bufferWriteU8
($$
, SWFACTION_ADD
);
709 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
710 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
716 bufferWriteU8
($$
, SWFACTION_DUP
);
717 bufferWriteU8
($$
, SWFACTION_DUP
);
718 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
719 bufferWriteString
($$
, "1", 2);
720 bufferWriteU8
($$
, SWFACTION_ADD
);
721 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
);
722 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
); }
724 |
"--" sprite
'.' IDENTIFIER
726 bufferWriteString
($$
, $2, strlen
($2)+1);
727 bufferWriteGetProperty
($$
, $4);
728 bufferWriteString
($$
, $2, strlen
($2)+1);
729 bufferWriteSetProperty
($$
, $4);
730 bufferWriteString
($$
, $2, strlen
($2)+1);
731 bufferWriteGetProperty
($$
, $4);
732 bufferWriteString
($$
, "1", 2);
733 bufferWriteU8
($$
, SWFACTION_ADD
);
734 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
735 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
741 bufferWriteU8
($$
, SWFACTION_DUP
);
742 bufferWriteU8
($$
, SWFACTION_DUP
);
743 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
744 bufferWriteString
($$
, "1", 2);
745 bufferWriteU8
($$
, SWFACTION_SUBTRACT
);
746 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
);
747 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
); }
749 |
'-' rhs_expr %prec UMINUS
751 bufferWriteString
($2, "-1", 3);
752 bufferWriteU8
($2, SWFACTION_MULTIPLY
); }
756 bufferWriteU8
($2, SWFACTION_LOGICALNOT
); }
758 | lhs_expr
'=' rhs_expr
/* assign and leave copy on stack */
760 bufferConcat
($$
, $3);
761 bufferWriteU8
($$
, SWFACTION_DUP
);
762 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
); }
764 | rhs_expr
'*' rhs_expr
766 bufferConcat
($$
, $3);
767 bufferWriteU8
($$
, SWFACTION_MULTIPLY
); }
769 | rhs_expr
'/' rhs_expr
771 bufferConcat
($$
, $3);
772 bufferWriteU8
($$
, SWFACTION_DIVIDE
); }
774 | rhs_expr
'+' rhs_expr
776 bufferConcat
($$
, $3);
777 bufferWriteU8
($$
, SWFACTION_ADD
); }
779 | rhs_expr
'-' rhs_expr
781 bufferConcat
($$
, $3);
782 bufferWriteU8
($$
, SWFACTION_SUBTRACT
); }
784 | rhs_expr
'&' rhs_expr
786 bufferConcat
($$
, $3);
787 bufferWriteU8
($$
, SWFACTION_STRINGCONCAT
); }
789 | rhs_expr
'<' rhs_expr
791 bufferConcat
($$
, $3);
792 bufferWriteU8
($$
, SWFACTION_LESSTHAN
); }
794 | rhs_expr
'>' rhs_expr
796 bufferConcat
($$
, $1);
797 bufferWriteU8
($$
, SWFACTION_LESSTHAN
); }
799 | rhs_expr
"<=" rhs_expr
801 bufferConcat
($$
, $1);
802 bufferWriteU8
($$
, SWFACTION_LESSTHAN
);
803 bufferWriteU8
($$
, SWFACTION_LOGICALNOT
); }
805 | rhs_expr
">=" rhs_expr
806 { bufferConcat
($1, $3);
807 bufferWriteU8
($1, SWFACTION_LESSTHAN
);
808 bufferWriteU8
($1, SWFACTION_LOGICALNOT
); }
810 | rhs_expr
"!==" rhs_expr
811 { bufferConcat
($1, $3);
812 bufferWriteU8
($1, SWFACTION_STRINGEQ
);
813 bufferWriteU8
($1, SWFACTION_LOGICALNOT
); }
815 | rhs_expr
"===" rhs_expr
816 { bufferConcat
($1, $3);
817 bufferWriteU8
($1, SWFACTION_STRINGEQ
); }
819 | rhs_expr
"<=>" rhs_expr
820 { bufferConcat
($1, $3);
821 bufferWriteU8
($1, SWFACTION_STRINGCOMPARE
); }
823 | rhs_expr
"==" rhs_expr
824 { bufferConcat
($1, $3);
825 bufferWriteU8
($1, SWFACTION_EQUAL
); }
827 | rhs_expr
"!=" rhs_expr
828 { bufferConcat
($1, $3);
829 bufferWriteU8
($1, SWFACTION_EQUAL
);
830 bufferWriteU8
($1, SWFACTION_LOGICALNOT
); }
832 | rhs_expr
"&&" rhs_expr
833 { bufferConcat
($1, $3);
834 bufferWriteU8
($1, SWFACTION_LOGICALAND
); }
836 | rhs_expr
"||" rhs_expr
837 { bufferConcat
($1, $3);
838 bufferWriteU8
($1, SWFACTION_LOGICALOR
); }
840 | rhs_expr
'?' rhs_expr
':' rhs_expr
841 { bufferWriteU8
($1, SWFACTION_BRANCHIFTRUE
);
842 bufferWriteS16
($1, 2);
843 bufferWriteS16
($1, bufferLength
($5)+5);
844 bufferConcat
($1, $5);
845 bufferWriteU8
($1, SWFACTION_BRANCHALWAYS
);
846 bufferWriteS16
($1, 2);
847 bufferWriteS16
($1, bufferLength
($3));
848 bufferConcat
($1, $3); }
854 | sprite
':' IDENTIFIER
856 $$
= stringConcat
($$
, strdup
(":"));
857 $$
= stringConcat
($$
, $3); }
868 { $$
= strdup
("/"); }
871 { $$
= strdup
(".."); }
883 bufferWriteString
($$
, $1, strlen
($1)+1);
888 bufferWriteString
($$
, $1, strlen
($1)+1);
891 |
'(' rhs_expr
')' { $$
= $2; }
901 bufferWriteBuffer
($$
, $2);
902 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
903 bufferWriteString
($$
, "1", 2);
904 bufferWriteU8
($$
, SWFACTION_ADD
);
905 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
); }
909 bufferWriteBuffer
($$
, $2);
910 bufferWriteU8
($$
, SWFACTION_GETVARIABLE
);
911 bufferWriteString
($$
, "1", 2);
912 bufferWriteU8
($$
, SWFACTION_SUBTRACT
);
913 bufferWriteU8
($$
, SWFACTION_SETVARIABLE
); }
915 |
"++" sprite
'.' IDENTIFIER
917 bufferWriteString
($$
, $2, strlen
($2)+1);
918 bufferWriteGetProperty
($$
, $4);
919 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
920 bufferWriteString
($$
, "1", 2);
921 bufferWriteU8
($$
, SWFACTION_ADD
);
922 bufferWriteString
($$
, $2, strlen
($2)+1);
923 bufferWriteSetProperty
($$
, $4);
924 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
928 |
"--" sprite
'.' IDENTIFIER
930 bufferWriteString
($$
, $2, strlen
($2)+1);
931 bufferWriteGetProperty
($$
, $4);
932 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
933 bufferWriteString
($$
, "1", 2);
934 bufferWriteU8
($$
, SWFACTION_SUBTRACT
);
935 bufferWriteString
($$
, $2, strlen
($2)+1);
936 bufferWriteSetProperty
($$
, $4);
937 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
941 | lhs_expr
'=' rhs_expr
942 { bufferConcat
($1, $3);
943 bufferWriteU8
($1, SWFACTION_SETVARIABLE
); }
945 | lhs_expr
"*=" rhs_expr
946 { bufferWriteBuffer
($1, $1);
947 bufferWriteU8
($1, SWFACTION_GETVARIABLE
);
948 bufferConcat
($1, $3);
949 bufferWriteU8
($1, SWFACTION_MULTIPLY
);
950 bufferWriteU8
($1, SWFACTION_SETVARIABLE
); }
952 | lhs_expr
"/=" rhs_expr
953 { bufferWriteBuffer
($1, $1);
954 bufferWriteU8
($1, SWFACTION_GETVARIABLE
);
955 bufferConcat
($1, $3);
956 bufferWriteU8
($1, SWFACTION_DIVIDE
);
957 bufferWriteU8
($1, SWFACTION_SETVARIABLE
); }
959 | lhs_expr
"+=" rhs_expr
960 { bufferWriteBuffer
($1, $1);
961 bufferWriteU8
($1, SWFACTION_GETVARIABLE
);
962 bufferConcat
($1, $3);
963 bufferWriteU8
($1, SWFACTION_ADD
);
964 bufferWriteU8
($1, SWFACTION_SETVARIABLE
); }
966 | lhs_expr
"-=" rhs_expr
967 { bufferWriteBuffer
($1, $1);
968 bufferWriteU8
($1, SWFACTION_GETVARIABLE
);
969 bufferConcat
($1, $3);
970 bufferWriteU8
($1, SWFACTION_SUBTRACT
);
971 bufferWriteU8
($1, SWFACTION_SETVARIABLE
); }
973 | sprite
'.' IDENTIFIER
'=' rhs_expr
975 bufferWriteString
($$
, $1, strlen
($1)+1);
976 bufferWriteSetProperty
($$
, $3);
978 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
982 | sprite
'.' IDENTIFIER
"*=" rhs_expr
984 bufferWriteString
($$
, $1, strlen
($1)+1);
985 bufferWriteSetProperty
($$
, $3);
986 bufferWriteString
($$
, $1, strlen
($1)+1);
987 bufferWriteGetProperty
($$
, $3);
988 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
989 bufferConcat
($$
, $5);
990 bufferWriteU8
($$
, SWFACTION_MULTIPLY
);
991 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
995 | sprite
'.' IDENTIFIER
"/=" rhs_expr
997 bufferWriteString
($$
, $1, strlen
($1)+1);
998 bufferWriteSetProperty
($$
, $3);
999 bufferWriteString
($$
, $1, strlen
($1)+1);
1000 bufferWriteGetProperty
($$
, $3);
1001 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
1002 bufferConcat
($$
, $5);
1003 bufferWriteU8
($$
, SWFACTION_DIVIDE
);
1004 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
1008 | sprite
'.' IDENTIFIER
"+=" rhs_expr
1010 bufferWriteString
($$
, $1, strlen
($1)+1);
1011 bufferWriteSetProperty
($$
, $3);
1012 bufferWriteString
($$
, $1, strlen
($1)+1);
1013 bufferWriteGetProperty
($$
, $3);
1014 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
1015 bufferConcat
($$
, $5);
1016 bufferWriteU8
($$
, SWFACTION_ADD
);
1017 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);
1021 | sprite
'.' IDENTIFIER
"-=" rhs_expr
1023 bufferWriteString
($$
, $1, strlen
($1)+1);
1024 bufferWriteSetProperty
($$
, $3);
1025 bufferWriteString
($$
, $1, strlen
($1)+1);
1026 bufferWriteGetProperty
($$
, $3);
1027 bufferWriteU8
($$
, SWFACTION_GETPROPERTY
);
1028 bufferConcat
($$
, $5);
1029 bufferWriteU8
($$
, SWFACTION_SUBTRACT
);
1030 bufferWriteU8
($$
, SWFACTION_SETPROPERTY
);