summaryrefslogtreecommitdiff
blob: 65f7a30f02f1509acbc36e75b897a5b6cc8708ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
diff -up flasm-1.62/assembler.y.midrule flasm-1.62/assembler.y
--- flasm-1.62/assembler.y.midrule	2008-12-20 22:44:50.000000000 +0100
+++ flasm-1.62/assembler.y	2008-12-20 22:54:03.000000000 +0100
@@ -605,24 +605,24 @@ finally_opt
 
 trycatchfinally 
         : TRY name_opt                          {
-                                                    $$ = writeByte(SWFACTION_TRY);
+                                                    $<num>$ = writeByte(SWFACTION_TRY);
                                                     /* action length */
-                                                    $$ += writeShort(strlen($2)+8);
+                                                    $<num>$ += writeShort(strlen($2)+8);
                                                     /* zero flag */
-                                                    $$ += writeByte(0);
+                                                    $<num>$ += writeByte(0);
                                                     /* zero try length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* zero catch length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* zero finally length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* error variable name */
-                                                    $$ += writeString($2);
+                                                    $<num>$ += writeString($2);
                                                 }
 
-        statements_opt                          {   $$ = $<num>3 + $4; patchLength($$ - 6,  $4);    }
-        catch_opt                               {   $$ = $<num>5 + $6; patchLength($$ - 8,  $6);    }
-        finally_opt                             {   $$ = $<num>7 + $8; patchLength($$ - 10, $8);    }
+        statements_opt                          {   $<num>$ = $<num>3 + $4; patchLength($<num>$ - 6,  $4);    }
+        catch_opt                               {   $<num>$ = $<num>5 + $6; patchLength($<num>$ - 8,  $6);    }
+        finally_opt                             {   $<num>$ = $<num>7 + $8; patchLength($<num>$ - 10, $8);    }
         END                                     {
                                                     byte flag = 0;
                                                     $$ = $<num>9;
@@ -634,24 +634,24 @@ trycatchfinally 
                                                 }
 
         | TRY register                          {
-                                                    $$ = writeByte(SWFACTION_TRY);
+                                                    $<num>$ = writeByte(SWFACTION_TRY);
                                                     /* action length */
-                                                    $$ += writeShort(8);
+                                                    $<num>$ += writeShort(8);
                                                     /* zero flag */
-                                                    $$ += writeByte(0);
+                                                    $<num>$ += writeByte(0);
                                                     /* zero try length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* zero catch length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* zero finally length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* error register number */
-                                                    $$ += writeByte((byte) $2);
+                                                    $<num>$ += writeByte((byte) $2);
                                                 }
 
-        statements_opt                          {   $$ = $<num>3 + $4; patchLength($$ - 6,  $4);    }
-        catch_opt                               {   $$ = $<num>5 + $6; patchLength($$ - 8,  $6);    }
-        finally_opt                             {   $$ = $<num>7 + $8; patchLength($$ - 10, $8);    }
+        statements_opt                          {   $<num>$ = $<num>3 + $4; patchLength($<num>$ - 6,  $4);    }
+        catch_opt                               {   $<num>$ = $<num>5 + $6; patchLength($<num>$ - 8,  $6);    }
+        finally_opt                             {   $<num>$ = $<num>7 + $8; patchLength($<num>$ - 10, $8);    }
         END                                     {
                                                     byte flag = 4;
                                                     $$ = $<num>9;
@@ -707,25 +707,25 @@ name_opt
 
 function
         : FUNCTION name_opt                     {
-                                                    $$ = writeByte(SWFACTION_DEFINEFUNCTION);
+                                                    $<num>$ = writeByte(SWFACTION_DEFINEFUNCTION);
                                                     /* zero block length */
-                                                    $$ += writeShort(0);
-                                                    $$ += writeString($2);
+                                                    $<num>$ += writeShort(0);
+                                                    $<num>$ += writeString($2);
                                                 }
 
           '(' function_args ')'                 {
                                                     unsigned int i;
                                                     numArgs = $5;
 
-                                                    $$ = $<num>3 + writeShort(numArgs);
+                                                    $<num>$ = $<num>3 + writeShort(numArgs);
 
                                                     for(i = 0; i < numArgs; ++i)
-                                                        $$ += writeString(func_args[i]);
+                                                        $<num>$ += writeString(func_args[i]);
 
                                                     /* zero function length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* patch block length */
-                                                    patchLength($$-3, $$-3);
+                                                    patchLength($<num>$-3, $<num>$-3);
                                                 }
 
           statements_opt END                    {
@@ -837,25 +837,25 @@ autoregarglist
 
 function2
         : FUNCTION2 name_opt                    {
-                                                    $$ = writeByte(SWFACTION_DEFINEFUNCTION2);
+                                                    $<num>$ = writeByte(SWFACTION_DEFINEFUNCTION2);
                                                     /* zero block length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     /* function name */
-                                                    $$ += writeString($2);
+                                                    $<num>$ += writeString($2);
                                                     curFunc++;
                                                     memset(regfunc_args[curFunc], 0, sizeof (regfunc_args[curFunc]));
                                                     numArgs = 0;
                                                     /* zero num of function arguments */
-                                                    $$ += writeShort(numArgs);
+                                                    $<num>$ += writeShort(numArgs);
                                                     /* allocate zero registers */
                                                     numRegisters[curFunc] = 0;
-                                                    $$ += writeByte(numRegisters[curFunc]);
+                                                    $<num>$ += writeByte(numRegisters[curFunc]);
                                                     /* zero automatic register flags */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                 }
 
           '(' regarglist ')'                    {
-                                                    $$ = $<num>3 + $5;
+                                                    $<num>$ = $<num>3 + $5;
                                                     /* patch num of function arguments */
                                                     patchLength($5 + 3, numArgs);
                                                     autoregFlags = 0;
@@ -866,9 +866,9 @@ function2
                                                     byte curautoreg = 1;
                                                     unsigned int i;
 
-                                                    $$ = $<num>7;
+                                                    $<num>$ = $<num>7;
                                                     /* zero body length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                     
                                                     /* make sure auto registers are allocated in the right order */
                                                     for (i = 0; i < MAX_AUTO_REGS; i++) {
@@ -883,9 +883,9 @@ function2
                                                     }
 
                                                     /* patch automatic register flags */
-                                                    patchLength($$ - $<num>3, autoregFlags);
+                                                    patchLength($<num>$ - $<num>3, autoregFlags);
                                                     /* patch block length */
-                                                    patchLength($$ - 3, $$ - 3);
+                                                    patchLength($<num>$ - 3, $<num>$ - 3);
                                                 }
 
           statements_opt END                    {
@@ -905,11 +905,11 @@ function2
 
 with
         : WITH                                  {
-                                                    $$ = writeByte(SWFACTION_WITH);
+                                                    $<num>$ = writeByte(SWFACTION_WITH);
                                                     /* length of with action */
-                                                    $$ += writeShort(2);
+                                                    $<num>$ += writeShort(2);
                                                     /* length of with block - will be patched */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                 }
                                                 
           statements_opt END                    { 
@@ -921,9 +921,9 @@ with
 
 settarget
         : SETTARGET STRING                      {
-                                                    $$ = writeByte(SWFACTION_SETTARGET);
-                                                    $$ += writeShort(strlen($2)+1);
-                                                    $$ += writeString($2);
+                                                    $<num>$ = writeByte(SWFACTION_SETTARGET);
+                                                    $<num>$ += writeShort(strlen($2)+1);
+                                                    $<num>$ += writeString($2);
                                                 }
 
           statements_opt END                    {
@@ -934,7 +934,7 @@ settarget
         ;
 
 settargetexpression
-        : SETTARGETEXPR                         {   $$ = writeByte(SWFACTION_SETTARGETEXPRESSION);  }
+        : SETTARGETEXPR                         {   $<num>$ = writeByte(SWFACTION_SETTARGETEXPRESSION);  }
           statements_opt END                    {
                                                     $$ = $3 + writeByte(SWFACTION_SETTARGET);
                                                     $$ += $<num>2 + writeShort(1);
@@ -946,9 +946,9 @@ ifframeloadedexpression
         : IFFRAMELOADEDEXPR                     {
                                                     if (frameloadedStart>-1)
                                                         yyerror("IfFrameLoaded actions can't be nested");
-                                                    $$ = writeByte(SWFACTION_IFFRAMELOADEDEXPRESSION);
-                                                    $$ += writeShort(1);
-                                                    $$ += writeByte(0);
+                                                    $<num>$ = writeByte(SWFACTION_IFFRAMELOADEDEXPRESSION);
+                                                    $<num>$ += writeShort(1);
+                                                    $<num>$ += writeByte(0);
                                                     frameloadedStart = numActions;
                                                 }
 
@@ -963,10 +963,10 @@ ifframeloaded
         : IFFRAMELOADED INTEGER                 {
                                                     if (frameloadedStart>-1)
                                                         yyerror("IfFrameLoaded actions can't be nested");
-                                                    $$ = writeByte(SWFACTION_IFFRAMELOADED);
-                                                    $$ += writeShort(3);
-                                                    $$ += writeShort($2);
-                                                    $$ += writeByte(0);
+                                                    $<num>$ = writeByte(SWFACTION_IFFRAMELOADED);
+                                                    $<num>$ += writeShort(3);
+                                                    $<num>$ += writeShort($2);
+                                                    $<num>$ += writeByte(0);
                                                     frameloadedStart = numActions;
                                                 }
                                          
@@ -1199,9 +1199,9 @@ opcode
           constant_list_opt                     {   $$ = writeConstants();  }
 
         | PUSH                                  {
-                                                    $$ = writeByte(SWFACTION_PUSHDATA);
+                                                    $<num>$ = writeByte(SWFACTION_PUSHDATA);
                                                     /* length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                 }
 
           push_list                             {   
@@ -1212,10 +1212,10 @@ opcode
         | SWFACTION HEX                         {
                                                     if (xtoi($2)>0xff)
                                                         yyerror("Action code out of range");
-                                                    $$ = writeByte((char)xtoi($2));
+                                                    $<num>$ = writeByte((char)xtoi($2));
                                                     if (xtoi($2)>=0x80)
                                                     /* length */
-                                                    $$ += writeShort(0);
+                                                    $<num>$ += writeShort(0);
                                                 }
 
           hexlist_opt                           {