as3compile: added -R option, fixed some namespace bugs
[swftools.git] / lib / as3 / parser.tab.c
1
2 /* A Bison parser, made by GNU Bison 2.4.  */
3
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5    
6       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7    Free Software Foundation, Inc.
8    
9    This program is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 /* As a special exception, you may create a larger work that contains
23    part or all of the Bison parser skeleton and distribute that work
24    under terms of your choice, so long as that work isn't itself a
25    parser generator using the skeleton or a modified version thereof
26    as a parser skeleton.  Alternatively, if you modify or redistribute
27    the parser skeleton itself, you may (at your option) remove this
28    special exception, which will cause the skeleton and the resulting
29    Bison output files to be licensed under the GNU General Public
30    License without this special exception.
31    
32    This special exception was added by the Free Software Foundation in
33    version 2.2 of Bison.  */
34
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36    simplifying the original so-called "semantic" parser.  */
37
38 /* All symbols defined below should begin with yy or YY, to avoid
39    infringing on user name space.  This should be done even for local
40    variables, as they might otherwise be expanded by user macros.
41    There are some unavoidable exceptions within include files to
42    define necessary library symbols; they are noted "INFRINGES ON
43    USER NAME SPACE" below.  */
44
45 /* Identify Bison output.  */
46 #define YYBISON 1
47
48 /* Bison version.  */
49 #define YYBISON_VERSION "2.4"
50
51 /* Skeleton name.  */
52 #define YYSKELETON_NAME "./skeleton.m4"
53
54 /* Pure parsers.  */
55 #define YYPURE 0
56
57 /* Push parsers.  */
58 #define YYPUSH 0
59
60 /* Pull parsers.  */
61 #define YYPULL 1
62
63 /* Using locations.  */
64 #define YYLSP_NEEDED 0
65
66 /* Substitute the variable and function names.  */
67 #define yyparse         a3_parse
68 #define yylex           a3_lex
69 #define yyerror         a3_error
70 #define yylval          a3_lval
71 #define yychar          a3_char
72 #define yydebug         a3_debug
73 #define yynerrs         a3_nerrs
74
75
76 /* Copy the first part of user declarations.  */
77
78 /* Line 198 of skeleton.m4  */
79 #line 23 "parser.y"
80
81 #include <stdlib.h>
82 #include <stdio.h>
83 #include <memory.h>
84 #include "abc.h"
85 #include "pool.h"
86 #include "files.h"
87 #include "tokenizer.h"
88 #include "registry.h"
89 #include "code.h"
90 #include "opcodes.h"
91 #include "compiler.h"
92
93 extern int a3_lex();
94
95
96
97 /* Line 198 of skeleton.m4  */
98 #line 99 "parser.tab.c"
99
100 /* Enabling traces.  */
101 #ifndef YYDEBUG
102 # define YYDEBUG 0
103 #endif
104
105 /* Enabling verbose error messages.  */
106 #ifdef YYERROR_VERBOSE
107 # undef YYERROR_VERBOSE
108 # define YYERROR_VERBOSE 1
109 #else
110 # define YYERROR_VERBOSE 1
111 #endif
112
113 /* Enabling the token table.  */
114 #ifndef YYTOKEN_TABLE
115 # define YYTOKEN_TABLE 0
116 #endif
117
118
119 /* Tokens.  */
120 #ifndef YYTOKENTYPE
121 # define YYTOKENTYPE
122    /* Put the tokens into the symbol table, so that GDB and other debuggers
123       know about them.  */
124    enum yytokentype {
125      T_IDENTIFIER = 258,
126      T_NAMESPACE = 259,
127      T_STRING = 260,
128      T_REGEXP = 261,
129      T_EMPTY = 262,
130      T_INT = 263,
131      T_UINT = 264,
132      T_BYTE = 265,
133      T_SHORT = 266,
134      T_FLOAT = 267,
135      T_FOR = 268,
136      T_WHILE = 269,
137      T_DO = 270,
138      T_SWITCH = 271,
139      KW_IMPLEMENTS = 272,
140      KW_NAMESPACE = 273,
141      KW_PACKAGE = 274,
142      KW_PROTECTED = 275,
143      KW_PUBLIC = 276,
144      KW_PRIVATE = 277,
145      KW_USE = 278,
146      KW_INTERNAL = 279,
147      KW_NEW = 280,
148      KW_NATIVE = 281,
149      KW_FUNCTION = 282,
150      KW_FINALLY = 283,
151      KW_UNDEFINED = 284,
152      KW_CONTINUE = 285,
153      KW_CLASS = 286,
154      KW_CONST = 287,
155      KW_CATCH = 288,
156      KW_CASE = 289,
157      KW_SET = 290,
158      KW_VOID = 291,
159      KW_THROW = 292,
160      KW_STATIC = 293,
161      KW_WITH = 294,
162      KW_INSTANCEOF = 295,
163      KW_IMPORT = 296,
164      KW_RETURN = 297,
165      KW_TYPEOF = 298,
166      KW_INTERFACE = 299,
167      KW_NULL = 300,
168      KW_VAR = 301,
169      KW_DYNAMIC = 302,
170      KW_OVERRIDE = 303,
171      KW_FINAL = 304,
172      KW_EACH = 305,
173      KW_GET = 306,
174      KW_TRY = 307,
175      KW_SUPER = 308,
176      KW_EXTENDS = 309,
177      KW_FALSE = 310,
178      KW_TRUE = 311,
179      KW_BOOLEAN = 312,
180      KW_UINT = 313,
181      KW_INT = 314,
182      KW_NUMBER = 315,
183      KW_STRING = 316,
184      KW_DEFAULT = 317,
185      KW_DELETE = 318,
186      KW_IF = 319,
187      KW_ELSE = 320,
188      KW_BREAK = 321,
189      KW_IS = 322,
190      KW_IN = 323,
191      KW_AS = 324,
192      T_DICTSTART = 325,
193      T_EQEQ = 326,
194      T_EQEQEQ = 327,
195      T_NE = 328,
196      T_NEE = 329,
197      T_LE = 330,
198      T_GE = 331,
199      T_ORBY = 332,
200      T_DIVBY = 333,
201      T_MODBY = 334,
202      T_MULBY = 335,
203      T_PLUSBY = 336,
204      T_MINUSBY = 337,
205      T_XORBY = 338,
206      T_SHRBY = 339,
207      T_SHLBY = 340,
208      T_USHRBY = 341,
209      T_OROR = 342,
210      T_ANDAND = 343,
211      T_COLONCOLON = 344,
212      T_MINUSMINUS = 345,
213      T_PLUSPLUS = 346,
214      T_DOTDOT = 347,
215      T_DOTDOTDOT = 348,
216      T_SHL = 349,
217      T_USHR = 350,
218      T_SHR = 351,
219      prec_none = 352,
220      below_semicolon = 353,
221      below_assignment = 354,
222      below_minus = 356,
223      minusminus_prefix = 357,
224      plusplus_prefix = 358,
225      below_curly = 359,
226      new2 = 360,
227      above_identifier = 361,
228      below_else = 362,
229      above_function = 363
230    };
231 #endif
232
233
234
235 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
236 typedef union 
237 /* Line 223 of skeleton.m4  */
238 #line 44 "parser.y"
239 tokenunion
240 {
241
242 /* Line 223 of skeleton.m4  */
243 #line 44 "parser.y"
244
245     enum yytokentype token;
246
247     classinfo_t*classinfo;
248     classinfo_list_t*classinfo_list;
249     slotinfo_t*slotinfo;
250     slotinfo_list_t*slotinfo_list;
251
252     int number_int;
253     unsigned int number_uint;
254     double number_float;
255     code_t*code;
256     typedcode_t value;
257     //typedcode_list_t*value_list;
258     codeandnumber_t value_list;
259     param_t* param;
260     params_t params;
261     string_t str;
262     char*id;
263     constant_t*constant;
264     for_start_t for_start;
265     abc_exception_t *exception;
266     regexp_t regexp;
267     modifiers_t flags;
268     namespace_decl_t* namespace_decl;
269     struct {
270         abc_exception_list_t *l;
271         code_t*finally;
272     } catch_list;
273
274
275
276 /* Line 223 of skeleton.m4  */
277 #line 278 "parser.tab.c"
278 } YYSTYPE;
279 # define YYSTYPE_IS_TRIVIAL 1
280 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
281 # define YYSTYPE_IS_DECLARED 1
282 #endif
283
284
285 /* Copy the second part of user declarations.  */
286
287 /* Line 273 of skeleton.m4  */
288 #line 265 "parser.y"
289
290
291 static int a3_error(char*s)
292 {
293    syntaxerror("%s", s); 
294    return 0; //make gcc happy
295 }
296
297
298 static char* concat2(const char* t1, const char* t2)
299 {
300     int l1 = strlen(t1);
301     int l2 = strlen(t2);
302     char*text = malloc(l1+l2+1);
303     memcpy(text   , t1, l1);
304     memcpy(text+l1, t2, l2);
305     text[l1+l2] = 0;
306     return text;
307 }
308 static char* concat3(const char* t1, const char* t2, const char* t3)
309 {
310     int l1 = strlen(t1);
311     int l2 = strlen(t2);
312     int l3 = strlen(t3);
313     char*text = malloc(l1+l2+l3+1);
314     memcpy(text   , t1, l1);
315     memcpy(text+l1, t2, l2);
316     memcpy(text+l1+l2, t3, l3);
317     text[l1+l2+l3] = 0;
318     return text;
319 }
320
321 typedef struct _import {
322     char*package;
323 } import_t;
324
325 DECLARE_LIST(import);
326
327 DECLARE(methodstate);
328 DECLARE_LIST(methodstate);
329
330 typedef struct _classstate {
331     /* class data */
332     classinfo_t*info;
333     abc_class_t*abc;
334    
335     methodstate_t*init;
336     methodstate_t*static_init;
337     //code_t*init;
338     //code_t*static_init;
339
340     char has_constructor;
341 } classstate_t;
342
343 struct _methodstate {
344     /* method data */
345     methodinfo_t*info;
346     char has_exceptions;
347     char late_binding;
348     char is_constructor;
349     char has_super;
350     char is_global;
351     int variable_count;
352
353     dict_t*unresolved_variables;
354
355     char inner;
356     char uses_parent_function;
357     int uses_slots;
358     dict_t*slots;
359     int activation_var;
360
361     abc_method_t*abc;
362     int var_index; // for inner methods
363     int slot_index; // for inner methods
364     char is_a_slot; // for inner methods
365
366     code_t*header;
367
368     code_t*scope_code;
369     abc_exception_list_t*exceptions;
370     
371     methodstate_list_t*innerfunctions;
372 };
373
374 typedef struct _state {
375     struct _state*old;
376     int level;
377     
378     char*package;     
379     import_list_t*wildcard_imports;
380     dict_t*import_toplevel_packages;
381     dict_t*imports;
382
383     namespace_list_t*active_namespace_urls;
384     
385     char has_own_imports;
386     char new_vars; // e.g. transition between two functions
387   
388     classstate_t*cls;   
389     methodstate_t*method;
390
391     char*exception_name;
392
393     int switch_var;
394     
395     dict_t*vars;
396 } state_t;
397
398 typedef struct _global {
399     abc_file_t*file;
400     abc_script_t*init;
401     dict_t*token2info;
402     dict_t*file2token2info;
403 } global_t;
404
405 static global_t*global = 0;
406 static state_t* state = 0;
407
408 DECLARE_LIST(state);
409
410 #define MULTINAME(m,x) \
411     multiname_t m;\
412     namespace_t m##_ns;\
413     (x)->package; \
414     registry_fill_multiname(&m, &m##_ns, (slotinfo_t*)(x));
415                     
416 #define MEMBER_MULTINAME(m,f,n) \
417     multiname_t m;\
418     namespace_t m##_ns;\
419     if(f) { \
420         if((m##_ns.access = ((slotinfo_t*)(f))->access)==ACCESS_NAMESPACE) \
421             m##_ns.name = ((slotinfo_t*)(f))->package; \
422         else \
423             m##_ns.name = ""; \
424         m.type = QNAME; \
425         m.ns = &m##_ns; \
426         m.namespace_set = 0; \
427         m.name = ((slotinfo_t*)(f))->name; \
428     } else { \
429         m.type = MULTINAME; \
430         m.ns =0; \
431         m.namespace_set = &nopackage_namespace_set; \
432         m.name = n; \
433     }
434
435 /* warning: list length of namespace set is undefined */
436 #define MULTINAME_LATE(m, access, package) \
437     namespace_t m##_ns = {access, package}; \
438     namespace_set_t m##_nsset; \
439     namespace_list_t m##_l;m##_l.next = 0; \
440     m##_nsset.namespaces = &m##_l; \
441     m##_nsset = m##_nsset; \
442     m##_l.namespace = &m##_ns; \
443     multiname_t m = {MULTINAMEL, 0, &m##_nsset, 0};
444
445 static namespace_t ns1 = {ACCESS_PRIVATE, ""};
446 static namespace_t ns2 = {ACCESS_PROTECTED, ""};
447 static namespace_t ns3 = {ACCESS_PACKAGEINTERNAL, ""};
448 static namespace_t ns4 = {ACCESS_PACKAGE, ""};
449 static namespace_list_t nl4 = {&ns4,0};
450 static namespace_list_t nl3 = {&ns3,&nl4};
451 static namespace_list_t nl2 = {&ns2,&nl3};
452 static namespace_list_t nl1 = {&ns1,&nl2};
453 static namespace_set_t nopackage_namespace_set = {&nl1};
454
455 static void new_state()
456 {
457     NEW(state_t, s);
458     state_t*oldstate = state;
459     if(state)
460         memcpy(s, state, sizeof(state_t)); //shallow copy
461     if(!s->imports) {
462         s->imports = dict_new();
463     }
464     if(!s->import_toplevel_packages) {
465         s->import_toplevel_packages = dict_new(); 
466     }
467     state = s;
468     state->level++;
469     state->has_own_imports = 0;    
470     state->vars = dict_new(); 
471     state->old = oldstate;
472     state->new_vars = 0;
473
474     trie_remember(active_namespaces);
475    
476     if(oldstate)
477         state->active_namespace_urls = list_clone(oldstate->active_namespace_urls);
478 }
479 static void state_has_imports()
480 {
481     state->wildcard_imports = list_clone(state->wildcard_imports);
482     state->imports = dict_clone(state->imports);
483     state->has_own_imports = 1;
484 }
485 static void import_toplevel(const char*package)
486 {
487     char* s = strdup(package);
488     while(1) {
489         dict_put(state->import_toplevel_packages, s, 0);
490         char*x = strrchr(s, '.');
491         if(!x)
492             break;
493         *x = 0;
494     }
495     free(s);
496 }
497
498 static void state_destroy(state_t*state)
499 {
500     if(state->has_own_imports) {
501         list_free(state->wildcard_imports);
502         dict_destroy(state->imports);state->imports=0;
503     }
504     if(state->imports && (!state->old || state->old->imports!=state->imports)) {
505         dict_destroy(state->imports);state->imports=0;
506     }
507     if(state->vars) {
508         int t;
509         for(t=0;t<state->vars->hashsize;t++) {
510             dictentry_t*e =state->vars->slots[t];
511             while(e) {
512                 free(e->data);e->data=0;
513                 e = e->next;
514             }
515         }
516         dict_destroy(state->vars);state->vars=0;
517     }
518     
519     list_free(state->active_namespace_urls)
520     state->active_namespace_urls = 0;
521     
522     free(state);
523 }
524
525 static void old_state()
526 {
527     trie_rollback(active_namespaces);
528
529     if(!state || !state->old)
530         syntaxerror("invalid nesting");
531     state_t*leaving = state;
532     
533     state = state->old;
534
535     if(as3_pass>1 && leaving->method && leaving->method != state->method && !leaving->method->inner) {
536         free(leaving->method);
537         leaving->method=0;
538     }
539     if(as3_pass>1 && leaving->cls && leaving->cls != state->cls) {
540         free(leaving->cls);
541         leaving->cls=0;
542     }
543
544     state_destroy(leaving);
545 }
546
547 static code_t* method_header(methodstate_t*m);
548 static code_t* wrap_function(code_t*c,code_t*header, code_t*body);
549 static void function_initvars(methodstate_t*m, params_t*params, int flags, char var0);
550
551
552 static char* internal_filename_package = 0;
553 void initialize_file(char*filename)
554 {
555     if(state) {
556         syntaxerror("invalid call to initialize_file during parsing of another file");
557     }
558     
559     active_namespaces = trie_new();
560
561     new_state();
562     state->package = internal_filename_package = strdup(filename);
563     
564     global->token2info = dict_lookup(global->file2token2info, 
565                                      current_filename // use long version
566                                     );
567     if(!global->token2info) {
568         global->token2info = dict_new2(&ptr_type);
569         dict_put(global->file2token2info, current_filename, global->token2info);
570     }
571   
572     if(as3_pass==1) {
573         state->method = rfx_calloc(sizeof(methodstate_t));
574         dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
575         state->method->late_binding = 1; // init scripts use getglobalscope, so we need a getlocal0/pushscope
576     } else {
577         state->method = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
578         function_initvars(state->method, 0, 0, 1);
579         global->init = abc_initscript(global->file);
580     }
581 }
582
583 void finish_file()
584 {
585     if(!state || state->level!=1) {
586         syntaxerror("unexpected end of file in pass %d", as3_pass);
587     }
588
589     if(as3_pass==2) {
590         code_t*header = method_header(state->method);
591         code_t*c = wrap_function(header, 0, global->init->method->body->code);
592         global->init->method->body->code = c;
593         free(state->method);state->method=0;
594     }
595
596     //free(state->package);state->package=0; // used in registry
597     state_destroy(state);state=0;
598 }
599
600 void initialize_parser()
601 {
602     global = rfx_calloc(sizeof(global_t));
603     global->file = abc_file_new();
604     global->file->flags &= ~ABCFILE_LAZY;
605     global->file2token2info = dict_new();
606     global->token2info = 0;
607 }
608
609 void* finish_parser()
610 {
611     dict_free_all(global->file2token2info, 1, (void*)dict_destroy);
612
613     global->token2info=0;
614
615     return global->file;
616 }
617
618
619 static void xx_scopetest() 
620 {
621     /* findpropstrict doesn't just return a scope object- it
622        also makes it "active" somehow. Push local_0 on the
623        scope stack and read it back with findpropstrict, it'll
624        contain properties like "trace". Trying to find the same
625        property on a "vanilla" local_0 yields only a "undefined" */
626     //c = abc_findpropstrict(c, "[package]::trace");
627     
628     /*c = abc_getlocal_0(c);
629     c = abc_findpropstrict(c, "[package]::trace");
630     c = abc_coerce_a(c);
631     c = abc_setlocal_1(c);
632
633     c = abc_pushbyte(c, 0);
634     c = abc_setlocal_2(c);
635    
636     code_t*xx = c = abc_label(c);
637     c = abc_findpropstrict(c, "[package]::trace");
638     c = abc_pushstring(c, "prop:");
639     c = abc_hasnext2(c, 1, 2);
640     c = abc_dup(c);
641     c = abc_setlocal_3(c);
642     c = abc_callpropvoid(c, "[package]::trace", 2);
643     c = abc_getlocal_3(c);
644     c = abc_kill(c, 3);
645     c = abc_iftrue(c,xx);*/
646 }
647
648 typedef struct _variable {
649     int index;
650     classinfo_t*type;
651     char init;
652     char is_parameter;
653     methodstate_t*is_inner_method;
654 } variable_t;
655
656 static variable_t* find_variable(state_t*s, char*name)
657 {
658     while(s) {
659         variable_t*v = 0;
660         v = dict_lookup(s->vars, name);
661         if(v) return v;
662         if(s->new_vars) break;
663         s = s->old;
664     }
665     return 0;
666 }
667 static variable_t* find_slot(state_t*s, const char*name)
668 {
669     if(s->method && s->method->slots)
670         return dict_lookup(s->method->slots, name);
671     return 0;
672 }
673
674 static variable_t* find_variable_safe(state_t*s, char*name)
675 {
676     variable_t* v = find_variable(s, name);
677     if(!v)
678         syntaxerror("undefined variable: %s", name);
679     return v;
680 }
681 static char variable_exists(char*name) 
682 {
683     return dict_contains(state->vars, name);
684 }
685 code_t*defaultvalue(code_t*c, classinfo_t*type);
686
687 static int alloc_local()
688 {
689     return state->method->variable_count++;
690 }
691
692 static variable_t* new_variable2(const char*name, classinfo_t*type, char init, char maybeslot)
693 {
694     if(maybeslot) {
695         variable_t*v = find_slot(state, name);
696         if(v)
697             return v;
698     }
699
700     NEW(variable_t, v);
701     v->index = alloc_local();
702     v->type = type;
703     v->init = init;
704  
705     if(name) 
706         dict_put(state->vars, name, v);
707
708     return v;
709 }
710 static int new_variable(const char*name, classinfo_t*type, char init, char maybeslot)
711 {
712     return new_variable2(name, type, init, maybeslot)->index;
713 }
714
715 #define TEMPVARNAME "__as3_temp__"
716 static int gettempvar()
717 {
718     variable_t*v = find_variable(state, TEMPVARNAME);
719     if(v) 
720         return v->index;
721     return new_variable(TEMPVARNAME, 0, 0, 0);
722 }
723
724 code_t* var_block(code_t*body) 
725 {
726     code_t*c = 0;
727     code_t*k = 0;
728     int t;
729     int num=0;
730     for(t=0;t<state->vars->hashsize;t++) {
731         dictentry_t*e = state->vars->slots[t];
732         while(e) {
733             variable_t*v = (variable_t*)e->data;
734             if(v->type && v->init) {
735                 c = defaultvalue(c, v->type);
736                 c = abc_setlocal(c, v->index);
737                 k = abc_kill(k, v->index); 
738                 num++;
739             }
740             e = e->next;
741         }
742     }
743
744     if(k) {
745         code_t*x = body;
746         while(x) {
747             if(x->opcode== OPCODE___BREAK__ ||
748                x->opcode== OPCODE___CONTINUE__) {
749                /* link kill code before break/continue */
750                 code_t*e = code_dup(k);
751                 code_t*s = code_start(e);
752                 s->prev = x->prev;
753                 if(x->prev) {
754                     x->prev->next = s;
755                 }
756                 e->next = x;
757                 x->prev = e;
758             }
759             x = x->prev;
760         }
761     }
762     
763     c = code_append(c, body);
764     c = code_append(c, k);
765     return c;
766 }
767
768 void unknown_variable(char*name) 
769 {
770     if(!state->method->unresolved_variables)
771         state->method->unresolved_variables = dict_new();
772     if(!dict_contains(state->method->unresolved_variables, name))
773         dict_put(state->method->unresolved_variables, name, 0);
774 }
775
776 #define parserassert(b) {if(!(b)) parsererror(__FILE__, __LINE__,__func__);}
777
778 static void parsererror(const char*file, int line, const char*f)
779 {
780     syntaxerror("internal error in %s, %s:%d", f, file, line);
781 }
782
783    
784 static code_t* add_scope_code(code_t*c, methodstate_t*m, char init)
785 {
786     if(m->uses_slots || (m->late_binding && !m->inner)) { //???? especially inner functions need the pushscope
787         c = abc_getlocal_0(c);
788         c = abc_pushscope(c);
789     }
790     if(m->uses_slots) {
791         /* FIXME: this alloc_local() causes variable indexes to be
792            different in pass2 than in pass1 */
793         if(!m->activation_var)
794             m->activation_var = alloc_local();
795         if(init) {
796             c = abc_newactivation(c);
797             c = abc_dup(c);
798             c = abc_pushscope(c);
799             c = abc_setlocal(c, m->activation_var);
800         } else {
801             c = abc_getlocal(c, m->activation_var);
802             c = abc_pushscope(c);
803         }
804     }
805     return c;
806 }
807
808 static code_t* method_header(methodstate_t*m)
809 {
810     code_t*c = 0;
811
812     c = add_scope_code(c, m, 1);
813
814     methodstate_list_t*l = m->innerfunctions;
815     while(l) {
816         parserassert(l->methodstate->abc);
817         if(m->uses_slots && l->methodstate->is_a_slot) {
818             c = abc_getscopeobject(c, 1);
819             c = abc_newfunction(c, l->methodstate->abc);
820             c = abc_dup(c);
821             c = abc_setlocal(c, l->methodstate->var_index);
822             c = abc_setslot(c, l->methodstate->slot_index);
823         } else {
824             c = abc_newfunction(c, l->methodstate->abc);
825             c = abc_setlocal(c, l->methodstate->var_index);
826         }
827         free(l->methodstate);l->methodstate=0;
828         l = l->next;
829     }
830     if(m->header) {
831         c = code_append(c, m->header);
832         m->header = 0;
833     }
834     if(m->is_constructor && !m->has_super) {
835         // call default constructor
836         c = abc_getlocal_0(c);
837         c = abc_constructsuper(c, 0);
838     }
839
840     if(m->slots) {
841         /* all parameters that are used by inner functions
842            need to be copied from local to slot */
843         parserassert(m->activation_var);
844         DICT_ITERATE_ITEMS(m->slots,char*,name,variable_t*,v) {
845             if(v->is_parameter) {
846                 c = abc_getlocal(c, m->activation_var); 
847                 c = abc_getlocal(c, v->index); 
848                 c = abc_setslot(c, v->index); 
849             }
850         }
851     }
852     list_free(m->innerfunctions);
853     m->innerfunctions = 0;
854     return c;
855 }
856     
857
858 static code_t* wrap_function(code_t*c,code_t*header, code_t*body)
859 {
860     c = code_append(c, header);
861     c = code_append(c, var_block(body));
862     /* append return if necessary */
863     if(!c || (c->opcode != OPCODE_RETURNVOID && 
864               c->opcode != OPCODE_RETURNVALUE)) {
865         c = abc_returnvoid(c);
866     }
867     return c;
868 }
869
870
871 static void startpackage(char*name)
872 {
873     new_state();
874     /*printf("entering package \"%s\"\n", name);*/
875     state->package = strdup(name);
876 }
877 static void endpackage()
878 {
879     /*printf("leaving package \"%s\"\n", state->package);*/
880
881     //used e.g. in classinfo_register:
882     //free(state->package);state->package=0;
883
884     old_state();
885 }
886
887 #define FLAG_PUBLIC 256
888 #define FLAG_PROTECTED 512
889 #define FLAG_PRIVATE 1024
890 #define FLAG_PACKAGEINTERNAL 2048
891 #define FLAG_NAMESPACE 4096
892
893 static namespace_t modifiers2access(modifiers_t*mod)
894 {
895     namespace_t ns;
896     ns.access = 0;
897     ns.name = "";
898     if(mod->flags&FLAG_NAMESPACE)  {
899         if(mod->flags&(FLAG_PRIVATE|FLAG_PROTECTED|FLAG_PACKAGEINTERNAL)) 
900             syntaxerror("invalid combination of access levels and namespaces");
901         ns.access = ACCESS_NAMESPACE;
902         state_t*s = state;
903         const char*url = (const char*)trie_lookup(active_namespaces, mod->ns);
904         if(!url) {
905             /* shouldn't happen- the tokenizer only reports something as a namespace
906                if it was already registered */
907             trie_dump(active_namespaces);
908             syntaxerror("unknown namespace: %s", mod->ns);
909         }
910         ns.name = url;
911     } else if(mod->flags&FLAG_PUBLIC)  {
912         if(mod->flags&(FLAG_PRIVATE|FLAG_PROTECTED|FLAG_PACKAGEINTERNAL)) 
913             syntaxerror("invalid combination of access levels");
914         ns.access = ACCESS_PACKAGE;
915     } else if(mod->flags&FLAG_PRIVATE) {
916         if(mod->flags&(FLAG_PUBLIC|FLAG_PROTECTED|FLAG_PACKAGEINTERNAL)) 
917             syntaxerror("invalid combination of access levels");
918         ns.access = ACCESS_PRIVATE;
919     } else if(mod->flags&FLAG_PROTECTED) {
920         if(mod->flags&(FLAG_PUBLIC|FLAG_PRIVATE|FLAG_PACKAGEINTERNAL)) 
921             syntaxerror("invalid combination of access levels");
922         ns.access = ACCESS_PROTECTED;
923     } else {
924         ns.access = ACCESS_PACKAGEINTERNAL;
925     }
926     return ns;
927 }
928 static slotinfo_t* find_class(const char*name);
929
930 static memberinfo_t* findmember_nsset(classinfo_t*cls, const char*name, char recurse)
931 {
932     return registry_findmember_nsset(cls, state->active_namespace_urls, name, recurse);
933 }
934
935 void add_active_url(const char*url)
936 {
937     NEW(namespace_t,n);
938     n->name = url;
939     list_append(state->active_namespace_urls, n);
940 }
941
942 static void function_initvars(methodstate_t*m, params_t*params, int flags, char var0)
943 {
944     if(var0) {
945         int index = -1;
946         if(m->inner)
947             index = new_variable("this", 0, 0, 0);
948         else if(!m->is_global)
949             index = new_variable((flags&FLAG_STATIC)?"class":"this", state->cls?state->cls->info:0, 0, 0);
950         else
951             index = new_variable("globalscope", 0, 0, 0);
952         if(index)
953             *(int*)0=0;
954         parserassert(!index);
955     }
956
957     if(m->uses_slots) {
958         /* as variables and slots share the same number, make sure
959            that those variable indices are reserved. It's up to the
960            optimizer to later shuffle the variables down to lower
961            indices */
962         m->variable_count = m->uses_slots;
963     }
964
965     if(params) {
966         param_list_t*p=0;
967         for(p=params->list;p;p=p->next) {
968             variable_t*v = new_variable2(p->param->name, p->param->type, 0, 1);
969             v->is_parameter = 1;
970         }
971     }
972     if(m->uses_slots) {
973         dict_dump(m->slots, stdout, "");
974     }
975
976     methodstate_list_t*l = m->innerfunctions;
977     while(l) {
978         methodstate_t*m = l->methodstate;
979         
980         variable_t* v = new_variable2(m->info->name, TYPE_FUNCTION(m->info), 0, 1);
981         m->var_index = v->index;
982         m->slot_index = v->index;
983         v->is_inner_method = m;
984
985         l = l->next;
986     }
987     
988     if(as3_pass==2) {
989         m->scope_code = add_scope_code(m->scope_code, m, 0);
990     }
991     
992     if(as3_pass==2 && m->slots) {
993         /* exchange unresolved identifiers with the actual objects */
994         DICT_ITERATE_ITEMS(m->slots, char*, name, variable_t*, v) {
995             if(v->type && v->type->kind == INFOTYPE_UNRESOLVED) {
996                 classinfo_t*type = (classinfo_t*)registry_resolve((slotinfo_t*)v->type);
997                 if(!type || type->kind != INFOTYPE_CLASS) {
998                     syntaxerror("Couldn't find class %s::%s (%s)", v->type->package, v->type->name, name);
999                 }
1000                 v->type = type;
1001             }
1002         }
1003     }
1004 }
1005
1006
1007 char*as3_globalclass=0;
1008 static void startclass(modifiers_t* mod, char*classname, classinfo_t*extends, classinfo_list_t*implements)
1009 {
1010     if(state->cls) {
1011         syntaxerror("inner classes now allowed"); 
1012     }
1013
1014     new_state();
1015     token_list_t*t=0;
1016     classinfo_list_t*mlist=0;
1017
1018     if(mod->flags&~(FLAG_PACKAGEINTERNAL|FLAG_PUBLIC|FLAG_FINAL|FLAG_DYNAMIC|FLAG_INTERFACE))
1019         syntaxerror("invalid modifier(s)");
1020
1021     if((mod->flags&(FLAG_PUBLIC|FLAG_PACKAGEINTERNAL)) == (FLAG_PUBLIC|FLAG_PACKAGEINTERNAL))
1022         syntaxerror("public and internal not supported at the same time.");
1023     
1024     //if(!(mod->flags&FLAG_INTERFACE) && !extends) {
1025     if(!(mod->flags&FLAG_INTERFACE) && !extends) {
1026         // all classes extend object
1027         extends = registry_getobjectclass();
1028     }
1029
1030     /* create the class name, together with the proper attributes */
1031     int access=0;
1032     char*package=0;
1033
1034     if(!(mod->flags&FLAG_PUBLIC) && state->package==internal_filename_package) {
1035         access = ACCESS_PRIVATE; package = internal_filename_package;
1036     } else if(!(mod->flags&FLAG_PUBLIC) && state->package!=internal_filename_package) {
1037         access = ACCESS_PACKAGEINTERNAL; package = state->package;
1038     } else if(state->package!=internal_filename_package) {
1039         access = ACCESS_PACKAGE; package = state->package;
1040     } else {
1041         syntaxerror("public classes only allowed inside a package");
1042     }
1043
1044     if(as3_pass==1) {
1045         state->cls = rfx_calloc(sizeof(classstate_t));
1046         state->cls->init = rfx_calloc(sizeof(methodstate_t));
1047         state->cls->static_init = rfx_calloc(sizeof(methodstate_t));
1048         /* notice: we make no effort to initialize the top variable (local0) here,
1049            even though it has special meaning. We just rely on the facat
1050            that pass 1 won't do anything with variables */
1051         
1052         dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->cls);
1053
1054         /* set current method to constructor- all code within the class-level (except
1055            static variable initializations) will be executed during construction time */
1056         state->method = state->cls->init;
1057
1058         if(registry_find(package, classname)) {
1059             syntaxerror("Package \"%s\" already contains a class called \"%s\"", package, classname);
1060         }
1061         /* build info struct */
1062         int num_interfaces = (list_length(implements));
1063         state->cls->info = classinfo_register(access, package, classname, num_interfaces);
1064         state->cls->info->flags |= mod->flags & (FLAG_DYNAMIC|FLAG_INTERFACE|FLAG_FINAL);
1065         
1066         int pos = 0;
1067         classinfo_list_t*l = implements;
1068         for(l=implements;l;l=l->next) {
1069             state->cls->info->interfaces[pos++] = l->classinfo;
1070         }
1071     }
1072     
1073     if(as3_pass == 2) {
1074         state->cls = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
1075         
1076         state->method = state->cls->init;
1077         parserassert(state->cls && state->cls->info);
1078        
1079         function_initvars(state->cls->init, 0, 0, 1);
1080         function_initvars(state->cls->static_init, 0, 0, 0);
1081
1082         if(extends && (extends->flags & FLAG_FINAL))
1083             syntaxerror("Can't extend final class '%s'", extends->name);
1084         
1085         int pos = 0;
1086         while(state->cls->info->interfaces[pos]) {
1087             if(!(state->cls->info->interfaces[pos]->flags & FLAG_INTERFACE))
1088                 syntaxerror("'%s' is not an interface", 
1089                     state->cls->info->interfaces[pos]->name);
1090             pos++;
1091         }
1092
1093         /* fill out interfaces and extends (we couldn't resolve those during the first pass) */
1094         state->cls->info->superclass = extends;
1095
1096         /* generate the abc code for this class */
1097         MULTINAME(classname2,state->cls->info);
1098         multiname_t*extends2 = sig2mname(extends);
1099
1100         state->cls->abc = abc_class_new(global->file, &classname2, extends2);
1101         if(state->cls->info->flags&FLAG_FINAL) abc_class_final(state->cls->abc);
1102         if(!(state->cls->info->flags&FLAG_DYNAMIC)) abc_class_sealed(state->cls->abc);
1103         if(state->cls->info->flags&FLAG_INTERFACE) {
1104             abc_class_interface(state->cls->abc);
1105         }
1106
1107         abc_class_protectedNS(state->cls->abc, classname);
1108
1109         for(mlist=implements;mlist;mlist=mlist->next) {
1110             MULTINAME(m, mlist->classinfo);
1111             abc_class_add_interface(state->cls->abc, &m);
1112         }
1113
1114         /* write the construction code for this class to the global init
1115            function */
1116         int slotindex = abc_initscript_addClassTrait(global->init, &classname2, state->cls->abc);
1117
1118         abc_method_body_t*m = global->init->method->body;
1119         __ getglobalscope(m);
1120         classinfo_t*s = extends;
1121
1122         int count=0;
1123         
1124         while(s) {
1125             //TODO: take a look at the current scope stack, maybe 
1126             //      we can re-use something
1127             s = s->superclass;
1128             if(!s) 
1129             break;
1130            
1131             multiname_t*s2 = sig2mname(s);
1132             __ getlex2(m, s2);
1133             multiname_destroy(s2);
1134
1135             __ pushscope(m); count++;
1136             m->code = m->code->prev->prev; // invert
1137         }
1138         /* continue appending after last op end */
1139         while(m->code && m->code->next) m->code = m->code->next; 
1140
1141         /* TODO: if this is one of *our* classes, we can also 
1142                  do a getglobalscope/getslot <nr> (which references
1143                  the init function's slots) */
1144         if(extends2) {
1145             __ getlex2(m, extends2);
1146             __ dup(m);
1147             /* notice: we get a Verify Error #1107 if the top elemnt on the scope
1148                stack is not the superclass */
1149             __ pushscope(m);count++;
1150         } else {
1151             __ pushnull(m);
1152             /* notice: we get a verify error #1107 if the top element on the scope 
1153                stack is not the global object */
1154             __ getlocal_0(m);
1155             __ pushscope(m);count++;
1156         }
1157         __ newclass(m,state->cls->abc);
1158         while(count--) {
1159             __ popscope(m);
1160         }
1161         __ setslot(m, slotindex);
1162         multiname_destroy(extends2);
1163
1164         /* flash.display.MovieClip handling */
1165
1166         if(!as3_globalclass && (mod->flags&FLAG_PUBLIC) && slotinfo_equals((slotinfo_t*)registry_getMovieClip(),(slotinfo_t*)extends)) {
1167             if(state->package && state->package[0]) {
1168                 as3_globalclass = concat3(state->package, ".", classname);
1169             } else {
1170                 as3_globalclass = strdup(classname);
1171             }
1172         }
1173     }
1174 }
1175
1176 static int slotstate_varconst = 0;
1177 static modifiers_t*slotstate_flags = 0;
1178 static void setslotstate(modifiers_t* flags, int varconst)
1179 {
1180     slotstate_varconst = varconst;
1181     slotstate_flags = flags;
1182     if(state->cls) {
1183         if(flags && flags->flags&FLAG_STATIC) {
1184             state->method = state->cls->static_init;
1185         } else {
1186             state->method = state->cls->init;
1187         }
1188     } else {
1189         parserassert(state->method);
1190     }
1191 }
1192
1193 static void endclass()
1194 {
1195     if(as3_pass == 2) {
1196         if(!state->cls->has_constructor && !(state->cls->info->flags&FLAG_INTERFACE)) {
1197             code_t*c = 0;
1198             c = abc_getlocal_0(c);
1199             c = abc_constructsuper(c, 0);
1200             state->cls->init->header = code_append(state->cls->init->header, c);
1201             state->cls->has_constructor=1;
1202         }
1203         if(state->cls->init) {
1204             if(state->cls->info->flags&FLAG_INTERFACE) {
1205                 if(state->cls->init->header) 
1206                     syntaxerror("interface can not have class-level code");
1207             } else {
1208                 abc_method_t*m = abc_class_getconstructor(state->cls->abc, 0);
1209                 code_t*c = method_header(state->cls->init);
1210                 m->body->code = wrap_function(c, 0, m->body->code);
1211             }
1212         }
1213         if(state->cls->static_init) {
1214             abc_method_t*m = abc_class_getstaticconstructor(state->cls->abc, 0);
1215             code_t*c = method_header(state->cls->static_init);
1216             m->body->code = wrap_function(c, 0, m->body->code);
1217         }
1218     }
1219
1220     old_state();
1221 }
1222
1223 void check_code_for_break(code_t*c)
1224 {
1225     while(c) {
1226         if(c->opcode == OPCODE___BREAK__) {
1227             char*name = string_cstr(c->data[0]);
1228             syntaxerror("Unresolved \"break %s\"", name);
1229         }
1230         if(c->opcode == OPCODE___CONTINUE__) {
1231             char*name = string_cstr(c->data[0]);
1232             syntaxerror("Unresolved \"continue %s\"", name);
1233         }
1234         if(c->opcode == OPCODE___PUSHPACKAGE__) {
1235             char*name = string_cstr(c->data[0]);
1236             syntaxerror("Can't reference a package (%s) as such", name);
1237         }
1238         c=c->prev;
1239     }
1240 }
1241
1242
1243 static void check_constant_against_type(classinfo_t*t, constant_t*c)
1244 {
1245     return;
1246 #define xassert(b) if(!(b)) syntaxerror("Invalid default value %s for type '%s'", constant_tostring(c), t->name)
1247    if(TYPE_IS_NUMBER(t)) {
1248         xassert(c->type == CONSTANT_FLOAT
1249              || c->type == CONSTANT_INT
1250              || c->type == CONSTANT_UINT);
1251    } else if(TYPE_IS_UINT(t)) {
1252         xassert(c->type == CONSTANT_UINT ||
1253                (c->type == CONSTANT_INT && c->i>=0));
1254    } else if(TYPE_IS_INT(t)) {
1255         xassert(c->type == CONSTANT_INT);
1256    } else if(TYPE_IS_BOOLEAN(t)) {
1257         xassert(c->type == CONSTANT_TRUE
1258              || c->type == CONSTANT_FALSE);
1259    }
1260 }
1261
1262 static void check_override(memberinfo_t*m, int flags)
1263 {
1264     if(!m)
1265         return;
1266     if(m->parent == state->cls->info)
1267         syntaxerror("class '%s' already contains a method/slot '%s'", m->parent->name, m->name);
1268     if(!m->parent)
1269         syntaxerror("internal error: overriding method %s, which doesn't have parent", m->name);
1270     if(m->access==ACCESS_PRIVATE)
1271         return;
1272     if(m->flags & FLAG_FINAL)
1273         syntaxerror("can't override final member %s", m->name);
1274     
1275     /* allow this. it's no issue.
1276     if((m->flags & FLAG_STATIC) && !(flags&FLAG_STATIC))
1277         syntaxerror("can't override static member %s", m->name);*/
1278
1279     if(!(m->flags & FLAG_STATIC) && (flags&FLAG_STATIC))
1280         syntaxerror("can't override non-static member %s with static declaration", m->name);
1281
1282     if(!(flags&FLAG_OVERRIDE) && !(flags&FLAG_STATIC) && !(m->flags&FLAG_STATIC)) {
1283         if(m->parent && !(m->parent->flags&FLAG_INTERFACE)) {
1284             if(m->kind == INFOTYPE_METHOD)
1285                 syntaxerror("can't override without explicit 'override' declaration");
1286             else
1287                 syntaxerror("can't override '%s'", m->name);
1288         }
1289     }
1290 }
1291
1292 static methodinfo_t*registerfunction(enum yytokentype getset, modifiers_t*mod, char*name, params_t*params, classinfo_t*return_type, int slot)
1293 {
1294     methodinfo_t*minfo = 0;
1295     namespace_t ns = modifiers2access(mod);
1296     if(!state->cls) {
1297         //package method
1298         minfo = methodinfo_register_global(ns.access, state->package, name);
1299         minfo->return_type = 0; // save this for pass 2
1300     } else if(getset != KW_GET && getset != KW_SET) {
1301         //class method
1302         memberinfo_t* m = registry_findmember(state->cls->info, ns.name, name, 0);
1303         if(m) {
1304             printf("%s.%s | %s.%s\n", 
1305                 m->package, m->name,
1306                 ns.name, name);
1307             syntaxerror("class already contains a %s '%s'", infotypename((slotinfo_t*)m), m->name);
1308         }
1309         minfo = methodinfo_register_onclass(state->cls->info, ns.access, ns.name, name);
1310         minfo->return_type = 0; // save this for pass 2 
1311         // getslot on a member slot only returns "undefined", so no need
1312         // to actually store these
1313         //state->minfo->slot = state->method->abc->method->trait->slot_id;
1314     } else {
1315         //class getter/setter
1316         int gs = getset==KW_GET?SUBTYPE_GET:SUBTYPE_SET;
1317         classinfo_t*type=0;
1318         if(getset == KW_GET) {
1319             type = return_type;
1320         } else if(params->list && params->list->param && !params->list->next) {
1321             type = params->list->param->type;
1322         } else
1323             syntaxerror("setter function needs to take exactly one argument");
1324         // not sure wether to look into superclasses here, too
1325         minfo = (methodinfo_t*)registry_findmember(state->cls->info, ns.name, name, 1);
1326         if(minfo) {
1327             if(minfo->kind!=INFOTYPE_SLOT)
1328                 syntaxerror("class already contains a method called '%s'", name);
1329             if(!(minfo->subtype & (SUBTYPE_GETSET)))
1330                 syntaxerror("class already contains a field called '%s'", name);
1331             if(minfo->subtype & gs)
1332                 syntaxerror("getter/setter for '%s' already defined", name);
1333             /* make a setter or getter into a getset */
1334             minfo->subtype |= gs;
1335             
1336             /*
1337             FIXME: this check needs to be done in pass 2
1338             
1339             if((!minfo->return_type != !type) ||
1340                 (minfo->return_type && type && 
1341                  !strcmp(minfo->return_type->name, type->name))) {
1342                 syntaxerror("different type in getter and setter: %s and %s", 
1343                     minfo->return_type?minfo->return_type->name:"*", 
1344                     type?type->name:"*");
1345             }*/
1346         } else {
1347             minfo = methodinfo_register_onclass(state->cls->info, ns.access, ns.name, name);
1348             minfo->kind = INFOTYPE_SLOT; //hack
1349             minfo->subtype = gs;
1350             minfo->return_type = 0;
1351         }
1352         /* can't assign a slot as getter and setter might have different slots */
1353         //minfo->slot = slot;
1354     }
1355     if(mod->flags&FLAG_FINAL) minfo->flags |= FLAG_FINAL;
1356     if(mod->flags&FLAG_STATIC) minfo->flags |= FLAG_STATIC;
1357     if(mod->flags&FLAG_OVERRIDE) minfo->flags |= FLAG_OVERRIDE;
1358
1359     return minfo;
1360 }
1361
1362 static void innerfunction(char*name, params_t*params, classinfo_t*return_type)
1363 {
1364     //parserassert(state->method && state->method->info);
1365
1366     methodstate_t*parent_method = state->method;
1367
1368     if(as3_pass==1) {
1369         return_type = 0; // not valid in pass 1
1370     }
1371
1372     new_state();
1373     state->new_vars = 1;
1374    
1375     if(as3_pass == 1) {
1376         state->method = rfx_calloc(sizeof(methodstate_t));
1377         state->method->inner = 1;
1378         state->method->variable_count = 0;
1379         state->method->abc = rfx_calloc(sizeof(abc_method_t));
1380
1381         NEW(methodinfo_t,minfo);
1382         minfo->kind = INFOTYPE_METHOD;
1383         minfo->access = ACCESS_PACKAGEINTERNAL;
1384         minfo->name = name;
1385         state->method->info = minfo;
1386
1387         if(parent_method)
1388             list_append(parent_method->innerfunctions, state->method);
1389
1390         dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
1391     
1392         function_initvars(state->method, params, 0, 1);
1393     }
1394
1395     if(as3_pass == 2) {
1396         state->method = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
1397         state->method->variable_count = 0;
1398         parserassert(state->method);
1399
1400         state->method->info->return_type = return_type;
1401         function_initvars(state->method, params, 0, 1);
1402     }
1403 }
1404
1405 static void startfunction(modifiers_t*mod, enum yytokentype getset, char*name,
1406                           params_t*params, classinfo_t*return_type)
1407 {
1408     if(state->method && state->method->info) {
1409         syntaxerror("not able to start another method scope");
1410     }
1411     new_state();
1412     state->new_vars = 1;
1413     
1414     if(as3_pass == 1) {
1415         state->method = rfx_calloc(sizeof(methodstate_t));
1416         state->method->has_super = 0;
1417
1418         if(state->cls) {
1419             state->method->is_constructor = !strcmp(state->cls->info->name,name);
1420         } else {
1421             state->method->is_global = 1;
1422             state->method->late_binding = 1; // for global methods, always push local_0 on the scope stack
1423         }
1424         if(state->method->is_constructor)
1425             name = "__as3_constructor__";
1426
1427         state->method->info = registerfunction(getset, mod, name, params, return_type, 0);
1428        
1429         function_initvars(state->method, params, mod->flags, 1);
1430         
1431         dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
1432     }
1433
1434     if(as3_pass == 2) {
1435         state->method = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
1436         state->method->variable_count = 0;
1437         parserassert(state->method);
1438                 
1439         if(state->cls) {
1440             memberinfo_t*m = registry_findmember(state->cls->info, mod->ns, name, 2);
1441             check_override(m, mod->flags);
1442         }
1443             
1444         if(state->cls) { 
1445             state->cls->has_constructor |= state->method->is_constructor;
1446         }
1447         
1448         state->method->info->return_type = return_type;
1449         function_initvars(state->method, params, mod->flags, 1);
1450     } 
1451 }
1452
1453 static abc_method_t* endfunction(modifiers_t*mod, enum yytokentype getset, char*name,
1454                           params_t*params, classinfo_t*return_type, code_t*body)
1455 {
1456     if(as3_pass==1) {
1457         // store inner methods in variables
1458         function_initvars(state->method, 0, 0, 0);
1459
1460         methodstate_list_t*ml = state->method->innerfunctions;
1461         
1462         dict_t*xvars = dict_new();
1463
1464         while(ml) {
1465             methodstate_t*m = ml->methodstate;
1466             parserassert(m->inner);
1467             if(m->unresolved_variables) {
1468                 dict_t*d = m->unresolved_variables;
1469                 int t;
1470                 for(t=0;t<d->hashsize;t++) {
1471                     dictentry_t*l = d->slots[t]; 
1472                     while(l) {
1473                         /* check parent method's variables */
1474                         variable_t*v;
1475                         if((v=find_variable(state, l->key))) {
1476                             m->uses_parent_function = 1;
1477                             state->method->uses_slots = 1;
1478                             dict_put(xvars, l->key, 0);
1479                         }
1480                         l = l->next;
1481                     }
1482                     if(l) break;
1483                 }
1484
1485                 dict_destroy(m->unresolved_variables);
1486                 m->unresolved_variables = 0;
1487             }
1488             ml = ml->next;
1489         }
1490         
1491         if(state->method->uses_slots) {
1492             state->method->slots = dict_new();
1493             int i = 1;
1494             DICT_ITERATE_ITEMS(state->vars, char*, name, variable_t*, v) {
1495                 if(!name) syntaxerror("internal error");
1496                 if(v->index && dict_contains(xvars, name)) {
1497                     v->init = 0;
1498                     v->index = i++;
1499                     if(v->is_inner_method) {
1500                         v->is_inner_method->is_a_slot = 1;
1501                     }
1502                     //v->type = 0;
1503                     dict_put(state->method->slots, name, v);
1504                 }
1505             }
1506             state->method->uses_slots = i;
1507             dict_destroy(state->vars);state->vars = 0;
1508         }
1509         old_state();
1510         return 0;
1511     }
1512
1513     if(as3_pass==2) {
1514         /*if(state->method->uses_parent_function){
1515             syntaxerror("accessing variables of parent function from inner functions not supported yet");
1516         }*/
1517
1518         abc_method_t*f = 0;
1519
1520         multiname_t*type2 = sig2mname(return_type);
1521         int slot = 0;
1522         if(state->method->inner) {
1523             f = state->method->abc;
1524             abc_method_init(f, global->file, type2, 1);
1525         } else if(state->method->is_constructor) {
1526             f = abc_class_getconstructor(state->cls->abc, type2);
1527         } else if(!state->method->is_global) {
1528             namespace_t mname_ns = modifiers2access(mod);
1529             multiname_t mname = {QNAME, &mname_ns, 0, name};
1530
1531             if(mod->flags&FLAG_STATIC)
1532                 f = abc_class_staticmethod(state->cls->abc, type2, &mname);
1533             else
1534                 f = abc_class_method(state->cls->abc, type2, &mname);
1535             slot = f->trait->slot_id;
1536         } else {
1537             namespace_t mname_ns = {state->method->info->access, state->package};
1538             multiname_t mname = {QNAME, &mname_ns, 0, name};
1539
1540             f = abc_method_new(global->file, type2, 1);
1541             trait_t*t = trait_new_method(&global->init->traits, multiname_clone(&mname), f);
1542             //abc_code_t*c = global->init->method->body->code;
1543         }
1544         //flash doesn't seem to allow us to access function slots
1545         //state->method->info->slot = slot;
1546
1547         if(mod && mod->flags&FLAG_OVERRIDE) f->trait->attributes |= TRAIT_ATTR_OVERRIDE;
1548         if(getset == KW_GET) f->trait->kind = TRAIT_GETTER;
1549         if(getset == KW_SET) f->trait->kind = TRAIT_SETTER;
1550         if(params->varargs) f->flags |= METHOD_NEED_REST;
1551
1552         char opt=0;
1553         param_list_t*p=0;
1554         for(p=params->list;p;p=p->next) {
1555             if(params->varargs && !p->next) {
1556                 break; //varargs: omit last parameter in function signature
1557             }
1558             multiname_t*m = sig2mname(p->param->type);
1559             list_append(f->parameters, m);
1560             if(p->param->value) {
1561                 check_constant_against_type(p->param->type, p->param->value);
1562                 opt=1;list_append(f->optional_parameters, p->param->value);
1563             } else if(opt) {
1564                 syntaxerror("non-optional parameter not allowed after optional parameters");
1565             }
1566         }
1567         if(state->method->slots) {
1568             DICT_ITERATE_ITEMS(state->method->slots, char*, name, variable_t*, v) {
1569                 if(v->index) {
1570                     multiname_t*mname = multiname_new(namespace_new(ACCESS_PACKAGE, ""), name);
1571                     multiname_t*type = sig2mname(v->type);
1572                     trait_t*t = trait_new_member(&f->body->traits, type, mname, 0);
1573                     t->slot_id = v->index;
1574                 }
1575             }
1576         }
1577
1578         check_code_for_break(body);
1579
1580         /* Seems this works now.
1581         if(state->method->exceptions && state->method->uses_slots) {
1582            as3_warning("try/catch and activation not supported yet within the same method");
1583         }*/
1584
1585         if(f->body) {
1586             f->body->code = body;
1587             f->body->exceptions = state->method->exceptions;
1588         } else { //interface
1589             if(body)
1590                 syntaxerror("interface methods can't have a method body");
1591         }
1592
1593         old_state();
1594         return f;
1595     }
1596         
1597     return 0;
1598 }
1599
1600 char is_subtype_of(classinfo_t*type, classinfo_t*supertype)
1601 {
1602     return 1; // FIXME
1603 }
1604
1605 void breakjumpsto(code_t*c, char*name, code_t*jump) 
1606 {
1607     while(c) {
1608         if(c->opcode == OPCODE___BREAK__) {
1609             string_t*name2 = c->data[0];
1610             if(!name2->len || !strncmp(name2->str, name, name2->len)) {
1611                 c->opcode = OPCODE_JUMP;
1612                 c->branch = jump;
1613             }
1614         }
1615         c=c->prev;
1616     }
1617 }
1618 void continuejumpsto(code_t*c, char*name, code_t*jump) 
1619 {
1620     while(c) {
1621         if(c->opcode == OPCODE___CONTINUE__) {
1622             string_t*name2 = c->data[0];
1623             if(!name2->len || !strncmp(name2->str, name, name2->len)) {
1624                 c->opcode = OPCODE_JUMP;
1625                 c->branch = jump;
1626             }
1627         }
1628         c = c->prev;
1629     }
1630 }
1631
1632 #define IS_INT(a) (TYPE_IS_INT((a)) || TYPE_IS_UINT((a)))
1633 #define IS_NUMBER_OR_INT(a) (TYPE_IS_INT((a)) || TYPE_IS_UINT((a)) || TYPE_IS_NUMBER((a)))
1634 #define BOTH_INT(a,b) (IS_INT(a) && IS_INT(b))
1635
1636 classinfo_t*join_types(classinfo_t*type1, classinfo_t*type2, char op)
1637 {
1638     if(!type1 || !type2) 
1639         return registry_getanytype();
1640     if(TYPE_IS_ANY(type1) || TYPE_IS_ANY(type2))
1641         return registry_getanytype();
1642
1643     if(op=='+') {
1644         if(IS_NUMBER_OR_INT(type1) && IS_NUMBER_OR_INT(type2)) {
1645             return TYPE_NUMBER;
1646         } else {
1647             return TYPE_ANY;
1648         }
1649     }
1650
1651     if(type1 == type2)
1652         return type1;
1653     return registry_getanytype();
1654 }
1655 code_t*converttype(code_t*c, classinfo_t*from, classinfo_t*to)
1656 {
1657     if(from==to)
1658         return c;
1659     if(!to) {
1660         return abc_coerce_a(c);
1661     }
1662     MULTINAME(m, to);
1663     if(!from) {
1664         // cast an "any" type to a specific type. subject to
1665         // runtime exceptions
1666         return abc_coerce2(c, &m);
1667     }
1668     
1669     if((TYPE_IS_NUMBER(from) || TYPE_IS_UINT(from) || TYPE_IS_INT(from)) &&
1670        (TYPE_IS_NUMBER(to) || TYPE_IS_UINT(to) || TYPE_IS_INT(to))) {
1671         // allow conversion between number types
1672         return abc_coerce2(c, &m);
1673     }
1674     //printf("%s.%s\n", from.package, from.name);
1675     //printf("%s.%s\n", to.package, to.name);
1676
1677     classinfo_t*supertype = from;
1678     while(supertype) {
1679         if(supertype == to) {
1680              // target type is one of from's superclasses
1681              return abc_coerce2(c, &m);
1682         }
1683         int t=0;
1684         while(supertype->interfaces[t]) {
1685             if(supertype->interfaces[t]==to) {
1686                 // target type is one of from's interfaces
1687                 return abc_coerce2(c, &m);
1688             }
1689             t++;
1690         }
1691         supertype = supertype->superclass;
1692     }
1693     if(TYPE_IS_FUNCTION(from) && TYPE_IS_FUNCTION(to))
1694         return c;
1695     if(TYPE_IS_CLASS(from) && TYPE_IS_CLASS(to))
1696         return c;
1697     if(TYPE_IS_NULL(from) && !IS_NUMBER_OR_INT(to))
1698         return c;
1699
1700     as3_error("can't convert type %s%s%s to %s%s%s", 
1701         from->package, from->package?".":"", from->name, 
1702         to->package, to->package?".":"", to->name);
1703     return c;
1704 }
1705
1706 code_t*defaultvalue(code_t*c, classinfo_t*type)
1707 {
1708     if(TYPE_IS_INT(type)) {
1709        c = abc_pushbyte(c, 0);
1710     } else if(TYPE_IS_UINT(type)) {
1711        c = abc_pushuint(c, 0);
1712     } else if(TYPE_IS_FLOAT(type)) {
1713        c = abc_pushnan(c);
1714     } else if(TYPE_IS_BOOLEAN(type)) {
1715        c = abc_pushfalse(c);
1716     } else if(!type) {
1717        //c = abc_pushundefined(c);
1718     } else {
1719        c = abc_pushnull(c);
1720        MULTINAME(m, type);
1721        c = abc_coerce2(c, &m);
1722     }
1723     return c;
1724 }
1725
1726 char is_pushundefined(code_t*c)
1727 {
1728     return (c && !c->prev && !c->next && c->opcode == OPCODE_PUSHUNDEFINED);
1729 }
1730
1731 static const char* get_package_from_name(const char*name)
1732 {
1733     /* try explicit imports */
1734     dictentry_t* e = dict_get_slot(state->imports, name);
1735     while(e) {
1736         if(!strcmp(e->key, name)) {
1737             slotinfo_t*c = (slotinfo_t*)e->data;
1738             if(c) return c->package;
1739         }
1740         e = e->next;
1741     }
1742     return 0;
1743 }
1744 static namespace_list_t*get_current_imports()
1745 {
1746     namespace_list_t*searchlist = 0;
1747     
1748     list_append(searchlist, namespace_new_package(state->package));
1749
1750     import_list_t*l = state->wildcard_imports;
1751     while(l) {
1752         namespace_t*ns = namespace_new_package(l->import->package);
1753         list_append(searchlist, ns);
1754         l = l->next;
1755     }
1756     list_append(searchlist, namespace_new_package(""));
1757     list_append(searchlist, namespace_new_package(internal_filename_package));
1758     return searchlist;
1759 }
1760
1761 static slotinfo_t* find_class(const char*name)
1762 {
1763     slotinfo_t*c=0;
1764
1765     c = registry_find(state->package, name);
1766     if(c) return c;
1767
1768     /* try explicit imports */
1769     dictentry_t* e = dict_get_slot(state->imports, name);
1770     if(c) return c;
1771     while(e) {
1772         if(!strcmp(e->key, name)) {
1773             c = (slotinfo_t*)e->data;
1774             if(c) return c;
1775         }
1776         e = e->next;
1777     }
1778
1779     /* try package.* imports */
1780     import_list_t*l = state->wildcard_imports;
1781     while(l) {
1782         //printf("does package %s contain a class %s?\n", l->import->package, name);
1783         c = registry_find(l->import->package, name);
1784         if(c) return c;
1785         l = l->next;
1786     }
1787
1788     /* try global package */
1789     c = registry_find("", name);
1790     if(c) return c;
1791   
1792     /* try local "filename" package */
1793     c = registry_find(internal_filename_package, name);
1794     if(c) return c;
1795
1796     return 0;
1797 }
1798 typedcode_t push_class(slotinfo_t*a)
1799 {
1800     typedcode_t x;
1801     x.c = 0;
1802     x.t = 0;
1803     if(a->access == ACCESS_PACKAGEINTERNAL &&
1804        strcmp(a->package, state->package) &&
1805        strcmp(a->package, internal_filename_package)
1806        ) {
1807        syntaxerror("Can't access internal %s %s in package '%s' from package '%s'",
1808             infotypename(a), a->name, a->package, state->package);
1809     }
1810
1811     if(a->kind != INFOTYPE_CLASS) {
1812         MULTINAME(m, a);
1813         x.c = abc_findpropstrict2(x.c, &m);
1814         x.c = abc_getproperty2(x.c, &m);
1815         if(a->kind == INFOTYPE_METHOD) {
1816             methodinfo_t*f = (methodinfo_t*)a;
1817             x.t = TYPE_FUNCTION(f);
1818         } else {
1819             varinfo_t*v = (varinfo_t*)a;
1820             x.t = v->type;
1821         }
1822     } else {
1823         classinfo_t*c = (classinfo_t*)a;
1824         if(c->slot) {
1825             x.c = abc_getglobalscope(x.c);
1826             x.c = abc_getslot(x.c, c->slot);
1827         } else {
1828             MULTINAME(m, c);
1829             x.c = abc_getlex2(x.c, &m);
1830         }
1831         x.t = TYPE_CLASS(c);
1832     }
1833     return x;
1834 }
1835
1836 static char is_getlocal(code_t*c)
1837 {
1838     if(!c || c->prev || c->next)
1839         return 0;
1840     return(c->opcode == OPCODE_GETLOCAL
1841         || c->opcode == OPCODE_GETLOCAL_0
1842         || c->opcode == OPCODE_GETLOCAL_1
1843         || c->opcode == OPCODE_GETLOCAL_2
1844         || c->opcode == OPCODE_GETLOCAL_3);
1845 }
1846 static int getlocalnr(code_t*c)
1847 {
1848     if(c->opcode == OPCODE_GETLOCAL) {return (ptroff_t)c->data[0];}
1849     else if(c->opcode == OPCODE_GETLOCAL_0) {return 0;}
1850     else if(c->opcode == OPCODE_GETLOCAL_1) {return 1;}
1851     else if(c->opcode == OPCODE_GETLOCAL_2) {return 2;}
1852     else if(c->opcode == OPCODE_GETLOCAL_3) {return 3;}
1853     else syntaxerror("Internal error: opcode %02x is not a getlocal call", c->opcode);
1854     return 0;
1855 }
1856
1857 static code_t* toreadwrite(code_t*in, code_t*middlepart, char justassign, char readbefore)
1858 {
1859     /* converts this:
1860
1861        [prefix code] [read instruction]
1862
1863        to this:
1864
1865        [prefix code] ([dup]) [read instruction] [middlepart] [setvar] [write instruction] [getvar]
1866     */
1867     if(in && in->opcode == OPCODE_COERCE_A) {
1868         in = code_cutlast(in);
1869     }
1870     if(in->next)
1871         syntaxerror("internal error");
1872
1873     /* chop off read instruction */
1874     code_t*prefix = in;
1875     code_t*r = in;
1876     if(r->prev) {
1877         prefix = r->prev;r->prev = 0;
1878         prefix->next=0;
1879     } else {
1880         prefix = 0;
1881     }
1882         
1883     char use_temp_var = readbefore;
1884
1885     /* generate the write instruction, and maybe append a dup to the prefix code */
1886     code_t* write = abc_nop(0);
1887     if(r->opcode == OPCODE_GETPROPERTY) {
1888         write->opcode = OPCODE_SETPROPERTY;
1889         multiname_t*m = (multiname_t*)r->data[0];
1890         write->data[0] = multiname_clone(m);
1891         if(m->type == QNAME || m->type == MULTINAME) {
1892             if(!justassign) {
1893                 prefix = abc_dup(prefix); // we need the object, too
1894             }
1895             use_temp_var = 1;
1896         } else if(m->type == MULTINAMEL) {
1897             if(!justassign) {
1898                 /* dupping two values on the stack requires 5 operations and one register- 
1899                    couldn't adobe just have given us a dup2? */
1900                 int temp = gettempvar();
1901                 prefix = abc_setlocal(prefix, temp);
1902                 prefix = abc_dup(prefix);
1903                 prefix = abc_getlocal(prefix, temp);
1904                 prefix = abc_swap(prefix);
1905                 prefix = abc_getlocal(prefix, temp);
1906                 if(!use_temp_var);
1907                     prefix = abc_kill(prefix, temp);
1908             }
1909             use_temp_var = 1;
1910         } else {
1911             syntaxerror("illegal lvalue: can't assign a value to this expression (not a qname/multiname)");
1912         }
1913     } else if(r->opcode == OPCODE_GETSLOT) {
1914         write->opcode = OPCODE_SETSLOT;
1915         write->data[0] = r->data[0];
1916         if(!justassign) {
1917             prefix = abc_dup(prefix); // we need the object, too
1918         }
1919         use_temp_var = 1;
1920     } else if(r->opcode == OPCODE_GETLOCAL) { 
1921         write->opcode = OPCODE_SETLOCAL;
1922         write->data[0] = r->data[0];
1923     } else if(r->opcode == OPCODE_GETLOCAL_0) { 
1924         write->opcode = OPCODE_SETLOCAL_0;
1925     } else if(r->opcode == OPCODE_GETLOCAL_1) { 
1926         write->opcode = OPCODE_SETLOCAL_1;
1927     } else if(r->opcode == OPCODE_GETLOCAL_2) { 
1928         write->opcode = OPCODE_SETLOCAL_2;
1929     } else if(r->opcode == OPCODE_GETLOCAL_3) { 
1930         write->opcode = OPCODE_SETLOCAL_3;
1931     } else if(r->opcode == OPCODE_GETSUPER) { 
1932         write->opcode = OPCODE_SETSUPER;
1933         multiname_t*m = (multiname_t*)r->data[0];
1934         write->data[0] = multiname_clone(m);
1935     } else {
1936         code_dump(r);
1937         syntaxerror("illegal lvalue: can't assign a value to this expression");
1938     }
1939     code_t* c = 0;
1940     
1941     int temp = -1;
1942     if(!justassign) {
1943         if(use_temp_var) {
1944             /* with getproperty/getslot, we have to be extra careful not
1945                to execute the read code twice, as it might have side-effects
1946                (e.g. if the property is in fact a setter/getter combination)
1947
1948                So read the value, modify it, and write it again,
1949                using prefix only once and making sure (by using a temporary
1950                register) that the return value is what we just wrote */
1951             temp = gettempvar();
1952             c = code_append(c, prefix);
1953             c = code_append(c, r);
1954             if(readbefore) {
1955                 c = abc_dup(c);
1956                 c = abc_setlocal(c, temp);
1957             }
1958             c = code_append(c, middlepart);
1959             if(!readbefore) {
1960                 c = abc_dup(c);
1961                 c = abc_setlocal(c, temp);
1962             }
1963             c = code_append(c, write);
1964             c = abc_getlocal(c, temp);
1965             c = abc_kill(c, temp);
1966         } else {
1967             /* if we're allowed to execute the read code twice *and*
1968                the middlepart doesn't modify the code, things are easier.
1969             */
1970             code_t* r2 = code_dup(r);
1971             //c = code_append(c, prefix);
1972             parserassert(!prefix);
1973             c = code_append(c, r);
1974             c = code_append(c, middlepart);
1975             c = code_append(c, write);
1976             c = code_append(c, r2);
1977         }
1978     } else {
1979         /* even smaller version: overwrite the value without reading
1980            it out first */
1981         if(!use_temp_var) {
1982             if(prefix) {
1983                 c = code_append(c, prefix);
1984                 c = abc_dup(c);
1985             }
1986             c = code_append(c, middlepart);
1987             c = code_append(c, write);
1988             c = code_append(c, r);
1989         } else {
1990             code_free(r);r=0;
1991             temp = gettempvar();
1992             if(prefix) {
1993                 c = code_append(c, prefix);
1994             }
1995             c = code_append(c, middlepart);
1996             c = abc_dup(c);
1997             c = abc_setlocal(c, temp);
1998             c = code_append(c, write);
1999             c = abc_getlocal(c, temp);
2000             c = abc_kill(c, temp);
2001         }
2002     }
2003     return c;
2004 }
2005
2006 char is_break_or_jump(code_t*c)
2007 {
2008     if(!c)
2009         return 0;
2010     if(c->opcode == OPCODE_JUMP ||
2011        c->opcode == OPCODE___BREAK__ ||
2012        c->opcode == OPCODE___CONTINUE__ ||
2013        c->opcode == OPCODE_THROW ||
2014        c->opcode == OPCODE_RETURNVOID ||
2015        c->opcode == OPCODE_RETURNVALUE) {
2016        return 1;
2017     }
2018     return 0;
2019 }
2020
2021 #define IS_FINALLY_TARGET(op) \
2022         ((op) == OPCODE___CONTINUE__ || \
2023          (op) == OPCODE___BREAK__ || \
2024          (op) == OPCODE_RETURNVOID || \
2025          (op) == OPCODE_RETURNVALUE || \
2026          (op) == OPCODE___RETHROW__)
2027
2028 static code_t* insert_finally_lookup(code_t*c, code_t*finally, int tempvar)
2029 {
2030 #define NEED_EXTRA_STACK_ARG
2031     code_t*finally_label = abc_nop(0);
2032     NEW(lookupswitch_t, l);
2033     //_lookupswitch
2034
2035     code_t*i = c;
2036     int count=0;
2037     while(i) {
2038         code_t*prev = i->prev;
2039         if(IS_FINALLY_TARGET(i->opcode)) {
2040            code_t*p = prev;
2041            char needvalue=0;
2042            if(i->opcode == OPCODE___RETHROW__ ||
2043               i->opcode == OPCODE_RETURNVALUE) {
2044                if(i->opcode == OPCODE___RETHROW__)
2045                  i->opcode = OPCODE_THROW;
2046                needvalue=1;
2047                p = abc_coerce_a(p);
2048                p = abc_setlocal(p, tempvar);
2049            }
2050            p = abc_pushbyte(p, count++);
2051            p = abc_jump(p, finally_label);
2052            code_t*target = p = abc_label(p);
2053 #ifdef NEED_EXTRA_STACK_ARG
2054            p = abc_pop(p);
2055 #endif
2056            if(needvalue) {
2057                p = abc_getlocal(p, tempvar);
2058            }
2059
2060            p->next = i;i->prev = p;
2061            list_append(l->targets, target);
2062         }
2063         i = prev;
2064     }
2065
2066     code_t*j,*f;
2067     c = abc_pushbyte(c, -1);
2068     c = code_append(c, finally_label);
2069     c = code_append(c, finally);
2070
2071 #ifdef NEED_EXTRA_STACK_ARG
2072     c = abc_dup(c);
2073 #endif
2074     c = abc_lookupswitch(c, l);
2075     c = l->def = abc_label(c);
2076 #ifdef NEED_EXTRA_STACK_ARG
2077     c = abc_pop(c);
2078 #endif
2079
2080     return c;
2081 }
2082
2083 static code_t* insert_finally_simple(code_t*c, code_t*finally, int tempvar)
2084 {
2085     code_t*i = c;
2086     while(i) {
2087         code_t*prev = i->prev;
2088         if(IS_FINALLY_TARGET(i->opcode)) {
2089            if(i->opcode == OPCODE___RETHROW__)
2090                 i->opcode = OPCODE_THROW;
2091            code_t*end = code_dup(finally);
2092            code_t*start = code_start(end);
2093            if(prev) prev->next = start;
2094            start->prev = prev;
2095            i->prev = end;
2096            end->next = i;
2097         }
2098         i = prev;
2099     }
2100     return code_append(c, finally);
2101 }
2102
2103 code_t* insert_finally(code_t*c, code_t*finally, int tempvar)
2104 {
2105     if(!finally)
2106         return c;
2107     code_t*i = c;
2108     char cantdup=0;
2109     int num_insertion_points=0;
2110     while(i) {
2111         if(IS_FINALLY_TARGET(i->opcode))
2112             num_insertion_points++;
2113         i = i->prev;
2114     }
2115     i = finally;
2116     int code_size=0;
2117     while(i) {
2118         code_size++;
2119         if(i->branch || i->opcode == OPCODE_LOOKUPSWITCH) {
2120             cantdup=1;
2121         }
2122         i = i->prev;
2123     }
2124     int simple_version_cost = (1+num_insertion_points)*code_size;
2125     int lookup_version_cost = 4*num_insertion_points + 5;
2126
2127     if(cantdup || simple_version_cost > lookup_version_cost) {
2128         //printf("(use lookup) simple=%d > lookup=%d\n", simple_version_cost, lookup_version_cost);
2129         return insert_finally_lookup(c, finally, tempvar);
2130     } else {
2131         //printf("(use simple) simple=%d < lookup=%d\n", simple_version_cost, lookup_version_cost);
2132         return insert_finally_simple(c, finally, tempvar);
2133     }
2134 }
2135
2136 #define PASS1 }} if(as3_pass == 1) {{
2137 #define PASS1END }} if(as3_pass == 2) {{
2138 #define PASS2 }} if(as3_pass == 2) {{
2139 #define PASS12 }} {{
2140 #define PASS12END }} if(as3_pass == 2) {{
2141
2142
2143
2144 /* Line 273 of skeleton.m4  */
2145 #line 2146 "parser.tab.c"
2146
2147 #ifdef short
2148 # undef short
2149 #endif
2150
2151 #ifdef YYTYPE_UINT8
2152 typedef YYTYPE_UINT8 yytype_uint8;
2153 #else
2154 typedef unsigned char yytype_uint8;
2155 #endif
2156
2157 #ifdef YYTYPE_INT8
2158 typedef YYTYPE_INT8 yytype_int8;
2159 #elif (defined __STDC__ || defined __C99__FUNC__ \
2160      || defined __cplusplus || defined _MSC_VER)
2161 typedef signed char yytype_int8;
2162 #else
2163 typedef short int yytype_int8;
2164 #endif
2165
2166 #ifdef YYTYPE_UINT16
2167 typedef YYTYPE_UINT16 yytype_uint16;
2168 #else
2169 typedef unsigned short int yytype_uint16;
2170 #endif
2171
2172 #ifdef YYTYPE_INT16
2173 typedef YYTYPE_INT16 yytype_int16;
2174 #else
2175 typedef short int yytype_int16;
2176 #endif
2177
2178 #ifndef YYSIZE_T
2179 # ifdef __SIZE_TYPE__
2180 #  define YYSIZE_T __SIZE_TYPE__
2181 # elif defined size_t
2182 #  define YYSIZE_T size_t
2183 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
2184      || defined __cplusplus || defined _MSC_VER)
2185 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2186 #  define YYSIZE_T size_t
2187 # else
2188 #  define YYSIZE_T unsigned int
2189 # endif
2190 #endif
2191
2192 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
2193
2194 #ifndef YY_
2195 # if YYENABLE_NLS
2196 #  if ENABLE_NLS
2197 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
2198 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
2199 #  endif
2200 # endif
2201 # ifndef YY_
2202 #  define YY_(msgid) msgid
2203 # endif
2204 #endif
2205
2206 /* Suppress unused-variable warnings by "using" E.  */
2207 #if ! defined lint || defined __GNUC__
2208 # define YYUSE(e) ((void) (e))
2209 #else
2210 # define YYUSE(e) /* empty */
2211 #endif
2212
2213 /* Identity function, used to suppress warnings about constant conditions.  */
2214 #ifndef lint
2215 # define YYID(n) (n)
2216 #else
2217 #if (defined __STDC__ || defined __C99__FUNC__ \
2218      || defined __cplusplus || defined _MSC_VER)
2219 static int
2220 YYID (int yyi)
2221 #else
2222 static int
2223 YYID (yyi)
2224     int yyi;
2225 #endif
2226 {
2227   return yyi;
2228 }
2229 #endif
2230
2231 #if ! defined yyoverflow || YYERROR_VERBOSE
2232
2233 /* The parser invokes alloca or malloc; define the necessary symbols.  */
2234
2235 # ifdef YYSTACK_USE_ALLOCA
2236 #  if YYSTACK_USE_ALLOCA
2237 #   ifdef __GNUC__
2238 #    define YYSTACK_ALLOC __builtin_alloca
2239 #   elif defined __BUILTIN_VA_ARG_INCR
2240 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
2241 #   elif defined _AIX
2242 #    define YYSTACK_ALLOC __alloca
2243 #   elif defined _MSC_VER
2244 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
2245 #    define alloca _alloca
2246 #   else
2247 #    define YYSTACK_ALLOC alloca
2248 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
2249      || defined __cplusplus || defined _MSC_VER)
2250 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
2251 #     ifndef _STDLIB_H
2252 #      define _STDLIB_H 1
2253 #     endif
2254 #    endif
2255 #   endif
2256 #  endif
2257 # endif
2258
2259 # ifdef YYSTACK_ALLOC
2260    /* Pacify GCC's `empty if-body' warning.  */
2261 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
2262 #  ifndef YYSTACK_ALLOC_MAXIMUM
2263     /* The OS might guarantee only one guard page at the bottom of the stack,
2264        and a page size can be as small as 4096 bytes.  So we cannot safely
2265        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
2266        to allow for a few compiler-allocated temporary stack slots.  */
2267 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
2268 #  endif
2269 # else
2270 #  define YYSTACK_ALLOC YYMALLOC
2271 #  define YYSTACK_FREE YYFREE
2272 #  ifndef YYSTACK_ALLOC_MAXIMUM
2273 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
2274 #  endif
2275 #  if (defined __cplusplus && ! defined _STDLIB_H \
2276        && ! ((defined YYMALLOC || defined malloc) \
2277              && (defined YYFREE || defined free)))
2278 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
2279 #   ifndef _STDLIB_H
2280 #    define _STDLIB_H 1
2281 #   endif
2282 #  endif
2283 #  ifndef YYMALLOC
2284 #   define YYMALLOC malloc
2285 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
2286      || defined __cplusplus || defined _MSC_VER)
2287 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
2288 #   endif
2289 #  endif
2290 #  ifndef YYFREE
2291 #   define YYFREE free
2292 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
2293      || defined __cplusplus || defined _MSC_VER)
2294 void free (void *); /* INFRINGES ON USER NAME SPACE */
2295 #   endif
2296 #  endif
2297 # endif
2298 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
2299
2300
2301 #if (! defined yyoverflow \
2302      && (! defined __cplusplus \
2303          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
2304
2305 /* A type that is properly aligned for any stack member.  */
2306 union yyalloc
2307 {
2308   yytype_int16 yyss_alloc;
2309   YYSTYPE yyvs_alloc;
2310 };
2311
2312 /* The size of the maximum gap between one aligned stack and the next.  */
2313 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
2314
2315 /* The size of an array large to enough to hold all stacks, each with
2316    N elements.  */
2317 # define YYSTACK_BYTES(N) \
2318      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
2319       + YYSTACK_GAP_MAXIMUM)
2320
2321 /* Copy COUNT objects from FROM to TO.  The source and destination do
2322    not overlap.  */
2323 # ifndef YYCOPY
2324 #  if defined __GNUC__ && 1 < __GNUC__
2325 #   define YYCOPY(To, From, Count) \
2326       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
2327 #  else
2328 #   define YYCOPY(To, From, Count)              \
2329       do                                        \
2330         {                                       \
2331           YYSIZE_T yyi;                         \
2332           for (yyi = 0; yyi < (Count); yyi++)   \
2333             (To)[yyi] = (From)[yyi];            \
2334         }                                       \
2335       while (YYID (0))
2336 #  endif
2337 # endif
2338
2339 /* Relocate STACK from its old location to the new one.  The
2340    local variables YYSIZE and YYSTACKSIZE give the old and new number of
2341    elements in the stack, and YYPTR gives the new location of the
2342    stack.  Advance YYPTR to a properly aligned location for the next
2343    stack.  */
2344 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
2345     do                                                                  \
2346       {                                                                 \
2347         YYSIZE_T yynewbytes;                                            \
2348         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
2349         Stack = &yyptr->Stack_alloc;                                    \
2350         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
2351         yyptr += yynewbytes / sizeof (*yyptr);                          \
2352       }                                                                 \
2353     while (YYID (0))
2354
2355 #endif
2356
2357 /* YYFINAL -- State number of the termination state.  */
2358 #define YYFINAL  147
2359 /* YYLAST -- Last index in YYTABLE.  */
2360 #define YYLAST   3001
2361
2362 /* YYNTOKENS -- Number of terminals.  */
2363 #define YYNTOKENS  134
2364 /* YYNNTS -- Number of nonterminals.  */
2365 #define YYNNTS  114
2366 /* YYNRULES -- Number of rules.  */
2367 #define YYNRULES  309
2368 /* YYNRULES -- Number of states.  */
2369 #define YYNSTATES  521
2370
2371 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
2372 #define YYUNDEFTOK  2
2373 #define YYMAXUTOK   363
2374
2375 #define YYTRANSLATE(YYX)                                                \
2376   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
2377
2378 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
2379 static const yytype_uint8 yytranslate[] =
2380 {
2381        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2382        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2383        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2384        2,     2,     2,   118,     2,     2,     2,   116,   108,     2,
2385      122,   133,   115,   113,   100,   112,   127,   114,     2,     2,
2386        2,     2,     2,     2,     2,     2,     2,     2,   105,    99,
2387      109,   102,   110,   104,   128,     2,     2,     2,     2,     2,
2388        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2389        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2390        2,   124,     2,   125,   107,     2,     2,     2,     2,     2,
2391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2392        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2393        2,     2,     2,   126,   106,   132,   117,     2,     2,     2,
2394        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2395        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2396        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2397        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2398        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2399        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2400        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2401        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2403        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2404        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2405        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2406        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
2407        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
2408       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
2409       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
2410       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
2411       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
2412       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
2413       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
2414       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
2415       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
2416       95,    96,    97,    98,   101,   103,   111,   119,   120,   121,
2417      123,   129,   130,   131
2418 };
2419
2420 #if YYDEBUG
2421 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
2422    YYRHS.  */
2423 static const yytype_uint16 yyprhs[] =
2424 {
2425        0,     0,     3,     5,     6,     8,    10,    13,    15,    17,
2426       19,    21,    23,    25,    30,    32,    33,    35,    37,    40,
2427       42,    44,    46,    48,    50,    55,    57,    59,    60,    63,
2428       65,    67,    69,    71,    73,    75,    77,    79,    81,    83,
2429       85,    87,    89,    93,    96,    98,   100,   102,   104,   106,
2430      108,   110,   115,   118,   120,   122,   126,   129,   130,   133,
2431      136,   138,   142,   146,   147,   150,   151,   159,   160,   162,
2432      164,   168,   170,   173,   177,   186,   193,   194,   201,   202,
2433      210,   212,   215,   217,   220,   221,   223,   225,   228,   230,
2434      233,   238,   242,   243,   252,   253,   263,   264,   270,   272,
2435      275,   277,   280,   282,   283,   290,   293,   295,   300,   303,
2436      305,   307,   309,   313,   315,   316,   323,   324,   330,   333,
2437      338,   339,   341,   343,   346,   348,   350,   352,   354,   356,
2438      358,   360,   362,   364,   366,   367,   370,   371,   374,   375,
2439      378,   379,   389,   390,   399,   400,   402,   404,   407,   409,
2440      414,   416,   418,   420,   421,   423,   425,   428,   430,   433,
2441      442,   444,   446,   447,   452,   454,   458,   462,   463,   466,
2442      468,   470,   472,   474,   476,   478,   480,   482,   484,   485,
2443      487,   490,   495,   499,   501,   506,   509,   511,   513,   514,
2444      515,   528,   530,   531,   532,   543,   545,   549,   551,   553,
2445      555,   559,   561,   563,   565,   568,   569,   570,   574,   575,
2446      577,   579,   581,   584,   587,   588,   593,   598,   603,   606,
2447      608,   611,   613,   615,   619,   621,   623,   625,   627,   629,
2448      631,   633,   635,   637,   639,   641,   643,   645,   647,   649,
2449      651,   653,   655,   659,   663,   667,   671,   675,   679,   683,
2450      687,   691,   695,   698,   701,   705,   709,   713,   717,   721,
2451      725,   729,   733,   737,   741,   745,   749,   753,   757,   761,
2452      766,   769,   771,   775,   778,   783,   787,   788,   790,   794,
2453      800,   804,   808,   812,   816,   820,   824,   828,   832,   836,
2454      840,   844,   848,   854,   857,   860,   863,   866,   870,   873,
2455      878,   884,   888,   894,   898,   900,   903,   908,   913,   916
2456 };
2457
2458 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
2459 static const yytype_int16 yyrhs[] =
2460 {
2461      135,     0,    -1,   136,    -1,    -1,   137,    -1,   138,    -1,
2462      137,   138,    -1,   186,    -1,   198,    -1,   196,    -1,   217,
2463       -1,   207,    -1,   147,    -1,   148,   126,   136,   132,    -1,
2464       99,    -1,    -1,   140,    -1,   141,    -1,   140,   141,    -1,
2465      198,    -1,   196,    -1,   217,    -1,   207,    -1,   147,    -1,
2466      148,   126,   139,   132,    -1,    99,    -1,   143,    -1,    -1,
2467      143,   145,    -1,   145,    -1,   189,    -1,   159,    -1,   160,
2468       -1,   161,    -1,   163,    -1,   171,    -1,   154,    -1,   183,
2469       -1,   179,    -1,   239,    -1,   247,    -1,   246,    -1,   126,
2470      143,   132,    -1,   126,   132,    -1,    99,    -1,   144,    -1,
2471      150,    -1,   165,    -1,   166,    -1,   236,    -1,   181,    -1,
2472      148,   126,   143,   132,    -1,   145,    99,    -1,   145,    -1,
2473      144,    -1,     3,    89,     3,    -1,   102,   237,    -1,    -1,
2474       46,   151,    -1,    32,   151,    -1,   152,    -1,   151,   100,
2475      152,    -1,     3,   227,   149,    -1,    -1,    65,   146,    -1,
2476       -1,    64,   122,   155,   238,   133,   146,   153,    -1,    -1,
2477      150,    -1,   239,    -1,    46,     3,   227,    -1,     3,    -1,
2478       13,   122,    -1,    13,    50,   122,    -1,   158,   156,    99,
2479      238,    99,   239,   133,   146,    -1,   158,   157,    68,   238,
2480      133,   146,    -1,    -1,    14,   122,   162,   238,   133,   146,
2481       -1,    -1,    15,   164,   146,    14,   122,   238,   133,    -1,
2482       66,    -1,    66,     3,    -1,    30,    -1,    30,     3,    -1,
2483       -1,   168,    -1,   170,    -1,   168,   170,    -1,   169,    -1,
2484      168,   169,    -1,    34,   240,   105,   142,    -1,    62,   105,
2485      142,    -1,    -1,    16,   122,   172,   240,   133,   126,   167,
2486      132,    -1,    -1,    33,   122,     3,   227,   133,   174,   126,
2487      142,   132,    -1,    -1,    28,   126,   176,   142,   132,    -1,
2488      173,    -1,   177,   173,    -1,   177,    -1,   177,   175,    -1,
2489      175,    -1,    -1,    52,   126,   180,   142,   132,   178,    -1,
2490       37,   238,    -1,    37,    -1,    39,   122,   238,   133,    -1,
2491      182,   146,    -1,     3,    -1,    19,    -1,     4,    -1,   185,
2492      127,   184,    -1,   184,    -1,    -1,    19,   185,   126,   187,
2493      139,   132,    -1,    -1,    19,   126,   188,   139,   132,    -1,
2494       41,   223,    -1,    41,   185,   127,   115,    -1,    -1,   191,
2495       -1,   192,    -1,   191,   192,    -1,    21,    -1,    22,    -1,
2496       20,    -1,    38,    -1,    47,    -1,    49,    -1,    48,    -1,
2497       26,    -1,    24,    -1,     4,    -1,    -1,    54,   224,    -1,
2498       -1,    54,   225,    -1,    -1,    17,   225,    -1,    -1,   190,
2499       31,     3,   193,   195,   126,   197,   200,   132,    -1,    -1,
2500      190,    44,     3,   194,   126,   199,   203,   132,    -1,    -1,
2501      201,    -1,   202,    -1,   201,   202,    -1,    99,    -1,   148,
2502      126,   200,   132,    -1,   207,    -1,   217,    -1,   144,    -1,
2503       -1,   204,    -1,   205,    -1,   204,   205,    -1,    99,    -1,
2504       46,     3,    -1,   190,    27,   216,     3,   122,   213,   133,
2505      227,    -1,    46,    -1,    32,    -1,    -1,   190,   206,   208,
2506      209,    -1,   210,    -1,   209,   100,   210,    -1,     3,   227,
2507      149,    -1,    -1,   102,   212,    -1,    10,    -1,     8,    -1,
2508        9,    -1,    12,    -1,     5,    -1,    56,    -1,    55,    -1,
2509       45,    -1,     3,    -1,    -1,   214,    -1,    93,   215,    -1,
2510      214,   100,    93,   215,    -1,   214,   100,   215,    -1,   215,
2511       -1,     3,   105,   226,   211,    -1,     3,   211,    -1,    51,
2512       -1,    35,    -1,    -1,    -1,   190,    27,   216,     3,   122,
2513      213,   133,   227,   126,   218,   142,   132,    -1,     3,    -1,
2514       -1,    -1,    27,   219,   122,   213,   133,   227,   126,   221,
2515      142,   132,    -1,   184,    -1,   185,   127,   184,    -1,   223,
2516       -1,   222,    -1,   224,    -1,   225,   100,   224,    -1,   224,
2517       -1,   115,    -1,    36,    -1,   105,   226,    -1,    -1,    -1,
2518      122,   229,   133,    -1,    -1,   230,    -1,   231,    -1,   237,
2519       -1,   230,   100,    -1,   231,   237,    -1,    -1,    25,   240,
2520      232,   228,    -1,   240,   122,   229,   133,    -1,    53,   122,
2521      229,   133,    -1,    63,   240,    -1,    42,    -1,    42,   238,
2522       -1,   240,    -1,   240,    -1,   238,   100,   240,    -1,   238,
2523       -1,   220,    -1,   241,    -1,   244,    -1,   233,    -1,   235,
2524       -1,   234,    -1,     6,    -1,    10,    -1,    11,    -1,     8,
2525       -1,     9,    -1,    12,    -1,     5,    -1,    29,    -1,    56,
2526       -1,    55,    -1,    45,    -1,   240,   109,   240,    -1,   240,
2527      110,   240,    -1,   240,    75,   240,    -1,   240,    76,   240,
2528       -1,   240,    71,   240,    -1,   240,    72,   240,    -1,   240,
2529       74,   240,    -1,   240,    73,   240,    -1,   240,    87,   240,
2530       -1,   240,    88,   240,    -1,   118,   240,    -1,   117,   240,
2531       -1,   240,   108,   240,    -1,   240,   107,   240,    -1,   240,
2532      106,   240,    -1,   240,    96,   240,    -1,   240,    95,   240,
2533       -1,   240,    94,   240,    -1,   240,   114,   240,    -1,   240,
2534      116,   240,    -1,   240,   113,   240,    -1,   240,   112,   240,
2535       -1,   240,   115,   240,    -1,   240,    68,   240,    -1,   240,
2536       69,   240,    -1,   240,    40,   240,    -1,   240,    67,   240,
2537       -1,    43,   122,   240,   133,    -1,    36,   240,    -1,    36,
2538       -1,   122,   238,   133,    -1,   112,   240,    -1,   240,   124,
2539      240,   125,    -1,   124,   229,   125,    -1,    -1,   243,    -1,
2540      237,   105,   237,    -1,   243,   100,   237,   105,   237,    -1,
2541       70,   242,   132,    -1,   240,    80,   240,    -1,   240,    79,
2542      240,    -1,   240,    85,   240,    -1,   240,    84,   240,    -1,
2543      240,    86,   240,    -1,   240,    78,   240,    -1,   240,    77,
2544      240,    -1,   240,    83,   240,    -1,   240,    81,   240,    -1,
2545      240,    82,   240,    -1,   240,   102,   240,    -1,   240,   104,
2546      240,   105,   240,    -1,   240,    91,    -1,   240,    90,    -1,
2547       91,   240,    -1,    90,   240,    -1,    53,   127,     3,    -1,
2548      128,     3,    -1,   240,   127,   128,     3,    -1,   240,   127,
2549        3,    89,     3,    -1,   240,    92,     3,    -1,   240,   127,
2550      122,   240,   133,    -1,   240,   127,     3,    -1,     3,    -1,
2551       18,     3,    -1,    18,     3,   102,     3,    -1,    18,     3,
2552      102,     5,    -1,   190,   245,    -1,    23,    18,   224,    -1
2553 };
2554
2555 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
2556 static const yytype_uint16 yyrline[] =
2557 {
2558        0,  2124,  2124,  2126,  2126,  2127,  2128,  2130,  2131,  2132,
2559     2133,  2134,  2135,  2136,  2137,  2139,  2139,  2140,  2141,  2143,
2560     2144,  2145,  2146,  2147,  2148,  2149,  2151,  2152,  2154,  2155,
2561     2158,  2159,  2160,  2161,  2162,  2163,  2164,  2165,  2166,  2167,
2562     2168,  2169,  2170,  2171,  2174,  2175,  2176,  2177,  2178,  2179,
2563     2180,  2181,  2185,  2186,  2190,  2197,  2201,  2202,  2206,  2207,
2564     2209,  2210,  2212,  2273,  2274,  2277,  2277,  2296,  2297,  2298,
2565     2303,  2307,  2312,  2313,  2315,  2335,  2383,  2383,  2402,  2402,
2566     2417,  2420,  2423,  2426,  2430,  2431,  2432,  2433,  2434,  2435,
2567     2437,  2448,  2451,  2451,  2482,  2482,  2507,  2507,  2523,  2524,
2568     2525,  2526,  2534,  2543,  2543,  2592,  2596,  2607,  2617,  2634,
2569     2635,  2636,  2638,  2639,  2641,  2641,  2643,  2643,  2646,  2660,
2570     2676,  2677,  2678,  2679,  2686,  2687,  2688,  2689,  2690,  2691,
2571     2692,  2693,  2694,  2695,  2699,  2700,  2702,  2703,  2705,  2706,
2572     2710,  2708,  2716,  2714,  2723,  2724,  2725,  2726,  2727,  2728,
2573     2729,  2730,  2732,  2738,  2739,  2740,  2741,  2742,  2743,  2746,
2574     2759,  2759,  2761,  2761,  2763,  2764,  2766,  2841,  2842,  2844,
2575     2845,  2846,  2847,  2848,  2850,  2851,  2852,  2853,  2865,  2869,
2576     2875,  2881,  2889,  2894,  2900,  2908,  2916,  2917,  2918,  2921,
2577     2920,  2937,  2938,  2940,  2939,  2963,  2982,  2996,  2997,  2999,
2578     3000,  3002,  3003,  3004,  3013,  3014,  3018,  3019,  3021,  3022,
2579     3023,  3025,  3029,  3030,  3035,  3036,  3072,  3118,  3139,  3160,
2580     3163,  3170,  3171,  3172,  3178,  3184,  3185,  3186,  3187,  3188,
2581     3190,  3192,  3209,  3214,  3217,  3220,  3223,  3226,  3229,  3232,
2582     3235,  3238,  3242,  3245,  3248,  3251,  3254,  3257,  3260,  3263,
2583     3267,  3278,  3296,  3301,  3306,  3311,  3316,  3321,  3325,  3329,
2584     3334,  3338,  3342,  3351,  3360,  3370,  3375,  3387,  3393,  3398,
2585     3404,  3410,  3414,  3416,  3427,  3436,  3443,  3444,  3446,  3452,
2586     3461,  3468,  3480,  3486,  3492,  3498,  3504,  3510,  3516,  3522,
2587     3535,  3546,  3553,  3566,  3593,  3607,  3621,  3635,  3650,  3657,
2588     3664,  3671,  3678,  3693,  3749,  3858,  3865,  3872,  3879,  3894
2589 };
2590 #endif
2591
2592 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
2593 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
2594    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
2595 static const char *const yytname[] =
2596 {
2597   "$end", "error", "$undefined", "T_IDENTIFIER", "T_NAMESPACE",
2598   "T_STRING", "T_REGEXP", "T_EMPTY", "T_INT", "T_UINT", "T_BYTE",
2599   "T_SHORT", "T_FLOAT", "\"for\"", "\"while\"", "\"do\"", "\"switch\"",
2600   "\"implements\"", "\"namespace\"", "\"package\"", "\"protected\"",
2601   "\"public\"", "\"private\"", "\"use\"", "\"internal\"", "\"new\"",
2602   "\"native\"", "\"function\"", "\"finally\"", "\"undefined\"",
2603   "\"continue\"", "\"class\"", "\"const\"", "\"catch\"", "\"case\"",
2604   "\"set\"", "\"void\"", "\"throw\"", "\"static\"", "\"with\"",
2605   "\"instanceof\"", "\"import\"", "\"return\"", "\"typeof\"",
2606   "\"interface\"", "\"null\"", "\"var\"", "\"dynamic\"", "\"override\"",
2607   "\"final\"", "\"each\"", "\"get\"", "\"try\"", "\"super\"",
2608   "\"extends\"", "\"false\"", "\"true\"", "\"Boolean\"", "\"uint\"",
2609   "\"int\"", "\"Number\"", "\"String\"", "\"default\"", "\"delete\"",
2610   "\"if\"", "\"else\"", "\"break\"", "\"is\"", "\"in\"", "\"as\"",
2611   "\"{ (dictionary)\"", "\"==\"", "\"===\"", "\"!=\"", "\"!==\"", "\"<=\"",
2612   "\">=\"", "\"|=\"", "\"/=\"", "\"%=\"", "\"*=\"", "\"+=\"", "\"-=\"",
2613   "\"^=\"", "\">>=\"", "\"<<=\"", "\">>>=\"", "\"||\"", "\"&&\"", "\"::\"",
2614   "\"--\"", "\"++\"", "\"..\"", "\"...\"", "\"<<\"", "\">>>\"", "\">>\"",
2615   "prec_none", "below_semicolon", "';'", "','", "below_assignment", "'='",
2616   "\"&=\"", "'?'", "':'", "'|'", "'^'", "'&'", "'<'", "'>'", "below_minus",
2617   "'-'", "'+'", "'/'", "'*'", "'%'", "'~'", "'!'", "minusminus_prefix",
2618   "plusplus_prefix", "below_curly", "'('", "new2", "'['", "']'", "'{'",
2619   "'.'", "'@'", "above_identifier", "below_else", "above_function", "'}'",
2620   "')'", "$accept", "PROGRAM", "MAYBE_PROGRAM_CODE_LIST",
2621   "PROGRAM_CODE_LIST", "PROGRAM_CODE", "MAYBE_INPACKAGE_CODE_LIST",
2622   "INPACKAGE_CODE_LIST", "INPACKAGE_CODE", "MAYBECODE", "CODE",
2623   "CODE_STATEMENT", "CODEPIECE", "CODEBLOCK", "PACKAGE_INITCODE",
2624   "CONDITIONAL_COMPILATION", "MAYBEEXPRESSION", "VARIABLE_DECLARATION",
2625   "VARIABLE_LIST", "ONE_VARIABLE", "MAYBEELSE", "IF", "$@1", "FOR_INIT",
2626   "FOR_IN_INIT", "FOR_START", "FOR", "FOR_IN", "WHILE", "$@2", "DO_WHILE",
2627   "$@3", "BREAK", "CONTINUE", "MAYBE_CASE_LIST", "CASE_LIST", "CASE",
2628   "DEFAULT", "SWITCH", "$@4", "CATCH", "$@5", "FINALLY", "$@6",
2629   "CATCH_LIST", "CATCH_FINALLY_LIST", "TRY", "$@7", "THROW", "WITH_HEAD",
2630   "WITH", "X_IDENTIFIER", "PACKAGE", "PACKAGE_DECLARATION", "$@8", "$@9",
2631   "IMPORT", "MAYBE_MODIFIERS", "MODIFIER_LIST", "MODIFIER", "EXTENDS",
2632   "EXTENDS_LIST", "IMPLEMENTS_LIST", "CLASS_DECLARATION", "$@10",
2633   "INTERFACE_DECLARATION", "$@11", "MAYBE_CLASS_BODY", "CLASS_BODY",
2634   "CLASS_BODY_ITEM", "MAYBE_INTERFACE_BODY", "INTERFACE_BODY",
2635   "IDECLARATION", "VARCONST", "SLOT_DECLARATION", "$@12", "SLOT_LIST",
2636   "ONE_SLOT", "MAYBESTATICCONSTANT", "STATICCONSTANT", "MAYBE_PARAM_LIST",
2637   "PARAM_LIST", "PARAM", "GETSET", "FUNCTION_DECLARATION", "$@13",
2638   "MAYBE_IDENTIFIER", "INNERFUNCTION", "$@14", "CLASS", "PACKAGEANDCLASS",
2639   "CLASS_SPEC", "CLASS_SPEC_LIST", "TYPE", "MAYBETYPE",
2640   "MAYBE_PARAM_VALUES", "MAYBE_EXPRESSION_LIST", "EXPRESSION_LIST",
2641   "EXPRESSION_LIST_AND_COMMA", "XX", "NEW", "FUNCTIONCALL", "DELETE",
2642   "RETURN", "NONCOMMAEXPRESSION", "EXPRESSION", "VOIDEXPRESSION", "E",
2643   "CONSTANT", "MAYBE_EXPRPAIR_LIST", "EXPRPAIR_LIST", "VAR_READ",
2644   "NAMESPACE_ID", "NAMESPACE_DECLARATION", "USE_NAMESPACE", 0
2645 };
2646 #endif
2647
2648 # ifdef YYPRINT
2649 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
2650    token YYLEX-NUM.  */
2651 static const yytype_uint16 yytoknum[] =
2652 {
2653        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
2654      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
2655      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
2656      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
2657      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
2658      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
2659      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
2660      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
2661      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
2662      345,   346,   347,   348,   349,   350,   351,   352,   353,    59,
2663       44,   354,    61,   355,    63,    58,   124,    94,    38,    60,
2664       62,   356,    45,    43,    47,    42,    37,   126,    33,   357,
2665      358,   359,    40,   360,    91,    93,   123,    46,    64,   361,
2666      362,   363,   125,    41
2667 };
2668 # endif
2669
2670 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
2671 static const yytype_uint8 yyr1[] =
2672 {
2673        0,   134,   135,   136,   136,   137,   137,   138,   138,   138,
2674      138,   138,   138,   138,   138,   139,   139,   140,   140,   141,
2675      141,   141,   141,   141,   141,   141,   142,   142,   143,   143,
2676      144,   144,   144,   144,   144,   144,   144,   144,   144,   144,
2677      144,   144,   144,   144,   145,   145,   145,   145,   145,   145,
2678      145,   145,   146,   146,   147,   148,   149,   149,   150,   150,
2679      151,   151,   152,   153,   153,   155,   154,   156,   156,   156,
2680      157,   157,   158,   158,   159,   160,   162,   161,   164,   163,
2681      165,   165,   166,   166,   167,   167,   167,   167,   168,   168,
2682      169,   170,   172,   171,   174,   173,   176,   175,   177,   177,
2683      178,   178,   178,   180,   179,   181,   181,   182,   183,   184,
2684      184,   184,   185,   185,   187,   186,   188,   186,   189,   189,
2685      190,   190,   191,   191,   192,   192,   192,   192,   192,   192,
2686      192,   192,   192,   192,   193,   193,   194,   194,   195,   195,
2687      197,   196,   199,   198,   200,   200,   201,   201,   202,   202,
2688      202,   202,   202,   203,   203,   204,   204,   205,   205,   205,
2689      206,   206,   208,   207,   209,   209,   210,   211,   211,   212,
2690      212,   212,   212,   212,   212,   212,   212,   212,   213,   213,
2691      213,   213,   214,   214,   215,   215,   216,   216,   216,   218,
2692      217,   219,   219,   221,   220,   222,   223,   224,   224,   225,
2693      225,   226,   226,   226,   227,   227,   228,   228,   229,   229,
2694      229,   230,   231,   230,   232,   233,   234,   234,   235,   236,
2695      236,   237,   238,   238,   239,   240,   240,   240,   240,   240,
2696      240,   240,   241,   241,   241,   241,   241,   241,   241,   241,
2697      241,   241,   240,   240,   240,   240,   240,   240,   240,   240,
2698      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
2699      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
2700      240,   240,   240,   240,   240,   240,   242,   242,   243,   243,
2701      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
2702      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
2703      240,   240,   240,   240,   244,   245,   245,   245,   246,   247
2704 };
2705
2706 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
2707 static const yytype_uint8 yyr2[] =
2708 {
2709        0,     2,     1,     0,     1,     1,     2,     1,     1,     1,
2710        1,     1,     1,     4,     1,     0,     1,     1,     2,     1,
2711        1,     1,     1,     1,     4,     1,     1,     0,     2,     1,
2712        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2713        1,     1,     3,     2,     1,     1,     1,     1,     1,     1,
2714        1,     4,     2,     1,     1,     3,     2,     0,     2,     2,
2715        1,     3,     3,     0,     2,     0,     7,     0,     1,     1,
2716        3,     1,     2,     3,     8,     6,     0,     6,     0,     7,
2717        1,     2,     1,     2,     0,     1,     1,     2,     1,     2,
2718        4,     3,     0,     8,     0,     9,     0,     5,     1,     2,
2719        1,     2,     1,     0,     6,     2,     1,     4,     2,     1,
2720        1,     1,     3,     1,     0,     6,     0,     5,     2,     4,
2721        0,     1,     1,     2,     1,     1,     1,     1,     1,     1,
2722        1,     1,     1,     1,     0,     2,     0,     2,     0,     2,
2723        0,     9,     0,     8,     0,     1,     1,     2,     1,     4,
2724        1,     1,     1,     0,     1,     1,     2,     1,     2,     8,
2725        1,     1,     0,     4,     1,     3,     3,     0,     2,     1,
2726        1,     1,     1,     1,     1,     1,     1,     1,     0,     1,
2727        2,     4,     3,     1,     4,     2,     1,     1,     0,     0,
2728       12,     1,     0,     0,    10,     1,     3,     1,     1,     1,
2729        3,     1,     1,     1,     2,     0,     0,     3,     0,     1,
2730        1,     1,     2,     2,     0,     4,     4,     4,     2,     1,
2731        2,     1,     1,     3,     1,     1,     1,     1,     1,     1,
2732        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2733        1,     1,     3,     3,     3,     3,     3,     3,     3,     3,
2734        3,     3,     2,     2,     3,     3,     3,     3,     3,     3,
2735        3,     3,     3,     3,     3,     3,     3,     3,     3,     4,
2736        2,     1,     3,     2,     4,     3,     0,     1,     3,     5,
2737        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
2738        3,     3,     5,     2,     2,     2,     2,     3,     2,     4,
2739        5,     3,     5,     3,     1,     2,     4,     4,     2,     3
2740 };
2741
2742 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2743    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
2744    means the default is an error.  */
2745 static const yytype_uint16 yydefact[] =
2746 {
2747      120,   304,   133,   237,   231,   234,   235,   232,   233,   236,
2748        0,     0,    78,     0,     0,   126,   124,   125,     0,   132,
2749        0,   131,   192,   238,   271,   127,     0,     0,     0,   241,
2750      128,   130,   129,     0,     0,   240,   239,     0,     0,   276,
2751        0,     0,    14,     0,     0,     0,     0,   208,   120,     0,
2752        0,     2,   120,     5,    54,    12,     0,    36,    67,    31,
2753       32,    33,    34,    35,    38,   120,    37,     7,    30,     0,
2754      121,   122,     9,     8,    11,    10,   225,   228,   230,   229,
2755      224,    39,   222,   226,   227,    41,    40,     0,     0,    72,
2756       76,   120,    92,   109,   111,   110,   116,   113,     0,     0,
2757      304,   214,   191,     0,   270,     0,     0,   118,     0,   103,
2758      208,     0,   218,    65,     0,   221,     0,   277,   296,   295,
2759      273,   253,   252,     0,     0,   209,   210,   211,    82,     0,
2760      106,   219,     0,    80,    44,    43,   120,    45,    29,     0,
2761       46,    47,    48,    50,     0,    49,   298,     1,     6,   120,
2762      304,     0,    68,     0,     0,    69,    53,   108,     0,   188,
2763        0,   161,     0,   160,   162,   308,   123,     0,     0,     0,
2764        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2765        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2766      294,   293,     0,     0,     0,     0,     0,     0,     0,     0,
2767        0,     0,     0,     0,     0,     0,     0,     0,   208,     0,
2768        0,    55,    73,     0,     0,     0,   120,   114,     0,   195,
2769        0,   198,   197,   309,   206,   178,     0,     0,     0,    27,
2770        0,   297,     0,     0,   280,     0,   272,   275,   212,   213,
2771       83,   205,    59,    60,   105,   220,    58,    81,    42,    28,
2772      120,     0,   205,     0,     0,    52,   305,   187,   186,     0,
2773      134,   136,     0,   223,   267,   268,   265,   266,   246,   247,
2774      249,   248,   244,   245,   287,   286,   282,   281,   289,   290,
2775      288,   284,   283,   285,   250,   251,   301,   259,   258,   257,
2776      291,     0,   256,   255,   254,   242,   243,   263,   262,   260,
2777      264,   261,     0,     0,   303,     0,     0,     0,     0,     0,
2778       25,     0,   120,    17,    23,     0,    20,    19,    22,    21,
2779      120,   112,     0,   208,   215,   167,     0,     0,   179,   183,
2780      107,   119,   196,   269,     0,    26,   217,     0,   278,     0,
2781        0,    57,     0,   120,    13,    57,     0,     0,     0,     0,
2782        0,   138,     0,     0,   205,   163,   164,     0,   216,   274,
2783        0,     0,   299,   120,     0,     0,   117,    18,   120,     0,
2784        0,     0,     0,   185,   180,   205,     0,     0,   120,     0,
2785      203,   202,   201,   204,     0,    62,    61,    51,     0,   120,
2786      306,   307,   178,   135,     0,     0,   199,   137,   142,    57,
2787        0,   292,   300,   302,    77,     0,    84,     0,   115,   207,
2788      177,   173,   170,   171,   169,   172,   176,   175,   174,   168,
2789      167,     0,     0,   182,     0,     0,    98,   102,   100,   104,
2790       63,   279,    56,     0,    75,     0,   139,   140,     0,   120,
2791      166,   165,    79,     0,     0,     0,    85,    88,    86,    24,
2792      184,   193,   181,    96,     0,    99,   101,   120,    66,   120,
2793      205,   120,   200,     0,   157,     0,     0,   120,   155,     0,
2794       27,    93,    89,    87,    27,    27,   205,    64,    74,     0,
2795      148,   152,     0,     0,     0,   120,   146,   150,   151,   158,
2796      188,   143,   156,    27,    91,     0,     0,     0,   189,   120,
2797      141,   147,     0,    90,   194,    97,    94,    27,     0,     0,
2798        0,     0,   149,   178,    27,   190,     0,     0,   205,    95,
2799      159
2800 };
2801
2802 /* YYDEFGOTO[NTERM-NUM].  */
2803 static const yytype_int16 yydefgoto[] =
2804 {
2805       -1,    50,    51,    52,    53,   311,   312,   313,   334,   335,
2806      137,   138,   157,   314,   139,   385,   140,   246,   243,   458,
2807       57,   232,   153,   154,    58,    59,    60,    61,   213,    62,
2808       91,   141,   142,   445,   446,   447,   448,    63,   215,   426,
2809      510,   427,   475,   428,   429,    64,   229,   143,    65,    66,
2810      219,   220,    67,   320,   216,    68,   144,    70,    71,   351,
2811      353,   395,   316,   461,   317,   439,   484,   485,   486,   466,
2812      467,   468,   164,   318,   262,   355,   356,   373,   419,   327,
2813      328,   329,   259,   319,   507,   103,    76,   474,   221,   222,
2814      382,   397,   383,   341,   324,   124,   125,   126,   224,    77,
2815       78,    79,   145,   127,    80,    81,    82,    83,   116,   117,
2816       84,   165,    85,    86
2817 };
2818
2819 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2820    STATE-NUM.  */
2821 #define YYPACT_NINF -403
2822 static const yytype_int16 yypact[] =
2823 {
2824     1674,   -70,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,
2825      -15,   -72,  -403,   -52,    19,  -403,  -403,  -403,    80,  -403,
2826     2094,  -403,    99,  -403,  2164,  -403,   -16,    42,    -5,  -403,
2827     -403,  -403,  -403,    -1,     5,  -403,  -403,  2094,    13,  2094,
2828     2094,  2094,  -403,  2094,  2094,  2094,  2094,  2094,   634,   123,
2829      128,  -403,   504,  -403,  -403,  -403,     8,  -403,  2024,  -403,
2830     -403,  -403,  -403,  -403,  -403,  1926,  -403,  -403,  -403,   240,
2831      361,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,
2832       38,  -403,  2569,  -403,  -403,  -403,  -403,   137,    20,  -403,
2833     -403,  1926,  -403,  -403,  -403,  -403,  -403,  -403,   -87,    42,
2834     -403,   -67,  -403,    21,   -48,  2094,    79,  -403,  2094,  -403,
2835     2094,   138,   -48,  -403,    43,  2569,    76,   107,   -48,   -48,
2836      604,   -48,   -48,   -29,    84,   110,  2094,  -403,   210,   211,
2837     2094,  2094,   211,   212,  -403,  -403,   764,  -403,  -403,    85,
2838     -403,  -403,  -403,  -403,   209,  -403,  -403,  -403,  -403,  1024,
2839      158,   232,  -403,   139,   171,  -403,   141,  -403,   238,    12,
2840      239,  -403,   247,  -403,  -403,  -403,  -403,  2094,  2094,  2094,
2841     2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,
2842     2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,
2843     -403,  -403,   249,  2094,  2094,  2094,  2094,  2094,  2094,  2094,
2844     2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,  2094,
2845       11,  -403,  -403,  2094,   229,  2094,  1154,  -403,    42,   133,
2846      135,  -403,  -403,  -403,   142,    15,   -10,    90,  2189,  1800,
2847      130,  -403,  2094,  2094,  -403,  2094,  -403,  -403,  -403,  -403,
2848     -403,   161,   169,  -403,    38,    38,   169,  -403,  -403,  -403,
2849     1926,   149,   161,  2094,  2094,  -403,   168,  -403,  -403,   280,
2850      231,   233,   286,  2569,  1016,   496,   496,   496,   322,   322,
2851      322,   322,  1016,  1016,  2569,  2569,  2569,  2569,  2569,  2569,
2852     2569,  2569,  2569,  2569,  2630,  2691,  -403,   368,   368,   368,
2853     2569,  2386,  2752,  2813,  2874,  1016,  1016,   604,   604,   -48,
2854      -48,   -48,   157,  2447,   202,  2094,   291,    14,   173,  2260,
2855     -403,   165,  1284,  -403,  -403,   172,  -403,  -403,  -403,  -403,
2856     1154,  -403,    42,  2094,  -403,   -43,   296,   167,   201,  -403,
2857     -403,  -403,   175,  -403,   174,  1800,  -403,    44,  -403,   200,
2858       63,   207,   211,   894,  -403,   -27,   -11,    46,   113,   189,
2859       42,   298,    42,   190,   161,   217,  -403,  2094,  -403,  -403,
2860      315,  2323,  -403,  1926,  2094,   193,  -403,  -403,  1154,   192,
2861      194,    75,    63,  -403,  -403,   161,    26,    96,  1926,  2094,
2862     -403,  -403,  -403,  -403,  2094,  -403,  -403,  -403,  2094,  1926,
2863     -403,  -403,    15,  -403,    42,   199,  -403,   230,  -403,   207,
2864      286,  2569,  -403,  -403,  -403,   103,    24,   197,  -403,  -403,
2865     -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,
2866      234,   205,   296,  -403,   206,   213,  -403,  -403,    96,  -403,
2867      268,  -403,  -403,   204,  -403,   215,   230,  -403,    42,   208,
2868     -403,  -403,  -403,  2094,   236,   214,    24,  -403,  -403,  -403,
2869     -403,  -403,  -403,  -403,   335,  -403,  -403,  1926,  -403,  1926,
2870      161,  1414,  -403,   339,  -403,   316,   219,   227,  -403,  2508,
2871     1800,  -403,  -403,  -403,  1800,  1800,   161,  -403,  -403,   223,
2872     -403,  -403,   226,   250,   221,  1544,  -403,  -403,  -403,  -403,
2873       12,  -403,  -403,  1800,  -403,   222,   224,   225,  -403,  1414,
2874     -403,  -403,   354,  -403,  -403,  -403,  -403,  1800,   228,   241,
2875      235,   243,  -403,    15,  1800,  -403,   244,   246,   161,  -403,
2876     -403
2877 };
2878
2879 /* YYPGOTO[NTERM-NUM].  */
2880 static const yytype_int16 yypgoto[] =
2881 {
2882     -403,  -403,   218,  -403,   312,  -299,  -403,    61,  -402,   -31,
2883        1,   -55,   -85,    48,     2,   -23,   321,   251,    58,  -403,
2884     -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,
2885     -403,  -403,  -403,  -403,  -403,   -62,   -60,  -403,  -403,   -40,
2886     -403,   -36,  -403,  -403,  -403,  -403,  -403,  -403,  -403,  -403,
2887        6,    50,  -403,  -403,  -403,  -403,     0,  -403,   331,  -403,
2888     -403,  -403,    49,  -403,    51,  -403,   -96,  -403,   -80,  -403,
2889     -403,   -61,  -403,     3,  -403,  -403,     7,     9,  -403,  -376,
2890     -403,  -311,   -79,     4,  -403,  -403,  -403,  -403,  -403,   388,
2891      -91,    25,    52,  -239,  -403,   -98,  -403,  -403,  -403,  -403,
2892     -403,  -403,  -403,   -34,    -9,   -49,   -13,  -403,  -403,  -403,
2893     -403,  -403,  -403,  -403
2894 };
2895
2896 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
2897    positive, shift that token.  If negative, reduce the rule which
2898    number is the opposite.  If zero, do what YYDEFACT says.
2899    If YYTABLE_NINF, syntax error.  */
2900 #define YYTABLE_NINF -155
2901 static const yytype_int16 yytable[] =
2902 {
2903       69,    54,    56,    74,    75,   114,   214,   101,   223,   155,
2904      156,   104,   230,   345,   304,   374,   435,   136,   325,    87,
2905       97,   369,    93,    94,   112,   192,   115,   118,   119,   325,
2906      120,   121,   122,    97,   115,    88,   156,   123,    95,   217,
2907      218,   -70,   190,   191,   192,    93,    94,   257,    55,    72,
2908       90,    73,    69,    54,    56,    74,    75,   209,   443,   371,
2909      210,    95,   372,   258,    98,   423,    93,    94,   494,   407,
2910       92,   167,   495,   496,   208,   384,   209,   106,   410,   210,
2911      411,   249,    95,   412,   413,   414,   444,   415,   388,   167,
2912      167,   503,   239,    93,    94,   228,   226,   115,    99,   380,
2913       55,    72,   102,    73,   236,   511,   105,    89,   326,    95,
2914      302,   452,   517,   115,   167,   399,   390,   108,   391,   422,
2915      416,   244,   245,   330,   424,   109,   146,   110,   147,   425,
2916      417,   418,   111,   305,   149,   113,   421,   516,   167,   306,
2917      211,   231,   212,   225,   167,    96,   167,   363,   233,    69,
2918       54,    56,    74,    75,   263,   264,   265,   266,   267,   268,
2919      269,   270,   271,   272,   273,   274,   275,   276,   277,   278,
2920      279,   280,   281,   282,   283,   284,   285,   378,   381,   389,
2921      287,   288,   289,   290,   291,   292,   293,   294,   295,   296,
2922      297,   298,   299,   300,   301,   115,   303,    55,    72,   338,
2923       73,   339,   309,   167,   307,   331,   227,   235,   234,   237,
2924      238,   250,     2,   240,   241,   247,    69,    54,   315,   343,
2925      115,   479,   115,   337,   321,   370,   -71,   158,    15,    16,
2926       17,     2,    19,   332,    21,   252,   442,   497,   253,   254,
2927      255,   256,   260,   308,   346,   347,    25,    15,    16,    17,
2928      261,    19,   286,    21,   463,    30,    31,    32,   158,   393,
2929     -113,   396,   322,   336,   323,    25,   340,   159,   158,   342,
2930      348,   160,   161,   463,    30,    31,    32,   159,   404,   520,
2931      249,   344,   161,   349,   162,   350,   163,   352,   249,   354,
2932      358,   360,   361,   430,   362,   364,   163,   366,   368,   325,
2933      375,   376,  -112,   396,   434,   379,   377,   464,   156,   384,
2934      115,   392,    69,    54,   315,   394,   398,   400,   402,   406,
2935       69,    54,   315,   156,   408,   437,   464,   409,   332,   449,
2936      438,   451,   453,   457,   156,   454,   371,   459,   476,   433,
2937     -153,   470,   489,   490,   401,   431,   471,   462,   460,   498,
2938      432,   491,   499,   500,   504,   405,   505,   509,   506,  -154,
2939      512,   514,   168,   513,   148,     2,   115,   251,    69,    54,
2940      315,   115,   477,   367,   478,   515,   440,   518,   519,   152,
2941      242,    15,    16,    17,   472,    19,   473,    21,   455,   169,
2942      170,   171,   456,  -155,  -155,  -155,  -155,   176,   177,    25,
2943      386,   166,   156,   508,   156,   501,   492,   441,    30,    31,
2944       32,   502,   190,   191,   192,   107,   193,   194,   195,   436,
2945        0,     0,     0,     0,   420,     0,     0,     0,     0,   450,
2946      469,   201,   202,     0,   203,   204,   205,   206,   207,   465,
2947        0,     0,     0,     0,   208,     0,   209,     0,     0,   210,
2948        0,     0,     0,     0,     0,     0,     0,     0,   190,   191,
2949      192,   483,   481,   482,   487,   488,     0,   465,     0,     0,
2950        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2951      203,   204,   205,   206,   207,   483,   481,   482,   487,   488,
2952      208,     0,   209,     0,     0,   210,     0,     0,     0,   483,
2953      481,   482,   487,   488,    -4,     0,     0,     1,     2,     3,
2954        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
2955       13,     0,     0,    14,    15,    16,    17,    18,    19,    20,
2956       21,     0,     0,    23,     0,     0,   168,     0,     0,     0,
2957       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
2958        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
2959       36,     0,     0,  -155,  -155,  -155,     0,    37,    38,     0,
2960        0,   176,   177,     0,    39,     0,     0,     0,     0,     0,
2961        0,     0,     0,     0,     0,     0,   190,   191,   192,     0,
2962      193,   194,   195,     0,    40,    41,     0,     0,     0,     0,
2963        0,     0,     0,    42,     0,   201,   202,     0,   203,   204,
2964      205,   206,   207,     0,     0,     0,    43,     0,   208,     0,
2965      209,    44,    45,   210,     0,     0,    46,     0,    47,     0,
2966       48,     0,    49,     0,     0,     0,    -4,     1,     2,     3,
2967        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
2968       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
2969       21,    22,     0,    23,   128,     0,   129,     0,     0,     0,
2970       24,   130,    25,    26,     0,    27,   131,    28,     0,    29,
2971      132,    30,    31,    32,     0,     0,    33,    34,     0,    35,
2972       36,     0,     0,     0,   190,   191,   192,    37,    38,     0,
2973      133,     0,     0,     0,    39,     0,     0,     0,     0,     0,
2974        0,     0,     0,     0,     0,     0,     0,     0,   205,   206,
2975      207,     0,     0,     0,    40,    41,   208,     0,   209,     0,
2976        0,   210,     0,   134,     0,     0,     0,     0,     0,     0,
2977        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
2978        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
2979       48,     0,    49,     0,     0,     0,   135,     1,     2,     3,
2980        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
2981       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
2982       21,    22,     0,    23,   128,     0,   129,     0,     0,     0,
2983       24,   130,    25,    26,     0,    27,   131,    28,     0,    29,
2984      132,    30,    31,    32,     0,     0,    33,    34,     0,    35,
2985       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
2986      133,     0,     0,     0,    39,     0,     0,     0,     0,     0,
2987        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2988        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
2989        0,     0,     0,   134,     0,     0,     0,     0,     0,     0,
2990        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
2991        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
2992       48,     0,    49,     0,     0,     0,   248,     1,     2,     3,
2993        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
2994       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
2995       21,    22,     0,    23,   128,     0,   129,     0,     0,     0,
2996       24,   130,    25,    26,     0,    27,   131,    28,     0,    29,
2997      132,    30,    31,    32,     0,     0,    33,    34,     0,    35,
2998       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
2999      133,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3000        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3001        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3002        0,     0,     0,   134,     0,     0,     0,     0,     0,     0,
3003        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3004        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3005       48,     0,    49,     0,     0,     0,   387,     1,     2,     3,
3006        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3007       13,     0,     0,    14,    15,    16,    17,    18,    19,    20,
3008       21,     0,     0,    23,     0,     0,  -155,     0,     0,     0,
3009       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3010        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3011       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3012        0,  -155,  -155,     0,    39,     0,     0,     0,     0,     0,
3013        0,     0,     0,     0,     0,     0,   190,   191,   192,     0,
3014      193,   194,   195,     0,    40,    41,     0,     0,     0,     0,
3015        0,     0,     0,    42,     0,  -155,  -155,     0,   203,   204,
3016      205,   206,   207,     0,     0,     0,    43,     0,   208,     0,
3017      209,    44,    45,   210,     0,     0,    46,     0,    47,     0,
3018       48,     0,    49,     0,     0,     0,    -3,     1,     2,     3,
3019        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3020       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
3021       21,     0,     0,    23,     0,     0,     0,     0,     0,     0,
3022       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3023        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3024       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3025        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3026        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3027        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3028        0,     0,     0,   310,     0,     0,     0,     0,     0,     0,
3029        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3030        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3031       48,     0,    49,     0,     0,     0,   -15,     1,     2,     3,
3032        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3033       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
3034       21,     0,     0,    23,     0,     0,     0,     0,     0,     0,
3035       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3036        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3037       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3038        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3039        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3040        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3041        0,     0,     0,   310,     0,     0,     0,     0,     0,     0,
3042        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3043        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3044       48,     0,    49,     0,     0,     0,   -16,     1,     2,     3,
3045        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3046       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
3047       21,     0,     0,    23,     0,     0,     0,     0,     0,     0,
3048       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3049        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3050       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3051        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3052        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3053        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3054        0,     0,     0,   480,     0,     0,     0,     0,     0,     0,
3055        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3056        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3057       48,     0,    49,     0,     0,     0,  -144,     1,     2,     3,
3058        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3059       13,     0,     0,     0,    15,    16,    17,    18,    19,    20,
3060       21,     0,     0,    23,     0,     0,     0,     0,     0,     0,
3061       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3062        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3063       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3064        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3065        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3066        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3067        0,     0,     0,   480,     0,     0,     0,     0,     0,     0,
3068        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3069        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3070       48,     0,    49,     0,    -3,     0,  -145,     1,     2,     3,
3071        4,     0,     5,     6,     7,     8,     9,    10,    11,    12,
3072       13,     0,     0,    14,    15,    16,    17,    18,    19,    20,
3073       21,     0,     0,    23,     0,     0,     0,     0,     0,     0,
3074       24,     0,    25,    26,     0,    27,     0,    28,     0,    29,
3075        0,    30,    31,    32,     0,     0,    33,    34,     0,    35,
3076       36,     0,     0,     0,     0,     0,     0,    37,    38,     0,
3077        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3078        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3079        0,     0,     0,     0,    40,    41,     0,     0,     0,     0,
3080        0,     0,     0,    42,     0,     0,     0,     0,     0,     0,
3081        0,     0,     0,     0,     0,     0,    43,     0,     0,     0,
3082        0,    44,    45,     0,     0,     0,    46,     0,    47,     0,
3083       48,     0,    49,     1,     2,     3,     4,     0,     5,     6,
3084        7,     8,     9,    10,    11,    12,    13,     0,  -120,     0,
3085       15,    16,    17,    18,    19,    20,    21,    22,     0,    23,
3086      128,     0,   129,     0,     0,     0,    24,   130,    25,    26,
3087        0,    27,   131,    28,     0,    29,   132,    30,    31,    32,
3088        0,     0,    33,    34,     0,    35,    36,     0,     0,     0,
3089        0,     0,     0,    37,    38,     0,   133,     0,     0,     0,
3090       39,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3091        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3092       40,    41,     0,     0,     0,     0,     0,     0,     0,   134,
3093        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3094        0,     0,    43,     0,     0,     0,     0,    44,    45,     0,
3095        0,     0,    46,     0,    47,     0,    48,     0,    49,     1,
3096        2,     3,     4,     0,     5,     6,     7,     8,     9,    10,
3097       11,    12,    13,     0,     0,     0,    15,    16,    17,    18,
3098       19,    20,    21,    22,     0,    23,   128,     0,   129,     0,
3099        0,     0,    24,   130,    25,    26,     0,    27,   131,    28,
3100        0,    29,   132,    30,    31,    32,     0,     0,    33,    34,
3101        0,    35,    36,     0,     0,     0,     0,     0,     0,    37,
3102       38,     0,   133,     0,     0,     0,    39,     0,     0,     0,
3103        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3104        0,     0,     0,     0,     0,     0,    40,    41,     0,     0,
3105        0,     0,     0,     0,     0,   134,     0,   150,     0,     3,
3106        4,     0,     5,     6,     7,     8,     9,     0,    43,     0,
3107        0,     0,     0,    44,    45,     0,     0,     0,    46,    20,
3108       47,    22,    48,    23,    49,     0,   129,     0,     0,     0,
3109       24,     0,     0,     0,     0,     0,     0,    28,     0,    29,
3110      151,     0,     0,     0,     0,     0,     0,    34,     0,    35,
3111       36,     0,     0,     0,     0,     0,     0,    37,     0,     0,
3112        0,     0,     0,     0,    39,     0,     0,   100,     0,     3,
3113        4,     0,     5,     6,     7,     8,     9,     0,     0,     0,
3114        0,     0,     0,     0,    40,    41,     0,     0,     0,    20,
3115        0,    22,     0,    23,     0,     0,     0,     0,     0,     0,
3116       24,     0,     0,     0,     0,     0,    43,    28,     0,    29,
3117        0,    44,    45,     0,     0,     0,    46,    34,    47,    35,
3118       36,     0,    49,     0,     0,     0,     0,    37,     0,     0,
3119        0,     0,     0,     0,    39,     0,     0,   100,     0,     3,
3120        4,     0,     5,     6,     7,     8,     9,     0,     0,     0,
3121        0,     0,     0,     0,    40,    41,     0,     0,     0,    20,
3122        0,    22,     0,    23,     0,     0,     0,     0,     0,     0,
3123        0,     0,     0,     0,     0,     0,    43,     0,     0,    29,
3124        0,    44,    45,     0,     0,     0,    46,    34,    47,    35,
3125       36,     0,    49,     0,     0,     0,     0,     0,     0,   168,
3126        0,     0,     0,     0,    39,     0,     0,     0,     0,     0,
3127        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3128        0,     0,     0,     0,    40,    41,   169,   170,   171,     0,
3129      172,   173,   174,   175,   176,   177,   178,   179,   180,   181,
3130      182,   183,   184,   185,   186,   187,   188,   189,     0,   190,
3131      191,   192,     0,   193,   194,   195,    46,     0,    47,     0,
3132        0,   196,    49,   197,     0,   198,   199,   200,   201,   202,
3133      168,   203,   204,   205,   206,   207,     0,     0,     0,     0,
3134        0,   208,     0,   209,     0,     0,   210,     0,     0,     0,
3135        0,     0,   333,     0,     0,     0,     0,   169,   170,   171,
3136        0,   172,   173,   174,   175,   176,   177,   178,   179,   180,
3137      181,   182,   183,   184,   185,   186,   187,   188,   189,     0,
3138      190,   191,   192,     0,   193,   194,   195,     0,     0,     0,
3139        0,     0,   196,   168,   197,     0,   198,   199,   200,   201,
3140      202,     0,   203,   204,   205,   206,   207,     0,     0,     0,
3141        0,     0,   208,     0,   209,     0,     0,   210,     0,     0,
3142      169,   170,   171,   365,   172,   173,   174,   175,   176,   177,
3143      178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
3144      188,   189,     0,   190,   191,   192,     0,   193,   194,   195,
3145        0,     0,     0,     0,     0,   196,   168,   197,     0,   198,
3146      199,   200,   201,   202,     0,   203,   204,   205,   206,   207,
3147        0,     0,     0,     0,     0,   208,     0,   209,     0,     0,
3148      210,     0,     0,   169,   170,   171,   403,   172,   173,   174,
3149      175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
3150      185,   186,   187,   188,   189,     0,   190,   191,   192,     0,
3151      193,   194,   195,     0,     0,     0,     0,   168,   196,     0,
3152      197,   357,   198,   199,   200,   201,   202,     0,   203,   204,
3153      205,   206,   207,     0,     0,     0,     0,     0,   208,     0,
3154      209,     0,     0,   210,   169,   170,   171,     0,   172,   173,
3155      174,   175,   176,   177,   178,   179,   180,   181,   182,   183,
3156      184,   185,   186,   187,   188,   189,     0,   190,   191,   192,
3157        0,   193,   194,   195,     0,     0,     0,     0,   168,   196,
3158        0,   197,     0,   198,   199,   200,   201,   202,     0,   203,
3159      204,   205,   206,   207,     0,     0,     0,     0,     0,   208,
3160        0,   209,   359,     0,   210,   169,   170,   171,     0,   172,
3161      173,   174,   175,   176,   177,   178,   179,   180,   181,   182,
3162      183,   184,   185,   186,   187,   188,   189,     0,   190,   191,
3163      192,     0,   193,   194,   195,     0,     0,     0,     0,   168,
3164      196,     0,   197,   493,   198,   199,   200,   201,   202,     0,
3165      203,   204,   205,   206,   207,     0,     0,     0,     0,     0,
3166      208,     0,   209,     0,     0,   210,   169,   170,   171,     0,
3167      172,   173,   174,   175,   176,   177,   178,   179,   180,   181,
3168      182,   183,   184,   185,   186,   187,   188,   189,     0,   190,
3169      191,   192,     0,   193,   194,   195,     0,     0,     0,     0,
3170      168,   196,     0,   197,     0,   198,   199,   200,   201,   202,
3171        0,   203,   204,   205,   206,   207,     0,     0,     0,     0,
3172        0,   208,     0,   209,     0,     0,   210,   169,   170,   171,
3173        0,   172,   173,   174,   175,   176,   177,     0,     0,     0,
3174        0,     0,     0,     0,     0,     0,     0,     0,   189,     0,
3175      190,   191,   192,     0,   193,   194,   195,     0,     0,     0,
3176        0,   168,     0,     0,     0,     0,   198,   199,   200,   201,
3177      202,     0,   203,   204,   205,   206,   207,     0,     0,     0,
3178        0,     0,   208,     0,   209,     0,     0,   210,   169,   170,
3179      171,     0,   172,   173,   174,   175,   176,   177,     0,     0,
3180        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3181        0,   190,   191,   192,     0,   193,   194,   195,     0,     0,
3182        0,     0,   168,     0,     0,     0,     0,   198,   199,   200,
3183      201,   202,     0,   203,   204,   205,   206,   207,     0,     0,
3184        0,     0,     0,   208,     0,   209,     0,     0,   210,   169,
3185      170,   171,     0,   172,   173,   174,   175,   176,   177,     0,
3186        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3187        0,     0,   190,   191,   192,     0,   193,   194,   195,     0,
3188        0,     0,     0,   168,     0,     0,     0,     0,     0,   199,
3189      200,   201,   202,     0,   203,   204,   205,   206,   207,     0,
3190        0,     0,     0,     0,   208,     0,   209,     0,     0,   210,
3191      169,   170,   171,     0,   172,   173,   174,   175,   176,   177,
3192        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3193        0,     0,     0,   190,   191,   192,     0,   193,   194,   195,
3194        0,     0,     0,     0,   168,     0,     0,     0,     0,     0,
3195        0,   200,   201,   202,     0,   203,   204,   205,   206,   207,
3196        0,     0,     0,     0,     0,   208,     0,   209,     0,     0,
3197      210,   169,   170,   171,     0,   172,   173,   174,   175,   176,
3198      177,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3199        0,     0,     0,     0,   190,   191,   192,     0,   193,   194,
3200      195,     0,     0,     0,     0,     0,     0,     0,     0,     0,
3201        0,     0,  -155,   201,   202,     0,   203,   204,   205,   206,
3202      207,     0,     0,     0,     0,     0,   208,     0,   209,     0,
3203        0,   210
3204 };
3205
3206 static const yytype_int16 yycheck[] =
3207 {
3208        0,     0,     0,     0,     0,    39,    91,    20,    99,    58,
3209       65,    24,   110,   252,     3,   326,   392,    48,     3,    89,
3210       14,   320,     3,     4,    37,    92,    39,    40,    41,     3,
3211       43,    44,    45,    27,    47,    50,    91,    46,    19,   126,
3212      127,    68,    90,    91,    92,     3,     4,    35,     0,     0,
3213      122,     0,    52,    52,    52,    52,    52,   124,    34,   102,
3214      127,    19,   105,    51,    14,   376,     3,     4,   470,   368,
3215      122,   100,   474,   475,   122,   102,   124,    27,     3,   127,
3216        5,   136,    19,     8,     9,    10,    62,    12,    99,   100,
3217      100,   493,   126,     3,     4,   108,   105,   110,    18,    36,
3218       52,    52,     3,    52,   133,   507,   122,   122,    93,    19,
3219      208,   422,   514,   126,   100,   354,     3,   122,     5,    93,
3220       45,   130,   131,   133,    28,   126,     3,   122,     0,    33,
3221       55,    56,   127,   122,   126,   122,   375,   513,   100,   128,
3222        3,     3,   122,   122,   100,   126,   100,   133,   105,   149,
3223      149,   149,   149,   149,   167,   168,   169,   170,   171,   172,
3224      173,   174,   175,   176,   177,   178,   179,   180,   181,   182,
3225      183,   184,   185,   186,   187,   188,   189,   133,   115,   133,
3226      193,   194,   195,   196,   197,   198,   199,   200,   201,   202,
3227      203,   204,   205,   206,   207,   208,   209,   149,   149,   233,
3228      149,   235,   215,   100,   213,   115,   127,   100,   132,   125,
3229      100,   126,     4,     3,     3,     3,   216,   216,   216,   250,
3230      233,   460,   235,   232,   218,   323,    68,    18,    20,    21,
3231       22,     4,    24,   227,    26,     3,   133,   476,    99,    68,
3232       99,     3,     3,    14,   253,   254,    38,    20,    21,    22,
3233        3,    24,     3,    26,    46,    47,    48,    49,    18,   350,
3234      127,   352,   127,   133,   122,    38,   105,    27,    18,   100,
3235      102,    31,    32,    46,    47,    48,    49,    27,   363,   518,
3236      335,   132,    32,     3,    44,    54,    46,    54,   343,     3,
3237      133,    89,   305,   378,     3,   122,    46,   132,   126,     3,
3238      133,   100,   127,   394,   389,   105,   132,    99,   363,   102,
3239      323,   122,   312,   312,   312,    17,   126,   100,     3,   126,
3240      320,   320,   320,   378,   132,   126,    99,   133,   322,   132,
3241      100,   126,   126,    65,   389,   122,   102,   133,     3,   388,
3242      132,   105,     3,    27,   357,   379,   132,   438,   133,   126,
3243      384,   132,   126,   132,   132,   364,   132,     3,   133,   132,
3244      132,   126,    40,   122,    52,     4,   379,   149,   368,   368,
3245      368,   384,   457,   312,   459,   132,   399,   133,   132,    58,
3246      129,    20,    21,    22,   446,    24,   446,    26,   428,    67,
3247       68,    69,   428,    71,    72,    73,    74,    75,    76,    38,
3248      342,    70,   457,   499,   459,   485,   467,   400,    47,    48,
3249       49,   490,    90,    91,    92,    27,    94,    95,    96,   394,
3250       -1,    -1,    -1,    -1,   372,    -1,    -1,    -1,    -1,   420,
3251      443,   109,   110,    -1,   112,   113,   114,   115,   116,   439,
3252       -1,    -1,    -1,    -1,   122,    -1,   124,    -1,    -1,   127,
3253       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,    91,
3254       92,   461,   461,   461,   461,   461,    -1,   467,    -1,    -1,
3255       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3256      112,   113,   114,   115,   116,   485,   485,   485,   485,   485,
3257      122,    -1,   124,    -1,    -1,   127,    -1,    -1,    -1,   499,
3258      499,   499,   499,   499,     0,    -1,    -1,     3,     4,     5,
3259        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3260       16,    -1,    -1,    19,    20,    21,    22,    23,    24,    25,
3261       26,    -1,    -1,    29,    -1,    -1,    40,    -1,    -1,    -1,
3262       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3263       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3264       56,    -1,    -1,    67,    68,    69,    -1,    63,    64,    -1,
3265       -1,    75,    76,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3266       -1,    -1,    -1,    -1,    -1,    -1,    90,    91,    92,    -1,
3267       94,    95,    96,    -1,    90,    91,    -1,    -1,    -1,    -1,
3268       -1,    -1,    -1,    99,    -1,   109,   110,    -1,   112,   113,
3269      114,   115,   116,    -1,    -1,    -1,   112,    -1,   122,    -1,
3270      124,   117,   118,   127,    -1,    -1,   122,    -1,   124,    -1,
3271      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3272        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3273       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3274       26,    27,    -1,    29,    30,    -1,    32,    -1,    -1,    -1,
3275       36,    37,    38,    39,    -1,    41,    42,    43,    -1,    45,
3276       46,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3277       56,    -1,    -1,    -1,    90,    91,    92,    63,    64,    -1,
3278       66,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3279       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   114,   115,
3280      116,    -1,    -1,    -1,    90,    91,   122,    -1,   124,    -1,
3281       -1,   127,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3282       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3283       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3284      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3285        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3286       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3287       26,    27,    -1,    29,    30,    -1,    32,    -1,    -1,    -1,
3288       36,    37,    38,    39,    -1,    41,    42,    43,    -1,    45,
3289       46,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3290       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3291       66,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3292       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3293       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3294       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3295       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3296       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3297      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3298        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3299       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3300       26,    27,    -1,    29,    30,    -1,    32,    -1,    -1,    -1,
3301       36,    37,    38,    39,    -1,    41,    42,    43,    -1,    45,
3302       46,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3303       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3304       66,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3305       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3306       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3307       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3308       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3309       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3310      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3311        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3312       16,    -1,    -1,    19,    20,    21,    22,    23,    24,    25,
3313       26,    -1,    -1,    29,    -1,    -1,    40,    -1,    -1,    -1,
3314       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3315       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3316       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3317       -1,    75,    76,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3318       -1,    -1,    -1,    -1,    -1,    -1,    90,    91,    92,    -1,
3319       94,    95,    96,    -1,    90,    91,    -1,    -1,    -1,    -1,
3320       -1,    -1,    -1,    99,    -1,   109,   110,    -1,   112,   113,
3321      114,   115,   116,    -1,    -1,    -1,   112,    -1,   122,    -1,
3322      124,   117,   118,   127,    -1,    -1,   122,    -1,   124,    -1,
3323      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3324        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3325       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3326       26,    -1,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3327       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3328       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3329       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3330       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3331       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3332       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3333       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3334       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3335       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3336      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3337        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3338       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3339       26,    -1,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3340       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3341       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3342       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3343       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3344       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3345       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3346       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3347       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3348       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3349      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3350        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3351       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3352       26,    -1,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3353       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3354       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3355       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3356       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3357       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3358       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3359       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3360       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3361       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3362      126,    -1,   128,    -1,    -1,    -1,   132,     3,     4,     5,
3363        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3364       16,    -1,    -1,    -1,    20,    21,    22,    23,    24,    25,
3365       26,    -1,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3366       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3367       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3368       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3369       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3370       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3371       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3372       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3373       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3374       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3375      126,    -1,   128,    -1,     0,    -1,   132,     3,     4,     5,
3376        6,    -1,     8,     9,    10,    11,    12,    13,    14,    15,
3377       16,    -1,    -1,    19,    20,    21,    22,    23,    24,    25,
3378       26,    -1,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3379       36,    -1,    38,    39,    -1,    41,    -1,    43,    -1,    45,
3380       -1,    47,    48,    49,    -1,    -1,    52,    53,    -1,    55,
3381       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,    -1,
3382       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3383       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3384       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
3385       -1,    -1,    -1,    99,    -1,    -1,    -1,    -1,    -1,    -1,
3386       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    -1,
3387       -1,   117,   118,    -1,    -1,    -1,   122,    -1,   124,    -1,
3388      126,    -1,   128,     3,     4,     5,     6,    -1,     8,     9,
3389       10,    11,    12,    13,    14,    15,    16,    -1,    18,    -1,
3390       20,    21,    22,    23,    24,    25,    26,    27,    -1,    29,
3391       30,    -1,    32,    -1,    -1,    -1,    36,    37,    38,    39,
3392       -1,    41,    42,    43,    -1,    45,    46,    47,    48,    49,
3393       -1,    -1,    52,    53,    -1,    55,    56,    -1,    -1,    -1,
3394       -1,    -1,    -1,    63,    64,    -1,    66,    -1,    -1,    -1,
3395       70,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3396       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3397       90,    91,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    99,
3398       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3399       -1,    -1,   112,    -1,    -1,    -1,    -1,   117,   118,    -1,
3400       -1,    -1,   122,    -1,   124,    -1,   126,    -1,   128,     3,
3401        4,     5,     6,    -1,     8,     9,    10,    11,    12,    13,
3402       14,    15,    16,    -1,    -1,    -1,    20,    21,    22,    23,
3403       24,    25,    26,    27,    -1,    29,    30,    -1,    32,    -1,
3404       -1,    -1,    36,    37,    38,    39,    -1,    41,    42,    43,
3405       -1,    45,    46,    47,    48,    49,    -1,    -1,    52,    53,
3406       -1,    55,    56,    -1,    -1,    -1,    -1,    -1,    -1,    63,
3407       64,    -1,    66,    -1,    -1,    -1,    70,    -1,    -1,    -1,
3408       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3409       -1,    -1,    -1,    -1,    -1,    -1,    90,    91,    -1,    -1,
3410       -1,    -1,    -1,    -1,    -1,    99,    -1,     3,    -1,     5,
3411        6,    -1,     8,     9,    10,    11,    12,    -1,   112,    -1,
3412       -1,    -1,    -1,   117,   118,    -1,    -1,    -1,   122,    25,
3413      124,    27,   126,    29,   128,    -1,    32,    -1,    -1,    -1,
3414       36,    -1,    -1,    -1,    -1,    -1,    -1,    43,    -1,    45,
3415       46,    -1,    -1,    -1,    -1,    -1,    -1,    53,    -1,    55,
3416       56,    -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    -1,
3417       -1,    -1,    -1,    -1,    70,    -1,    -1,     3,    -1,     5,
3418        6,    -1,     8,     9,    10,    11,    12,    -1,    -1,    -1,
3419       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    25,
3420       -1,    27,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3421       36,    -1,    -1,    -1,    -1,    -1,   112,    43,    -1,    45,
3422       -1,   117,   118,    -1,    -1,    -1,   122,    53,   124,    55,
3423       56,    -1,   128,    -1,    -1,    -1,    -1,    63,    -1,    -1,
3424       -1,    -1,    -1,    -1,    70,    -1,    -1,     3,    -1,     5,
3425        6,    -1,     8,     9,    10,    11,    12,    -1,    -1,    -1,
3426       -1,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    25,
3427       -1,    27,    -1,    29,    -1,    -1,    -1,    -1,    -1,    -1,
3428       -1,    -1,    -1,    -1,    -1,    -1,   112,    -1,    -1,    45,
3429       -1,   117,   118,    -1,    -1,    -1,   122,    53,   124,    55,
3430       56,    -1,   128,    -1,    -1,    -1,    -1,    -1,    -1,    40,
3431       -1,    -1,    -1,    -1,    70,    -1,    -1,    -1,    -1,    -1,
3432       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3433       -1,    -1,    -1,    -1,    90,    91,    67,    68,    69,    -1,
3434       71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
3435       81,    82,    83,    84,    85,    86,    87,    88,    -1,    90,
3436       91,    92,    -1,    94,    95,    96,   122,    -1,   124,    -1,
3437       -1,   102,   128,   104,    -1,   106,   107,   108,   109,   110,
3438       40,   112,   113,   114,   115,   116,    -1,    -1,    -1,    -1,
3439       -1,   122,    -1,   124,    -1,    -1,   127,    -1,    -1,    -1,
3440       -1,    -1,   133,    -1,    -1,    -1,    -1,    67,    68,    69,
3441       -1,    71,    72,    73,    74,    75,    76,    77,    78,    79,
3442       80,    81,    82,    83,    84,    85,    86,    87,    88,    -1,
3443       90,    91,    92,    -1,    94,    95,    96,    -1,    -1,    -1,
3444       -1,    -1,   102,    40,   104,    -1,   106,   107,   108,   109,
3445      110,    -1,   112,   113,   114,   115,   116,    -1,    -1,    -1,
3446       -1,    -1,   122,    -1,   124,    -1,    -1,   127,    -1,    -1,
3447       67,    68,    69,   133,    71,    72,    73,    74,    75,    76,
3448       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
3449       87,    88,    -1,    90,    91,    92,    -1,    94,    95,    96,
3450       -1,    -1,    -1,    -1,    -1,   102,    40,   104,    -1,   106,
3451      107,   108,   109,   110,    -1,   112,   113,   114,   115,   116,
3452       -1,    -1,    -1,    -1,    -1,   122,    -1,   124,    -1,    -1,
3453      127,    -1,    -1,    67,    68,    69,   133,    71,    72,    73,
3454       74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
3455       84,    85,    86,    87,    88,    -1,    90,    91,    92,    -1,
3456       94,    95,    96,    -1,    -1,    -1,    -1,    40,   102,    -1,
3457      104,   105,   106,   107,   108,   109,   110,    -1,   112,   113,
3458      114,   115,   116,    -1,    -1,    -1,    -1,    -1,   122,    -1,
3459      124,    -1,    -1,   127,    67,    68,    69,    -1,    71,    72,
3460       73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
3461       83,    84,    85,    86,    87,    88,    -1,    90,    91,    92,
3462       -1,    94,    95,    96,    -1,    -1,    -1,    -1,    40,   102,
3463       -1,   104,    -1,   106,   107,   108,   109,   110,    -1,   112,
3464      113,   114,   115,   116,    -1,    -1,    -1,    -1,    -1,   122,
3465       -1,   124,   125,    -1,   127,    67,    68,    69,    -1,    71,
3466       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
3467       82,    83,    84,    85,    86,    87,    88,    -1,    90,    91,
3468       92,    -1,    94,    95,    96,    -1,    -1,    -1,    -1,    40,
3469      102,    -1,   104,   105,   106,   107,   108,   109,   110,    -1,
3470      112,   113,   114,   115,   116,    -1,    -1,    -1,    -1,    -1,
3471      122,    -1,   124,    -1,    -1,   127,    67,    68,    69,    -1,
3472       71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
3473       81,    82,    83,    84,    85,    86,    87,    88,    -1,    90,
3474       91,    92,    -1,    94,    95,    96,    -1,    -1,    -1,    -1,
3475       40,   102,    -1,   104,    -1,   106,   107,   108,   109,   110,
3476       -1,   112,   113,   114,   115,   116,    -1,    -1,    -1,    -1,
3477       -1,   122,    -1,   124,    -1,    -1,   127,    67,    68,    69,
3478       -1,    71,    72,    73,    74,    75,    76,    -1,    -1,    -1,
3479       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    88,    -1,
3480       90,    91,    92,    -1,    94,    95,    96,    -1,    -1,    -1,
3481       -1,    40,    -1,    -1,    -1,    -1,   106,   107,   108,   109,
3482      110,    -1,   112,   113,   114,   115,   116,    -1,    -1,    -1,
3483       -1,    -1,   122,    -1,   124,    -1,    -1,   127,    67,    68,
3484       69,    -1,    71,    72,    73,    74,    75,    76,    -1,    -1,
3485       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3486       -1,    90,    91,    92,    -1,    94,    95,    96,    -1,    -1,
3487       -1,    -1,    40,    -1,    -1,    -1,    -1,   106,   107,   108,
3488      109,   110,    -1,   112,   113,   114,   115,   116,    -1,    -1,
3489       -1,    -1,    -1,   122,    -1,   124,    -1,    -1,   127,    67,
3490       68,    69,    -1,    71,    72,    73,    74,    75,    76,    -1,
3491       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3492       -1,    -1,    90,    91,    92,    -1,    94,    95,    96,    -1,
3493       -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,    -1,   107,
3494      108,   109,   110,    -1,   112,   113,   114,   115,   116,    -1,
3495       -1,    -1,    -1,    -1,   122,    -1,   124,    -1,    -1,   127,
3496       67,    68,    69,    -1,    71,    72,    73,    74,    75,    76,
3497       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3498       -1,    -1,    -1,    90,    91,    92,    -1,    94,    95,    96,
3499       -1,    -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,    -1,
3500       -1,   108,   109,   110,    -1,   112,   113,   114,   115,   116,
3501       -1,    -1,    -1,    -1,    -1,   122,    -1,   124,    -1,    -1,
3502      127,    67,    68,    69,    -1,    71,    72,    73,    74,    75,
3503       76,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3504       -1,    -1,    -1,    -1,    90,    91,    92,    -1,    94,    95,
3505       96,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
3506       -1,    -1,   108,   109,   110,    -1,   112,   113,   114,   115,
3507      116,    -1,    -1,    -1,    -1,    -1,   122,    -1,   124,    -1,
3508       -1,   127
3509 };
3510
3511 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
3512    symbol of state STATE-NUM.  */
3513 static const yytype_uint8 yystos[] =
3514 {
3515        0,     3,     4,     5,     6,     8,     9,    10,    11,    12,
3516       13,    14,    15,    16,    19,    20,    21,    22,    23,    24,
3517       25,    26,    27,    29,    36,    38,    39,    41,    43,    45,
3518       47,    48,    49,    52,    53,    55,    56,    63,    64,    70,
3519       90,    91,    99,   112,   117,   118,   122,   124,   126,   128,
3520      135,   136,   137,   138,   144,   147,   148,   154,   158,   159,
3521      160,   161,   163,   171,   179,   182,   183,   186,   189,   190,
3522      191,   192,   196,   198,   207,   217,   220,   233,   234,   235,
3523      238,   239,   240,   241,   244,   246,   247,    89,    50,   122,
3524      122,   164,   122,     3,     4,    19,   126,   184,   185,    18,
3525        3,   240,     3,   219,   240,   122,   185,   223,   122,   126,
3526      122,   127,   240,   122,   237,   240,   242,   243,   240,   240,
3527      240,   240,   240,   238,   229,   230,   231,   237,    30,    32,
3528       37,    42,    46,    66,    99,   132,   143,   144,   145,   148,
3529      150,   165,   166,   181,   190,   236,     3,     0,   138,   126,
3530        3,    46,   150,   156,   157,   239,   145,   146,    18,    27,
3531       31,    32,    44,    46,   206,   245,   192,   100,    40,    67,
3532       68,    69,    71,    72,    73,    74,    75,    76,    77,    78,
3533       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
3534       90,    91,    92,    94,    95,    96,   102,   104,   106,   107,
3535      108,   109,   110,   112,   113,   114,   115,   116,   122,   124,
3536      127,     3,   122,   162,   146,   172,   188,   126,   127,   184,
3537      185,   222,   223,   224,   232,   122,   238,   127,   240,   180,
3538      229,     3,   155,   105,   132,   100,   133,   125,   100,   237,
3539        3,     3,   151,   152,   238,   238,   151,     3,   132,   145,
3540      126,   136,     3,    99,    68,    99,     3,    35,    51,   216,
3541        3,     3,   208,   240,   240,   240,   240,   240,   240,   240,
3542      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
3543      240,   240,   240,   240,   240,   240,     3,   240,   240,   240,
3544      240,   240,   240,   240,   240,   240,   240,   240,   240,   240,
3545      240,   240,   229,   240,     3,   122,   128,   238,    14,   240,
3546       99,   139,   140,   141,   147,   148,   196,   198,   207,   217,
3547      187,   184,   127,   122,   228,     3,    93,   213,   214,   215,
3548      133,   115,   184,   133,   142,   143,   133,   238,   237,   237,
3549      105,   227,   100,   143,   132,   227,   238,   238,   102,     3,
3550       54,   193,    54,   194,     3,   209,   210,   105,   133,   125,
3551       89,   240,     3,   133,   122,   133,   132,   141,   126,   139,
3552      229,   102,   105,   211,   215,   133,   100,   132,   133,   105,
3553       36,   115,   224,   226,   102,   149,   152,   132,    99,   133,
3554        3,     5,   122,   224,    17,   195,   224,   225,   126,   227,
3555      100,   240,     3,   133,   146,   238,   126,   139,   132,   133,
3556        3,     5,     8,     9,    10,    12,    45,    55,    56,   212,
3557      226,   227,    93,   215,    28,    33,   173,   175,   177,   178,
3558      146,   237,   237,   239,   146,   213,   225,   126,   100,   199,
3559      149,   210,   133,    34,    62,   167,   168,   169,   170,   132,
3560      211,   126,   215,   126,   122,   173,   175,    65,   153,   133,
3561      133,   197,   224,    46,    99,   190,   203,   204,   205,   240,
3562      105,   132,   169,   170,   221,   176,     3,   146,   146,   227,
3563       99,   144,   148,   190,   200,   201,   202,   207,   217,     3,
3564       27,   132,   205,   105,   142,   142,   142,   227,   126,   126,
3565      132,   202,   216,   142,   132,   132,   133,   218,   200,     3,
3566      174,   142,   132,   122,   126,   132,   213,   142,   133,   132,
3567      227
3568 };
3569
3570 #define yyerrok         (yyerrstatus = 0)
3571 #define yyclearin       (yychar = YYEMPTY)
3572 #define YYEMPTY         (-2)
3573 #define YYEOF           0
3574
3575 #define YYACCEPT        goto yyacceptlab
3576 #define YYABORT         goto yyabortlab
3577 #define YYERROR         goto yyerrorlab
3578
3579
3580 /* Like YYERROR except do call yyerror.  This remains here temporarily
3581    to ease the transition to the new meaning of YYERROR, for GCC.
3582    Once GCC version 2 has supplanted version 1, this can go.  */
3583
3584 #define YYFAIL          goto yyerrlab
3585
3586 #define YYRECOVERING()  (!!yyerrstatus)
3587
3588 #define YYBACKUP(Token, Value)                                  \
3589 do                                                              \
3590   if (yychar == YYEMPTY && yylen == 1)                          \
3591     {                                                           \
3592       yychar = (Token);                                         \
3593       yylval = (Value);                                         \
3594       yytoken = YYTRANSLATE (yychar);                           \
3595       YYPOPSTACK (1);                                           \
3596       goto yybackup;                                            \
3597     }                                                           \
3598   else                                                          \
3599     {                                                           \
3600       yyerror (YY_("syntax error: cannot back up")); \
3601       YYERROR;                                                  \
3602     }                                                           \
3603 while (YYID (0))
3604
3605
3606 #define YYTERROR        1
3607 #define YYERRCODE       256
3608
3609
3610 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
3611    If N is 0, then set CURRENT to the empty location which ends
3612    the previous symbol: RHS[0] (always defined).  */
3613
3614 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
3615 #ifndef YYLLOC_DEFAULT
3616 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
3617     do                                                                  \
3618       if (YYID (N))                                                    \
3619         {                                                               \
3620           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
3621           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
3622           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
3623           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
3624         }                                                               \
3625       else                                                              \
3626         {                                                               \
3627           (Current).first_line   = (Current).last_line   =              \
3628             YYRHSLOC (Rhs, 0).last_line;                                \
3629           (Current).first_column = (Current).last_column =              \
3630             YYRHSLOC (Rhs, 0).last_column;                              \
3631         }                                                               \
3632     while (YYID (0))
3633 #endif
3634
3635
3636 /* YY_LOCATION_PRINT -- Print the location on the stream.
3637    This macro was not mandated originally: define only if we know
3638    we won't break user code: when these are the locations we know.  */
3639
3640 #ifndef YY_LOCATION_PRINT
3641 # if YYLTYPE_IS_TRIVIAL
3642 #  define YY_LOCATION_PRINT(File, Loc)                  \
3643      fprintf (File, "%d.%d-%d.%d",                      \
3644               (Loc).first_line, (Loc).first_column,     \
3645               (Loc).last_line,  (Loc).last_column)
3646 # else
3647 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
3648 # endif
3649 #endif
3650
3651
3652 /* YYLEX -- calling `yylex' with the right arguments.  */
3653
3654 #ifdef YYLEX_PARAM
3655 # define YYLEX yylex (YYLEX_PARAM)
3656 #else
3657 # define YYLEX yylex ()
3658 #endif
3659
3660 /* Enable debugging if requested.  */
3661 #if YYDEBUG
3662
3663 # ifndef YYFPRINTF
3664 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
3665 #  define YYFPRINTF fprintf
3666 # endif
3667
3668 # define YYDPRINTF(Args)                        \
3669 do {                                            \
3670   if (yydebug)                                  \
3671     YYFPRINTF Args;                             \
3672 } while (YYID (0))
3673
3674 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
3675 do {                                                                      \
3676   if (yydebug)                                                            \
3677     {                                                                     \
3678       YYFPRINTF (stderr, "%s ", Title);                                   \
3679       yy_symbol_print (stderr,                                            \
3680                   Type, Value); \
3681       YYFPRINTF (stderr, "\n");                                           \
3682     }                                                                     \
3683 } while (YYID (0))
3684
3685
3686 /*--------------------------------.
3687 | Print this symbol on YYOUTPUT.  |
3688 `--------------------------------*/
3689
3690 /*ARGSUSED*/
3691 #if (defined __STDC__ || defined __C99__FUNC__ \
3692      || defined __cplusplus || defined _MSC_VER)
3693 static void
3694 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3695 #else
3696 static void
3697 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
3698     FILE *yyoutput;
3699     int yytype;
3700     YYSTYPE const * const yyvaluep;
3701 #endif
3702 {
3703   if (!yyvaluep)
3704     return;
3705 # ifdef YYPRINT
3706   if (yytype < YYNTOKENS)
3707     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
3708 # else
3709   YYUSE (yyoutput);
3710 # endif
3711   switch (yytype)
3712     {
3713       default:
3714         break;
3715     }
3716 }
3717
3718
3719 /*--------------------------------.
3720 | Print this symbol on YYOUTPUT.  |
3721 `--------------------------------*/
3722
3723 #if (defined __STDC__ || defined __C99__FUNC__ \
3724      || defined __cplusplus || defined _MSC_VER)
3725 static void
3726 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3727 #else
3728 static void
3729 yy_symbol_print (yyoutput, yytype, yyvaluep)
3730     FILE *yyoutput;
3731     int yytype;
3732     YYSTYPE const * const yyvaluep;
3733 #endif
3734 {
3735   if (yytype < YYNTOKENS)
3736     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3737   else
3738     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
3739
3740   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3741   YYFPRINTF (yyoutput, ")");
3742 }
3743
3744 /*------------------------------------------------------------------.
3745 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
3746 | TOP (included).                                                   |
3747 `------------------------------------------------------------------*/
3748
3749 #if (defined __STDC__ || defined __C99__FUNC__ \
3750      || defined __cplusplus || defined _MSC_VER)
3751 static void
3752 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
3753 #else
3754 static void
3755 yy_stack_print (yybottom, yytop)
3756     yytype_int16 *yybottom;
3757     yytype_int16 *yytop;
3758 #endif
3759 {
3760   YYFPRINTF (stderr, "Stack now");
3761   for (; yybottom <= yytop; yybottom++)
3762     {
3763       int yybot = *yybottom;
3764       YYFPRINTF (stderr, " %d", yybot);
3765     }
3766   YYFPRINTF (stderr, "\n");
3767 }
3768
3769 # define YY_STACK_PRINT(Bottom, Top)                            \
3770 do {                                                            \
3771   if (yydebug)                                                  \
3772     yy_stack_print ((Bottom), (Top));                           \
3773 } while (YYID (0))
3774
3775
3776 /*------------------------------------------------.
3777 | Report that the YYRULE is going to be reduced.  |
3778 `------------------------------------------------*/
3779
3780 #if (defined __STDC__ || defined __C99__FUNC__ \
3781      || defined __cplusplus || defined _MSC_VER)
3782 static void
3783 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3784 #else
3785 static void
3786 yy_reduce_print (yyvsp, yyrule)
3787     YYSTYPE *yyvsp;
3788     int yyrule;
3789 #endif
3790 {
3791   int yynrhs = yyr2[yyrule];
3792   int yyi;
3793   unsigned long int yylno = yyrline[yyrule];
3794   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3795              yyrule - 1, yylno);
3796   /* The symbols being reduced.  */
3797   for (yyi = 0; yyi < yynrhs; yyi++)
3798     {
3799       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
3800       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3801                        &(yyvsp[(yyi + 1) - (yynrhs)])
3802                                        );
3803       YYFPRINTF (stderr, "\n");
3804     }
3805 }
3806
3807 # define YY_REDUCE_PRINT(Rule)          \
3808 do {                                    \
3809   if (yydebug)                          \
3810     yy_reduce_print (yyvsp, Rule); \
3811 } while (YYID (0))
3812
3813 /* Nonzero means print parse trace.  It is left uninitialized so that
3814    multiple parsers can coexist.  */
3815 int yydebug;
3816 #else /* !YYDEBUG */
3817 # define YYDPRINTF(Args)
3818 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3819 # define YY_STACK_PRINT(Bottom, Top)
3820 # define YY_REDUCE_PRINT(Rule)
3821 #endif /* !YYDEBUG */
3822
3823
3824 /* YYINITDEPTH -- initial size of the parser's stacks.  */
3825 #ifndef YYINITDEPTH
3826 # define YYINITDEPTH 200
3827 #endif
3828
3829 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3830    if the built-in stack extension method is used).
3831
3832    Do not make this value too large; the results are undefined if
3833    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3834    evaluated with infinite-precision integer arithmetic.  */
3835
3836 #ifndef YYMAXDEPTH
3837 # define YYMAXDEPTH 10000
3838 #endif
3839
3840 \f
3841
3842 #if YYERROR_VERBOSE
3843
3844 # ifndef yystrlen
3845 #  if defined __GLIBC__ && defined _STRING_H
3846 #   define yystrlen strlen
3847 #  else
3848 /* Return the length of YYSTR.  */
3849 #if (defined __STDC__ || defined __C99__FUNC__ \
3850      || defined __cplusplus || defined _MSC_VER)
3851 static YYSIZE_T
3852 yystrlen (const char *yystr)
3853 #else
3854 static YYSIZE_T
3855 yystrlen (yystr)
3856     const char *yystr;
3857 #endif
3858 {
3859   YYSIZE_T yylen;
3860   for (yylen = 0; yystr[yylen]; yylen++)
3861     continue;
3862   return yylen;
3863 }
3864 #  endif
3865 # endif
3866
3867 # ifndef yystpcpy
3868 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3869 #   define yystpcpy stpcpy
3870 #  else
3871 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3872    YYDEST.  */
3873 #if (defined __STDC__ || defined __C99__FUNC__ \
3874      || defined __cplusplus || defined _MSC_VER)
3875 static char *
3876 yystpcpy (char *yydest, const char *yysrc)
3877 #else
3878 static char *
3879 yystpcpy (yydest, yysrc)
3880     char *yydest;
3881     const char *yysrc;
3882 #endif
3883 {
3884   char *yyd = yydest;
3885   const char *yys = yysrc;
3886
3887   while ((*yyd++ = *yys++) != '\0')
3888     continue;
3889
3890   return yyd - 1;
3891 }
3892 #  endif
3893 # endif
3894
3895 # ifndef yytnamerr
3896 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3897    quotes and backslashes, so that it's suitable for yyerror.  The
3898    heuristic is that double-quoting is unnecessary unless the string
3899    contains an apostrophe, a comma, or backslash (other than
3900    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
3901    null, do not copy; instead, return the length of what the result
3902    would have been.  */
3903 static YYSIZE_T
3904 yytnamerr (char *yyres, const char *yystr)
3905 {
3906   if (*yystr == '"')
3907     {
3908       YYSIZE_T yyn = 0;
3909       char const *yyp = yystr;
3910
3911       for (;;)
3912         switch (*++yyp)
3913           {
3914           case '\'':
3915           case ',':
3916             goto do_not_strip_quotes;
3917
3918           case '\\':
3919             if (*++yyp != '\\')
3920               goto do_not_strip_quotes;
3921             /* Fall through.  */
3922           default:
3923             if (yyres)
3924               yyres[yyn] = *yyp;
3925             yyn++;
3926             break;
3927
3928           case '"':
3929             if (yyres)
3930               yyres[yyn] = '\0';
3931             return yyn;
3932           }
3933     do_not_strip_quotes: ;
3934     }
3935
3936   if (! yyres)
3937     return yystrlen (yystr);
3938
3939   return yystpcpy (yyres, yystr) - yyres;
3940 }
3941 # endif
3942
3943 /* Copy into YYRESULT an error message about the unexpected token
3944    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
3945    including the terminating null byte.  If YYRESULT is null, do not
3946    copy anything; just return the number of bytes that would be
3947    copied.  As a special case, return 0 if an ordinary "syntax error"
3948    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
3949    size calculation.  */
3950 static YYSIZE_T
3951 yysyntax_error (char *yyresult, int yystate, int yychar)
3952 {
3953   int yyn = yypact[yystate];
3954
3955   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3956     return 0;
3957   else
3958     {
3959       int yytype = YYTRANSLATE (yychar);
3960       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3961       YYSIZE_T yysize = yysize0;
3962       YYSIZE_T yysize1;
3963       int yysize_overflow = 0;
3964       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3965       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3966       int yyx;
3967
3968 # if 0
3969       /* This is so xgettext sees the translatable formats that are
3970          constructed on the fly.  */
3971       YY_("syntax error, unexpected %s");
3972       YY_("syntax error, unexpected %s, expecting %s");
3973       YY_("syntax error, unexpected %s, expecting %s or %s");
3974       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3975       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3976 # endif
3977       char *yyfmt;
3978       char const *yyf;
3979       static char const yyunexpected[] = "syntax error, unexpected %s";
3980       static char const yyexpecting[] = ", expecting %s";
3981       static char const yyor[] = " or %s";
3982       char yyformat[sizeof yyunexpected
3983                     + sizeof yyexpecting - 1
3984                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3985                        * (sizeof yyor - 1))];
3986       char const *yyprefix = yyexpecting;
3987
3988       /* Start YYX at -YYN if negative to avoid negative indexes in
3989          YYCHECK.  */
3990       int yyxbegin = yyn < 0 ? -yyn : 0;
3991
3992       /* Stay within bounds of both yycheck and yytname.  */
3993       int yychecklim = YYLAST - yyn + 1;
3994       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3995       int yycount = 1;
3996
3997       yyarg[0] = yytname[yytype];
3998       yyfmt = yystpcpy (yyformat, yyunexpected);
3999
4000       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4001         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4002           {
4003             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4004               {
4005                 yycount = 1;
4006                 yysize = yysize0;
4007                 yyformat[sizeof yyunexpected - 1] = '\0';
4008                 break;
4009               }
4010             yyarg[yycount++] = yytname[yyx];
4011             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
4012             yysize_overflow |= (yysize1 < yysize);
4013             yysize = yysize1;
4014             yyfmt = yystpcpy (yyfmt, yyprefix);
4015             yyprefix = yyor;
4016           }
4017
4018       yyf = YY_(yyformat);
4019       yysize1 = yysize + yystrlen (yyf);
4020       yysize_overflow |= (yysize1 < yysize);
4021       yysize = yysize1;
4022
4023       if (yysize_overflow)
4024         return YYSIZE_MAXIMUM;
4025
4026       if (yyresult)
4027         {
4028           /* Avoid sprintf, as that infringes on the user's name space.
4029              Don't have undefined behavior even if the translation
4030              produced a string with the wrong number of "%s"s.  */
4031           char *yyp = yyresult;
4032           int yyi = 0;
4033           while ((*yyp = *yyf) != '\0')
4034             {
4035               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
4036                 {
4037                   yyp += yytnamerr (yyp, yyarg[yyi++]);
4038                   yyf += 2;
4039                 }
4040               else
4041                 {
4042                   yyp++;
4043                   yyf++;
4044                 }
4045             }
4046         }
4047       return yysize;
4048     }
4049 }
4050 #endif /* YYERROR_VERBOSE */
4051 \f
4052
4053 /*-----------------------------------------------.
4054 | Release the memory associated to this symbol.  |
4055 `-----------------------------------------------*/
4056
4057 /*ARGSUSED*/
4058 #if (defined __STDC__ || defined __C99__FUNC__ \
4059      || defined __cplusplus || defined _MSC_VER)
4060 static void
4061 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
4062 #else
4063 static void
4064 yydestruct (yymsg, yytype, yyvaluep)
4065     const char *yymsg;
4066     int yytype;
4067     YYSTYPE *yyvaluep;
4068 #endif
4069 {
4070   YYUSE (yyvaluep);
4071
4072   if (!yymsg)
4073     yymsg = "Deleting";
4074   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
4075
4076   switch (yytype)
4077     {
4078
4079       default:
4080         break;
4081     }
4082 }
4083
4084 /* Prevent warnings from -Wmissing-prototypes.  */
4085 #ifdef YYPARSE_PARAM
4086 #if defined __STDC__ || defined __cplusplus
4087 int yyparse (void *YYPARSE_PARAM);
4088 #else
4089 int yyparse ();
4090 #endif
4091 #else /* ! YYPARSE_PARAM */
4092 #if defined __STDC__ || defined __cplusplus
4093 int yyparse (void);
4094 #else
4095 int yyparse ();
4096 #endif
4097 #endif /* ! YYPARSE_PARAM */
4098
4099
4100 /* The lookahead symbol.  */
4101 int yychar;
4102
4103 /* The semantic value of the lookahead symbol.  */
4104 YYSTYPE yylval;
4105
4106 /* Number of syntax errors so far.  */
4107 int yynerrs;
4108
4109
4110
4111 /*-------------------------.
4112 | yyparse or yypush_parse.  |
4113 `-------------------------*/
4114
4115 #ifdef YYPARSE_PARAM
4116 #if (defined __STDC__ || defined __C99__FUNC__ \
4117      || defined __cplusplus || defined _MSC_VER)
4118 int
4119 yyparse (void *YYPARSE_PARAM)
4120 #else
4121 int
4122 yyparse (YYPARSE_PARAM)
4123     void *YYPARSE_PARAM;
4124 #endif
4125 #else /* ! YYPARSE_PARAM */
4126 #if (defined __STDC__ || defined __C99__FUNC__ \
4127      || defined __cplusplus || defined _MSC_VER)
4128 int
4129 yyparse (void)
4130 #else
4131 int
4132 yyparse ()
4133
4134 #endif
4135 #endif
4136 {
4137
4138
4139     int yystate;
4140     /* Number of tokens to shift before error messages enabled.  */
4141     int yyerrstatus;
4142
4143     /* The stacks and their tools:
4144        `yyss': related to states.
4145        `yyvs': related to semantic values.
4146
4147        Refer to the stacks thru separate pointers, to allow yyoverflow
4148        to reallocate them elsewhere.  */
4149
4150     /* The state stack.  */
4151     yytype_int16 yyssa[YYINITDEPTH];
4152     yytype_int16 *yyss;
4153     yytype_int16 *yyssp;
4154
4155     /* The semantic value stack.  */
4156     YYSTYPE yyvsa[YYINITDEPTH];
4157     YYSTYPE *yyvs;
4158     YYSTYPE *yyvsp;
4159
4160     YYSIZE_T yystacksize;
4161
4162   int yyn;
4163   int yyresult;
4164   /* Lookahead token as an internal (translated) token number.  */
4165   int yytoken;
4166   /* The variables used to return semantic value and location from the
4167      action routines.  */
4168   YYSTYPE yyval;
4169
4170 #if YYERROR_VERBOSE
4171   /* Buffer for error messages, and its allocated size.  */
4172   char yymsgbuf[128];
4173   char *yymsg = yymsgbuf;
4174   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
4175 #endif
4176
4177 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
4178
4179   /* The number of symbols on the RHS of the reduced rule.
4180      Keep to zero when no symbol should be popped.  */
4181   int yylen = 0;
4182
4183   yytoken = 0;
4184   yyss = yyssa;
4185   yyvs = yyvsa;
4186   yystacksize = YYINITDEPTH;
4187
4188   YYDPRINTF ((stderr, "Starting parse\n"));
4189
4190   yystate = 0;
4191   yyerrstatus = 0;
4192   yynerrs = 0;
4193   yychar = YYEMPTY; /* Cause a token to be read.  */
4194
4195   /* Initialize stack pointers.
4196      Waste one element of value and location stack
4197      so that they stay on the same level as the state stack.
4198      The wasted elements are never initialized.  */
4199   yyssp = yyss;
4200   yyvsp = yyvs;
4201
4202   goto yysetstate;
4203
4204 /*------------------------------------------------------------.
4205 | yynewstate -- Push a new state, which is found in yystate.  |
4206 `------------------------------------------------------------*/
4207  yynewstate:
4208   /* In all cases, when you get here, the value and location stacks
4209      have just been pushed.  So pushing a state here evens the stacks.  */
4210   yyssp++;
4211
4212  yysetstate:
4213   *yyssp = yystate;
4214
4215   if (yyss + yystacksize - 1 <= yyssp)
4216     {
4217       /* Get the current used size of the three stacks, in elements.  */
4218       YYSIZE_T yysize = yyssp - yyss + 1;
4219
4220 #ifdef yyoverflow
4221       {
4222         /* Give user a chance to reallocate the stack.  Use copies of
4223            these so that the &'s don't force the real ones into
4224            memory.  */
4225         YYSTYPE *yyvs1 = yyvs;
4226         yytype_int16 *yyss1 = yyss;
4227
4228         /* Each stack pointer address is followed by the size of the
4229            data in use in that stack, in bytes.  This used to be a
4230            conditional around just the two extra args, but that might
4231            be undefined if yyoverflow is a macro.  */
4232         yyoverflow (YY_("memory exhausted"),
4233                     &yyss1, yysize * sizeof (*yyssp),
4234                     &yyvs1, yysize * sizeof (*yyvsp),
4235                     &yystacksize);
4236
4237         yyss = yyss1;
4238         yyvs = yyvs1;
4239       }
4240 #else /* no yyoverflow */
4241 # ifndef YYSTACK_RELOCATE
4242       goto yyexhaustedlab;
4243 # else
4244       /* Extend the stack our own way.  */
4245       if (YYMAXDEPTH <= yystacksize)
4246         goto yyexhaustedlab;
4247       yystacksize *= 2;
4248       if (YYMAXDEPTH < yystacksize)
4249         yystacksize = YYMAXDEPTH;
4250
4251       {
4252         yytype_int16 *yyss1 = yyss;
4253         union yyalloc *yyptr =
4254           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
4255         if (! yyptr)
4256           goto yyexhaustedlab;
4257         YYSTACK_RELOCATE (yyss_alloc, yyss);
4258         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
4259 #  undef YYSTACK_RELOCATE
4260         if (yyss1 != yyssa)
4261           YYSTACK_FREE (yyss1);
4262       }
4263 # endif
4264 #endif /* no yyoverflow */
4265
4266       yyssp = yyss + yysize - 1;
4267       yyvsp = yyvs + yysize - 1;
4268
4269       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
4270                   (unsigned long int) yystacksize));
4271
4272       if (yyss + yystacksize - 1 <= yyssp)
4273         YYABORT;
4274     }
4275
4276   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
4277
4278   if (yystate == YYFINAL)
4279     YYACCEPT;
4280
4281   goto yybackup;
4282
4283 /*-----------.
4284 | yybackup.  |
4285 `-----------*/
4286 yybackup:
4287
4288   /* Do appropriate processing given the current state.  Read a
4289      lookahead token if we need one and don't already have one.  */
4290
4291   /* First try to decide what to do without reference to lookahead token.  */
4292   yyn = yypact[yystate];
4293   if (yyn == YYPACT_NINF)
4294     goto yydefault;
4295
4296   /* Not known => get a lookahead token if don't already have one.  */
4297
4298   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
4299   if (yychar == YYEMPTY)
4300     {
4301       YYDPRINTF ((stderr, "Reading a token: "));
4302       yychar = YYLEX;
4303     }
4304
4305   if (yychar <= YYEOF)
4306     {
4307       yychar = yytoken = YYEOF;
4308       YYDPRINTF ((stderr, "Now at end of input.\n"));
4309     }
4310   else
4311     {
4312       yytoken = YYTRANSLATE (yychar);
4313       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
4314     }
4315
4316   /* If the proper action on seeing token YYTOKEN is to reduce or to
4317      detect an error, take that action.  */
4318   yyn += yytoken;
4319   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
4320     goto yydefault;
4321   yyn = yytable[yyn];
4322   if (yyn <= 0)
4323     {
4324       if (yyn == 0 || yyn == YYTABLE_NINF)
4325         goto yyerrlab;
4326       yyn = -yyn;
4327       goto yyreduce;
4328     }
4329
4330   /* Count tokens shifted since error; after three, turn off error
4331      status.  */
4332   if (yyerrstatus)
4333     yyerrstatus--;
4334
4335   /* Shift the lookahead token.  */
4336   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
4337
4338   /* Discard the shifted token.  */
4339   yychar = YYEMPTY;
4340
4341   yystate = yyn;
4342   *++yyvsp = yylval;
4343
4344   goto yynewstate;
4345
4346
4347 /*-----------------------------------------------------------.
4348 | yydefault -- do the default action for the current state.  |
4349 `-----------------------------------------------------------*/
4350 yydefault:
4351   yyn = yydefact[yystate];
4352   if (yyn == 0)
4353     goto yyerrlab;
4354   goto yyreduce;
4355
4356
4357 /*-----------------------------.
4358 | yyreduce -- Do a reduction.  |
4359 `-----------------------------*/
4360 yyreduce:
4361   /* yyn is the number of a rule to reduce with.  */
4362   yylen = yyr2[yyn];
4363
4364   /* If YYLEN is nonzero, implement the default value of the action:
4365      `$$ = $1'.
4366
4367      Otherwise, the following line sets YYVAL to garbage.
4368      This behavior is undocumented and Bison
4369      users should not rely upon it.  Assigning to YYVAL
4370      unconditionally makes the parser a bit smaller, and it avoids a
4371      GCC warning that YYVAL may be used uninitialized.  */
4372   yyval = yyvsp[1-yylen];
4373
4374
4375   YY_REDUCE_PRINT (yyn);
4376   switch (yyn)
4377     {
4378         
4379     case 26:
4380     if(as3_pass==2) {
4381
4382 /* Line 1464 of skeleton.m4  */
4383 #line 2151 "parser.y"
4384     {(yyval.code)=(yyvsp[(1) - (1)].code);}
4385     }
4386     break;
4387
4388
4389   
4390     case 27:
4391     if(as3_pass==2) {
4392
4393 /* Line 1464 of skeleton.m4  */
4394 #line 2152 "parser.y"
4395     {(yyval.code)=code_new();}
4396     }
4397     break;
4398
4399
4400   
4401     case 28:
4402     if(as3_pass==2) {
4403
4404 /* Line 1464 of skeleton.m4  */
4405 #line 2154 "parser.y"
4406     {(yyval.code)=code_append((yyvsp[(1) - (2)].code),(yyvsp[(2) - (2)].code));}
4407     }
4408     break;
4409
4410
4411   
4412     case 29:
4413     if(as3_pass==2) {
4414
4415 /* Line 1464 of skeleton.m4  */
4416 #line 2155 "parser.y"
4417     {(yyval.code)=(yyvsp[(1) - (1)].code);}
4418     }
4419     break;
4420
4421
4422   
4423     case 42:
4424     if(as3_pass==2) {
4425
4426 /* Line 1464 of skeleton.m4  */
4427 #line 2170 "parser.y"
4428     {(yyval.code)=(yyvsp[(2) - (3)].code);}
4429     }
4430     break;
4431
4432
4433   
4434     case 43:
4435     if(as3_pass==2) {
4436
4437 /* Line 1464 of skeleton.m4  */
4438 #line 2171 "parser.y"
4439     {(yyval.code)=0;}
4440     }
4441     break;
4442
4443
4444   
4445     case 44:
4446     if(as3_pass==2) {
4447
4448 /* Line 1464 of skeleton.m4  */
4449 #line 2174 "parser.y"
4450     {(yyval.code)=0;}
4451     }
4452     break;
4453
4454
4455   
4456     case 51:
4457     if(as3_pass==2) {
4458
4459 /* Line 1464 of skeleton.m4  */
4460 #line 2181 "parser.y"
4461     {(yyval.code)=(yyvsp[(3) - (4)].code);}
4462     }
4463     break;
4464
4465
4466   
4467     case 52:
4468     if(as3_pass==2) {
4469
4470 /* Line 1464 of skeleton.m4  */
4471 #line 2185 "parser.y"
4472     {(yyval.code)=(yyvsp[(1) - (2)].code);}
4473     }
4474     break;
4475
4476
4477   
4478     case 53:
4479     if(as3_pass==2) {
4480
4481 /* Line 1464 of skeleton.m4  */
4482 #line 2186 "parser.y"
4483     {(yyval.code)=(yyvsp[(1) - (1)].code);}
4484     }
4485     break;
4486
4487
4488   
4489     case 54:
4490     if(as3_pass==2) {
4491
4492 /* Line 1464 of skeleton.m4  */
4493 #line 2190 "parser.y"
4494     {
4495     code_t**cc = &global->init->method->body->code;
4496     *cc = code_append(*cc, (yyvsp[(1) - (1)].code));
4497 }
4498     }
4499     break;
4500
4501
4502   
4503     case 56:
4504     if(as3_pass==2) {
4505
4506 /* Line 1464 of skeleton.m4  */
4507 #line 2201 "parser.y"
4508     {(yyval.value)=(yyvsp[(2) - (2)].value);}
4509     }
4510     break;
4511
4512
4513   
4514     case 57:
4515     if(as3_pass==2) {
4516
4517 /* Line 1464 of skeleton.m4  */
4518 #line 2202 "parser.y"
4519     {(yyval.value).c=abc_pushundefined(0);
4520                                   (yyval.value).t=TYPE_ANY;
4521                                  }
4522     }
4523     break;
4524
4525
4526   
4527     case 58:
4528     if(as3_pass==2) {
4529
4530 /* Line 1464 of skeleton.m4  */
4531 #line 2206 "parser.y"
4532     {(yyval.code)=(yyvsp[(2) - (2)].code);}
4533     }
4534     break;
4535
4536
4537   
4538     case 59:
4539     if(as3_pass==2) {
4540
4541 /* Line 1464 of skeleton.m4  */
4542 #line 2207 "parser.y"
4543     {(yyval.code)=(yyvsp[(2) - (2)].code);}
4544     }
4545     break;
4546
4547
4548   
4549     case 60:
4550     if(as3_pass==2) {
4551
4552 /* Line 1464 of skeleton.m4  */
4553 #line 2209 "parser.y"
4554     {(yyval.code) = (yyvsp[(1) - (1)].code);}
4555     }
4556     break;
4557
4558
4559   
4560     case 61:
4561     if(as3_pass==2) {
4562
4563 /* Line 1464 of skeleton.m4  */
4564 #line 2210 "parser.y"
4565     {(yyval.code) = code_append((yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));}
4566     }
4567     break;
4568
4569
4570   
4571     case 62:
4572     if(as3_pass==2) {
4573
4574 /* Line 1464 of skeleton.m4  */
4575 #line 2213 "parser.y"
4576     {
4577 PASS12
4578     if(variable_exists((yyvsp[(1) - (3)].id)))
4579         syntaxerror("Variable %s already defined", (yyvsp[(1) - (3)].id));
4580 PASS1
4581     new_variable((yyvsp[(1) - (3)].id), 0, 1, 0);
4582 PASS2
4583    
4584     if(!is_subtype_of((yyvsp[(3) - (3)].value).t, (yyvsp[(2) - (3)].classinfo))) {
4585         syntaxerror("Can't convert %s to %s", (yyvsp[(3) - (3)].value).t->name, 
4586                                               (yyvsp[(2) - (3)].classinfo)->name);
4587     }
4588
4589     char slot = 0;
4590     int index = 0;
4591     if(state->method->uses_slots) {
4592         variable_t* v = find_slot(state, (yyvsp[(1) - (3)].id));
4593         if(v && !v->init) {
4594             // this variable is stored in a slot
4595             v->init = 1;
4596             v->type = (yyvsp[(2) - (3)].classinfo);
4597             slot = 1;
4598             index = v->index;
4599         }
4600     }
4601     if(!index) {
4602         index = new_variable((yyvsp[(1) - (3)].id), (yyvsp[(2) - (3)].classinfo), 1, 0);
4603     }
4604
4605     (yyval.code) = slot?abc_getscopeobject(0, 1):0;
4606     
4607     if((yyvsp[(2) - (3)].classinfo)) {
4608         if((yyvsp[(3) - (3)].value).c->prev || (yyvsp[(3) - (3)].value).c->opcode != OPCODE_PUSHUNDEFINED) {
4609             (yyval.code) = code_append((yyval.code), (yyvsp[(3) - (3)].value).c);
4610             (yyval.code) = converttype((yyval.code), (yyvsp[(3) - (3)].value).t, (yyvsp[(2) - (3)].classinfo));
4611         } else {
4612             code_free((yyvsp[(3) - (3)].value).c);
4613             (yyval.code) = defaultvalue((yyval.code), (yyvsp[(2) - (3)].classinfo));
4614         }
4615     } else {
4616         if((yyvsp[(3) - (3)].value).c->prev || (yyvsp[(3) - (3)].value).c->opcode != OPCODE_PUSHUNDEFINED) {
4617             (yyval.code) = code_append((yyval.code), (yyvsp[(3) - (3)].value).c);
4618             (yyval.code) = abc_coerce_a((yyval.code));
4619         } else {
4620             // don't do anything
4621             code_free((yyvsp[(3) - (3)].value).c);
4622             code_free((yyval.code));
4623             (yyval.code) = 0;
4624             break;
4625         }
4626     }
4627     if(slot) {
4628         (yyval.code) = abc_setslot((yyval.code), index);
4629     } else {
4630         (yyval.code) = abc_setlocal((yyval.code), index);
4631     }
4632 }
4633     }
4634     break;
4635
4636
4637   
4638     case 63:
4639     if(as3_pass==2) {
4640
4641 /* Line 1464 of skeleton.m4  */
4642 #line 2273 "parser.y"
4643     {(yyval.code) = code_new();}
4644     }
4645     break;
4646
4647
4648   
4649     case 64:
4650     if(as3_pass==2) {
4651
4652 /* Line 1464 of skeleton.m4  */
4653 #line 2274 "parser.y"
4654     {(yyval.code)=(yyvsp[(2) - (2)].code);}
4655     }
4656     break;
4657
4658
4659   
4660     case 65:
4661     if(as3_pass==2) {
4662
4663 /* Line 1464 of skeleton.m4  */
4664 #line 2277 "parser.y"
4665     {PASS12 new_state();}
4666     }
4667     break;
4668
4669
4670   
4671     case 66:
4672     if(as3_pass==2) {
4673
4674 /* Line 1464 of skeleton.m4  */
4675 #line 2277 "parser.y"
4676     {
4677      
4678     (yyval.code) = code_new();
4679     (yyval.code) = code_append((yyval.code), (yyvsp[(4) - (7)].value).c);
4680     code_t*myjmp,*myif = (yyval.code) = abc_iffalse((yyval.code), 0);
4681    
4682     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (7)].code));
4683     if((yyvsp[(7) - (7)].code)) {
4684         myjmp = (yyval.code) = abc_jump((yyval.code), 0);
4685     }
4686     myif->branch = (yyval.code) = abc_nop((yyval.code));
4687     if((yyvsp[(7) - (7)].code)) {
4688         (yyval.code) = code_append((yyval.code), (yyvsp[(7) - (7)].code));
4689         myjmp->branch = (yyval.code) = abc_nop((yyval.code));
4690     }
4691     (yyval.code) = var_block((yyval.code));
4692     PASS12 old_state();
4693 }
4694     }
4695     break;
4696
4697
4698   
4699     case 67:
4700     if(as3_pass==2) {
4701
4702 /* Line 1464 of skeleton.m4  */
4703 #line 2296 "parser.y"
4704     {(yyval.code)=code_new();}
4705     }
4706     break;
4707
4708
4709   
4710     case 70:
4711     if(as3_pass==2) {
4712
4713 /* Line 1464 of skeleton.m4  */
4714 #line 2303 "parser.y"
4715     {
4716     PASS1 (yyval.id)=(yyvsp[(2) - (3)].id);new_variable((yyvsp[(2) - (3)].id),0,1,0);
4717     PASS2 (yyval.id)=(yyvsp[(2) - (3)].id);new_variable((yyvsp[(2) - (3)].id),(yyvsp[(3) - (3)].classinfo),1,0);
4718 }
4719     }
4720     break;
4721
4722
4723   
4724     case 71:
4725     if(as3_pass==2) {
4726
4727 /* Line 1464 of skeleton.m4  */
4728 #line 2307 "parser.y"
4729     {
4730     PASS12
4731     (yyval.id)=(yyvsp[(1) - (1)].id);
4732 }
4733     }
4734     break;
4735
4736
4737   
4738     case 72:
4739     if(as3_pass==2) {
4740
4741 /* Line 1464 of skeleton.m4  */
4742 #line 2312 "parser.y"
4743     {PASS12 new_state();(yyval.for_start).name=(yyvsp[(1) - (2)].id);(yyval.for_start).each=0;}
4744     }
4745     break;
4746
4747
4748   
4749     case 73:
4750     if(as3_pass==2) {
4751
4752 /* Line 1464 of skeleton.m4  */
4753 #line 2313 "parser.y"
4754     {PASS12 new_state();(yyval.for_start).name=(yyvsp[(1) - (3)].id);(yyval.for_start).each=1;}
4755     }
4756     break;
4757
4758
4759   
4760     case 74:
4761     if(as3_pass==2) {
4762
4763 /* Line 1464 of skeleton.m4  */
4764 #line 2315 "parser.y"
4765     {
4766     if((yyvsp[(1) - (8)].for_start).each) syntaxerror("invalid syntax: ; not allowed in for each statement");
4767     (yyval.code) = code_new();
4768     (yyval.code) = code_append((yyval.code), (yyvsp[(2) - (8)].code));
4769     code_t*loopstart = (yyval.code) = abc_label((yyval.code));
4770     (yyval.code) = code_append((yyval.code), (yyvsp[(4) - (8)].value).c);
4771     code_t*myif = (yyval.code) = abc_iffalse((yyval.code), 0);
4772     (yyval.code) = code_append((yyval.code), (yyvsp[(8) - (8)].code));
4773     code_t*cont = (yyval.code) = abc_nop((yyval.code));
4774     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (8)].code));
4775     (yyval.code) = abc_jump((yyval.code), loopstart);
4776     code_t*out = (yyval.code) = abc_nop((yyval.code));
4777     breakjumpsto((yyval.code), (yyvsp[(1) - (8)].for_start).name, out);
4778     continuejumpsto((yyval.code), (yyvsp[(1) - (8)].for_start).name, cont);
4779     myif->branch = out;
4780
4781     (yyval.code) = var_block((yyval.code));
4782     PASS12 old_state();
4783 }
4784     }
4785     break;
4786
4787
4788   
4789     case 75:
4790     if(as3_pass==2) {
4791
4792 /* Line 1464 of skeleton.m4  */
4793 #line 2335 "parser.y"
4794     {
4795     variable_t*var = find_variable(state, (yyvsp[(2) - (6)].id));
4796     if(!var) {
4797         syntaxerror("variable %s not known in this scope", (yyvsp[(2) - (6)].id));
4798     }
4799
4800     char*tmp1name = concat2((yyvsp[(2) - (6)].id), "__tmp1__");
4801     int it = new_variable(tmp1name, TYPE_INT, 0, 0);
4802     char*tmp2name = concat2((yyvsp[(2) - (6)].id), "__array__");
4803     int array = new_variable(tmp1name, 0, 0, 0);
4804
4805     (yyval.code) = code_new();
4806     (yyval.code) = code_append((yyval.code), (yyvsp[(4) - (6)].value).c);
4807     (yyval.code) = abc_coerce_a((yyval.code));
4808     (yyval.code) = abc_setlocal((yyval.code), array);
4809     (yyval.code) = abc_pushbyte((yyval.code), 0);
4810     (yyval.code) = abc_setlocal((yyval.code), it);
4811
4812     code_t*loopstart = (yyval.code) = abc_label((yyval.code));
4813     
4814     (yyval.code) = abc_hasnext2((yyval.code), array, it);
4815     code_t*myif = (yyval.code) = abc_iffalse((yyval.code), 0);
4816     (yyval.code) = abc_getlocal((yyval.code), array);
4817     (yyval.code) = abc_getlocal((yyval.code), it);
4818     if(!(yyvsp[(1) - (6)].for_start).each)
4819         (yyval.code) = abc_nextname((yyval.code));
4820     else
4821         (yyval.code) = abc_nextvalue((yyval.code));
4822     (yyval.code) = converttype((yyval.code), 0, var->type);
4823     (yyval.code) = abc_setlocal((yyval.code), var->index);
4824
4825     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (6)].code));
4826     (yyval.code) = abc_jump((yyval.code), loopstart);
4827     
4828     code_t*out = (yyval.code) = abc_nop((yyval.code));
4829     breakjumpsto((yyval.code), (yyvsp[(1) - (6)].for_start).name, out);
4830     continuejumpsto((yyval.code), (yyvsp[(1) - (6)].for_start).name, loopstart);
4831     
4832     myif->branch = out;
4833
4834     (yyval.code) = var_block((yyval.code));
4835
4836     free(tmp1name);
4837     free(tmp2name);
4838
4839     PASS12 old_state();
4840 }
4841     }
4842     break;
4843
4844
4845   
4846     case 76:
4847     if(as3_pass==2) {
4848
4849 /* Line 1464 of skeleton.m4  */
4850 #line 2383 "parser.y"
4851     {PASS12 new_state();}
4852     }
4853     break;
4854
4855
4856   
4857     case 77:
4858     if(as3_pass==2) {
4859
4860 /* Line 1464 of skeleton.m4  */
4861 #line 2383 "parser.y"
4862     {
4863
4864     (yyval.code) = code_new();
4865
4866     code_t*myjmp = (yyval.code) = abc_jump((yyval.code), 0);
4867     code_t*loopstart = (yyval.code) = abc_label((yyval.code));
4868     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (6)].code));
4869     code_t*cont = (yyval.code) = abc_nop((yyval.code));
4870     myjmp->branch = cont;
4871     (yyval.code) = code_append((yyval.code), (yyvsp[(4) - (6)].value).c);
4872     (yyval.code) = abc_iftrue((yyval.code), loopstart);
4873     code_t*out = (yyval.code) = abc_nop((yyval.code));
4874     breakjumpsto((yyval.code), (yyvsp[(1) - (6)].id), out);
4875     continuejumpsto((yyval.code), (yyvsp[(1) - (6)].id), cont);
4876
4877     (yyval.code) = var_block((yyval.code));
4878     PASS12 old_state();
4879 }
4880     }
4881     break;
4882
4883
4884   
4885     case 78:
4886     if(as3_pass==2) {
4887
4888 /* Line 1464 of skeleton.m4  */
4889 #line 2402 "parser.y"
4890     {PASS12 new_state();}
4891     }
4892     break;
4893
4894
4895   
4896     case 79:
4897     if(as3_pass==2) {
4898
4899 /* Line 1464 of skeleton.m4  */
4900 #line 2402 "parser.y"
4901     {
4902     (yyval.code) = code_new();
4903     code_t*loopstart = (yyval.code) = abc_label((yyval.code));
4904     (yyval.code) = code_append((yyval.code), (yyvsp[(3) - (7)].code));
4905     code_t*cont = (yyval.code) = abc_nop((yyval.code));
4906     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (7)].value).c);
4907     (yyval.code) = abc_iftrue((yyval.code), loopstart);
4908     code_t*out = (yyval.code) = abc_nop((yyval.code));
4909     breakjumpsto((yyval.code), (yyvsp[(1) - (7)].id), out);
4910     continuejumpsto((yyval.code), (yyvsp[(1) - (7)].id), cont);
4911     
4912     (yyval.code) = var_block((yyval.code));
4913     PASS12 old_state();
4914 }
4915     }
4916     break;
4917
4918
4919   
4920     case 80:
4921     if(as3_pass==2) {
4922
4923 /* Line 1464 of skeleton.m4  */
4924 #line 2417 "parser.y"
4925     {
4926     (yyval.code) = abc___break__(0, "");
4927 }
4928     }
4929     break;
4930
4931
4932   
4933     case 81:
4934     if(as3_pass==2) {
4935
4936 /* Line 1464 of skeleton.m4  */
4937 #line 2420 "parser.y"
4938     {
4939     (yyval.code) = abc___break__(0, (yyvsp[(2) - (2)].id));
4940 }
4941     }
4942     break;
4943
4944
4945   
4946     case 82:
4947     if(as3_pass==2) {
4948
4949 /* Line 1464 of skeleton.m4  */
4950 #line 2423 "parser.y"
4951     {
4952     (yyval.code) = abc___continue__(0, "");
4953 }
4954     }
4955     break;
4956
4957
4958   
4959     case 83:
4960     if(as3_pass==2) {
4961
4962 /* Line 1464 of skeleton.m4  */
4963 #line 2426 "parser.y"
4964     {
4965     (yyval.code) = abc___continue__(0, (yyvsp[(2) - (2)].id));
4966 }
4967     }
4968     break;
4969
4970
4971   
4972     case 84:
4973     if(as3_pass==2) {
4974
4975 /* Line 1464 of skeleton.m4  */
4976 #line 2430 "parser.y"
4977     {(yyval.code)=0;}
4978     }
4979     break;
4980
4981
4982   
4983     case 85:
4984     if(as3_pass==2) {
4985
4986 /* Line 1464 of skeleton.m4  */
4987 #line 2431 "parser.y"
4988     {(yyval.code)=(yyvsp[(1) - (1)].code);}
4989     }
4990     break;
4991
4992
4993   
4994     case 86:
4995     if(as3_pass==2) {
4996
4997 /* Line 1464 of skeleton.m4  */
4998 #line 2432 "parser.y"
4999     {(yyval.code)=(yyvsp[(1) - (1)].code);}
5000     }
5001     break;
5002
5003
5004   
5005     case 87:
5006     if(as3_pass==2) {
5007
5008 /* Line 1464 of skeleton.m4  */
5009 #line 2433 "parser.y"
5010     {(yyval.code)=code_append((yyvsp[(1) - (2)].code),(yyvsp[(2) - (2)].code));}
5011     }
5012     break;
5013
5014
5015   
5016     case 88:
5017     if(as3_pass==2) {
5018
5019 /* Line 1464 of skeleton.m4  */
5020 #line 2434 "parser.y"
5021     {(yyval.code)=(yyvsp[(1) - (1)].code);}
5022     }
5023     break;
5024
5025
5026   
5027     case 89:
5028     if(as3_pass==2) {
5029
5030 /* Line 1464 of skeleton.m4  */
5031 #line 2435 "parser.y"
5032     {(yyval.code)=code_append((yyval.code),(yyvsp[(2) - (2)].code));}
5033     }
5034     break;
5035
5036
5037   
5038     case 90:
5039     if(as3_pass==2) {
5040
5041 /* Line 1464 of skeleton.m4  */
5042 #line 2437 "parser.y"
5043     {
5044     (yyval.code) = abc_getlocal(0, state->switch_var);
5045     (yyval.code) = code_append((yyval.code), (yyvsp[(2) - (4)].value).c);
5046     code_t*j = (yyval.code) = abc_ifne((yyval.code), 0);
5047     (yyval.code) = code_append((yyval.code), (yyvsp[(4) - (4)].code));
5048     if((yyval.code)->opcode != OPCODE___BREAK__) {
5049         (yyval.code) = abc___fallthrough__((yyval.code), "");
5050     }
5051     code_t*e = (yyval.code) = abc_nop((yyval.code));
5052     j->branch = e;
5053 }
5054     }
5055     break;
5056
5057
5058   
5059     case 91:
5060     if(as3_pass==2) {
5061
5062 /* Line 1464 of skeleton.m4  */
5063 #line 2448 "parser.y"
5064     {
5065     (yyval.code) = (yyvsp[(3) - (3)].code);
5066 }
5067     }
5068     break;
5069
5070
5071   
5072     case 92:
5073     if(as3_pass==2) {
5074
5075 /* Line 1464 of skeleton.m4  */
5076 #line 2451 "parser.y"
5077     {PASS12 new_state();state->switch_var=alloc_local();}
5078     }
5079     break;
5080
5081
5082   
5083     case 93:
5084     if(as3_pass==2) {
5085
5086 /* Line 1464 of skeleton.m4  */
5087 #line 2451 "parser.y"
5088     {
5089     (yyval.code)=(yyvsp[(4) - (8)].value).c;
5090     (yyval.code) = abc_setlocal((yyval.code), state->switch_var);
5091     (yyval.code) = code_append((yyval.code), (yyvsp[(7) - (8)].code));
5092
5093     code_t*out = (yyval.code) = abc_kill((yyval.code), state->switch_var);
5094     breakjumpsto((yyval.code), (yyvsp[(1) - (8)].id), out);
5095     
5096     code_t*c = (yyval.code),*lastblock=0;
5097     while(c) {
5098         if(c->opcode == OPCODE_IFNE) {
5099             if(!c->next) syntaxerror("internal error in fallthrough handling");
5100             lastblock=c->next;
5101         } else if(c->opcode == OPCODE___FALLTHROUGH__) {
5102             if(lastblock) {
5103                 c->opcode = OPCODE_JUMP;
5104                 c->branch = lastblock;
5105             } else {
5106                 /* fall through end of switch */
5107                 c->opcode = OPCODE_NOP;
5108             }
5109         }
5110         c=c->prev;
5111     }
5112    
5113     (yyval.code) = var_block((yyval.code));
5114     PASS12 old_state();
5115 }
5116     }
5117     break;
5118
5119
5120   
5121     case 94:
5122     if(as3_pass==2) {
5123
5124 /* Line 1464 of skeleton.m4  */
5125 #line 2482 "parser.y"
5126     {PASS12 new_state();
5127                                                       state->exception_name=(yyvsp[(3) - (5)].id);
5128                                                PASS1 new_variable((yyvsp[(3) - (5)].id), 0, 0, 0);
5129                                                PASS2 new_variable((yyvsp[(3) - (5)].id), (yyvsp[(4) - (5)].classinfo), 0, 0);
5130                                               }
5131     }
5132     break;
5133
5134
5135   
5136     case 95:
5137     if(as3_pass==2) {
5138
5139 /* Line 1464 of skeleton.m4  */
5140 #line 2487 "parser.y"
5141     {
5142     namespace_t name_ns = {ACCESS_PACKAGE, ""};
5143     multiname_t name = {QNAME, &name_ns, 0, (yyvsp[(3) - (9)].id)};
5144     
5145     NEW(abc_exception_t, e)
5146     e->exc_type = sig2mname((yyvsp[(4) - (9)].classinfo));
5147     e->var_name = multiname_clone(&name);
5148     (yyval.exception) = e;
5149
5150     code_t*c = 0;
5151     int i = find_variable_safe(state, (yyvsp[(3) - (9)].id))->index;
5152     e->target = c = abc_nop(0);
5153     c = abc_setlocal(c, i);
5154     c = code_append(c, code_dup(state->method->scope_code));
5155     c = code_append(c, (yyvsp[(8) - (9)].code));
5156     c = abc_kill(c, i);
5157
5158     c = var_block(c);
5159     PASS12 old_state();
5160 }
5161     }
5162     break;
5163
5164
5165   
5166     case 96:
5167     if(as3_pass==2) {
5168
5169 /* Line 1464 of skeleton.m4  */
5170 #line 2507 "parser.y"
5171     {PASS12 new_state();state->exception_name=0;}
5172     }
5173     break;
5174
5175
5176   
5177     case 97:
5178     if(as3_pass==2) {
5179
5180 /* Line 1464 of skeleton.m4  */
5181 #line 2507 "parser.y"
5182     {
5183     (yyvsp[(4) - (5)].code) = var_block((yyvsp[(4) - (5)].code));
5184     if(!(yyvsp[(4) - (5)].code)) {
5185         (yyval.exception)=0;
5186     } else {
5187         NEW(abc_exception_t, e)
5188         e->exc_type = 0; //all exceptions
5189         e->var_name = 0; //no name
5190         e->target = 0;
5191         e->to = abc_nop(0);
5192         e->to = code_append(e->to, (yyvsp[(4) - (5)].code));
5193         (yyval.exception) = e;
5194     }
5195     PASS12 old_state();
5196 }
5197     }
5198     break;
5199
5200
5201   
5202     case 98:
5203     if(as3_pass==2) {
5204
5205 /* Line 1464 of skeleton.m4  */
5206 #line 2523 "parser.y"
5207     {(yyval.catch_list).l=list_new();(yyval.catch_list).finally=0;list_append((yyval.catch_list).l,(yyvsp[(1) - (1)].exception));}
5208     }
5209     break;
5210
5211
5212   
5213     case 99:
5214     if(as3_pass==2) {
5215
5216 /* Line 1464 of skeleton.m4  */
5217 #line 2524 "parser.y"
5218     {(yyval.catch_list)=(yyvsp[(1) - (2)].catch_list);list_append((yyval.catch_list).l,(yyvsp[(2) - (2)].exception));}
5219     }
5220     break;
5221
5222
5223   
5224     case 100:
5225     if(as3_pass==2) {
5226
5227 /* Line 1464 of skeleton.m4  */
5228 #line 2525 "parser.y"
5229     {(yyval.catch_list)=(yyvsp[(1) - (1)].catch_list);}
5230     }
5231     break;
5232
5233
5234   
5235     case 101:
5236     if(as3_pass==2) {
5237
5238 /* Line 1464 of skeleton.m4  */
5239 #line 2526 "parser.y"
5240     {
5241     (yyval.catch_list) = (yyvsp[(1) - (2)].catch_list);
5242     (yyval.catch_list).finally = 0;
5243     if((yyvsp[(2) - (2)].exception)) {
5244         list_append((yyval.catch_list).l,(yyvsp[(2) - (2)].exception));
5245         (yyval.catch_list).finally = (yyvsp[(2) - (2)].exception)->to;(yyvsp[(2) - (2)].exception)->to=0;
5246     }
5247 }
5248     }
5249     break;
5250
5251
5252   
5253     case 102:
5254     if(as3_pass==2) {
5255
5256 /* Line 1464 of skeleton.m4  */
5257 #line 2534 "parser.y"
5258     {
5259     (yyval.catch_list).l=list_new();
5260     (yyval.catch_list).finally = 0;
5261     if((yyvsp[(1) - (1)].exception)) {
5262         list_append((yyval.catch_list).l,(yyvsp[(1) - (1)].exception));
5263         (yyval.catch_list).finally = (yyvsp[(1) - (1)].exception)->to;(yyvsp[(1) - (1)].exception)->to=0;
5264     }
5265 }
5266     }
5267     break;
5268
5269
5270   
5271     case 103:
5272     if(as3_pass==2) {
5273
5274 /* Line 1464 of skeleton.m4  */
5275 #line 2543 "parser.y"
5276     {PASS12 new_state();
5277                  state->method->has_exceptions=1;
5278                  state->method->late_binding=1;//for invariant scope_code
5279                 }
5280     }
5281     break;
5282
5283
5284   
5285     case 104:
5286     if(as3_pass==2) {
5287
5288 /* Line 1464 of skeleton.m4  */
5289 #line 2546 "parser.y"
5290     {
5291     code_t*out = abc_nop(0);
5292
5293     code_t*start = abc_nop(0);
5294     (yyval.code) = code_append(start, (yyvsp[(4) - (6)].code));
5295     if(!is_break_or_jump((yyvsp[(4) - (6)].code))) {
5296         (yyval.code) = abc_jump((yyval.code), out);
5297     }
5298     code_t*end = (yyval.code) = abc_nop((yyval.code));
5299   
5300     int tmp;
5301     if((yyvsp[(6) - (6)].catch_list).finally)
5302         tmp = new_variable("__finally__", 0, 0, 0);
5303     
5304     abc_exception_list_t*l = (yyvsp[(6) - (6)].catch_list).l;
5305     int count=0;
5306     while(l) {
5307         abc_exception_t*e = l->abc_exception;
5308         if(e->var_name) {
5309             (yyval.code) = code_append((yyval.code), e->target);
5310             (yyval.code) = abc_jump((yyval.code), out);
5311         } else {
5312             parserassert((ptroff_t)(yyvsp[(6) - (6)].catch_list).finally);
5313             // finally block
5314             e->target = (yyval.code) = abc_nop((yyval.code));
5315             (yyval.code) = code_append((yyval.code), code_dup(state->method->scope_code));
5316             (yyval.code) = abc___rethrow__((yyval.code));
5317         }
5318         
5319         e->from = start;
5320         e->to = end;
5321
5322         l = l->next;
5323     }
5324     (yyval.code) = code_append((yyval.code), out);
5325
5326     (yyval.code) = insert_finally((yyval.code), (yyvsp[(6) - (6)].catch_list).finally, tmp);
5327         
5328     list_concat(state->method->exceptions, (yyvsp[(6) - (6)].catch_list).l);
5329    
5330     (yyval.code) = var_block((yyval.code));
5331     PASS12 old_state();
5332 }
5333     }
5334     break;
5335
5336
5337   
5338     case 105:
5339     if(as3_pass==2) {
5340
5341 /* Line 1464 of skeleton.m4  */
5342 #line 2592 "parser.y"
5343     {
5344     (yyval.code)=(yyvsp[(2) - (2)].value).c;
5345     (yyval.code)=abc_throw((yyval.code));
5346 }
5347     }
5348     break;
5349
5350
5351   
5352     case 106:
5353     if(as3_pass==2) {
5354
5355 /* Line 1464 of skeleton.m4  */
5356 #line 2596 "parser.y"
5357     {
5358     if(!state->exception_name)
5359         syntaxerror("re-throw only possible within a catch block");
5360     variable_t*v = find_variable(state, state->exception_name);
5361     (yyval.code)=code_new();
5362     (yyval.code)=abc_getlocal((yyval.code), v->index);
5363     (yyval.code)=abc_throw((yyval.code));
5364 }
5365     }
5366     break;
5367
5368
5369   
5370     case 107:
5371     if(as3_pass==2) {
5372
5373 /* Line 1464 of skeleton.m4  */
5374 #line 2607 "parser.y"
5375     {
5376      new_state();
5377      if(state->method->has_exceptions) {
5378          int v = alloc_local();
5379          state->method->scope_code = abc_getlocal(state->method->scope_code, v);
5380          state->method->scope_code = abc_pushwith(state->method->scope_code);
5381          (yyval.value_list).number = v;
5382      }
5383      (yyval.value_list).cc = (yyvsp[(3) - (4)].value).c;
5384 }
5385     }
5386     break;
5387
5388
5389   
5390     case 108:
5391     if(as3_pass==2) {
5392
5393 /* Line 1464 of skeleton.m4  */
5394 #line 2617 "parser.y"
5395     {
5396      /* remove getlocal;pushwith from scope code again */
5397      state->method->scope_code = code_cutlast(code_cutlast(state->method->scope_code));
5398
5399      (yyval.code) = (yyvsp[(1) - (2)].value_list).cc;
5400      if(state->method->has_exceptions) {
5401          (yyval.code) = abc_dup((yyval.code));
5402          (yyval.code) = abc_setlocal((yyval.code), (yyvsp[(1) - (2)].value_list).number);
5403      }
5404      (yyval.code) = abc_pushwith((yyval.code));
5405      (yyval.code) = code_append((yyval.code), (yyvsp[(2) - (2)].code));
5406      (yyval.code) = abc_popscope((yyval.code));
5407      old_state();
5408 }
5409     }
5410     break;
5411
5412
5413   
5414     case 110:
5415     if(as3_pass==2) {
5416
5417 /* Line 1464 of skeleton.m4  */
5418 #line 2635 "parser.y"
5419     {PASS12 (yyval.id)="package";}
5420     }
5421     break;
5422
5423
5424   
5425     case 111:
5426     if(as3_pass==2) {
5427
5428 /* Line 1464 of skeleton.m4  */
5429 #line 2636 "parser.y"
5430     {PASS12 (yyval.id)=(yyvsp[(1) - (1)].id);}
5431     }
5432     break;
5433
5434
5435   
5436     case 112:
5437     if(as3_pass==2) {
5438
5439 /* Line 1464 of skeleton.m4  */
5440 #line 2638 "parser.y"
5441     {PASS12 (yyval.id) = concat3((yyvsp[(1) - (3)].id),".",(yyvsp[(3) - (3)].id));free((yyvsp[(1) - (3)].id));(yyvsp[(1) - (3)].id)=0;}
5442     }
5443     break;
5444
5445
5446   
5447     case 113:
5448     if(as3_pass==2) {
5449
5450 /* Line 1464 of skeleton.m4  */
5451 #line 2639 "parser.y"
5452     {PASS12 (yyval.id)=strdup((yyvsp[(1) - (1)].id));}
5453     }
5454     break;
5455
5456
5457   
5458     case 114:
5459     if(as3_pass==2) {
5460
5461 /* Line 1464 of skeleton.m4  */
5462 #line 2641 "parser.y"
5463     {PASS12 startpackage((yyvsp[(2) - (3)].id));free((yyvsp[(2) - (3)].id));(yyvsp[(2) - (3)].id)=0;}
5464     }
5465     break;
5466
5467
5468   
5469     case 115:
5470     if(as3_pass==2) {
5471
5472 /* Line 1464 of skeleton.m4  */
5473 #line 2642 "parser.y"
5474     {PASS12 endpackage();(yyval.code)=0;}
5475     }
5476     break;
5477
5478
5479   
5480     case 116:
5481     if(as3_pass==2) {
5482
5483 /* Line 1464 of skeleton.m4  */
5484 #line 2643 "parser.y"
5485     {PASS12 startpackage("");}
5486     }
5487     break;
5488
5489
5490   
5491     case 117:
5492     if(as3_pass==2) {
5493
5494 /* Line 1464 of skeleton.m4  */
5495 #line 2644 "parser.y"
5496     {PASS12 endpackage();(yyval.code)=0;}
5497     }
5498     break;
5499
5500
5501   
5502     case 118:
5503     if(as3_pass==2) {
5504
5505 /* Line 1464 of skeleton.m4  */
5506 #line 2646 "parser.y"
5507     {
5508        PASS12
5509        slotinfo_t*s = registry_find((yyvsp[(2) - (2)].classinfo)->package, (yyvsp[(2) - (2)].classinfo)->name);
5510        if(!s && as3_pass==1) {// || !(s->flags&FLAG_BUILTIN)) {
5511            as3_schedule_class((yyvsp[(2) - (2)].classinfo)->package, (yyvsp[(2) - (2)].classinfo)->name);
5512        }
5513        classinfo_t*c = (yyvsp[(2) - (2)].classinfo);
5514        if(!c) 
5515             syntaxerror("Couldn't import class\n");
5516        state_has_imports();
5517        dict_put(state->imports, c->name, c);
5518        import_toplevel(c->package);
5519        (yyval.code)=0;
5520 }
5521     }
5522     break;
5523
5524
5525   
5526     case 119:
5527     if(as3_pass==2) {
5528
5529 /* Line 1464 of skeleton.m4  */
5530 #line 2660 "parser.y"
5531     {
5532        PASS12
5533        if(strncmp("flash.", (yyvsp[(2) - (4)].id), 6) && as3_pass==1) {
5534            as3_schedule_package((yyvsp[(2) - (4)].id));
5535        }
5536
5537        NEW(import_t,i);
5538        i->package = (yyvsp[(2) - (4)].id);
5539        state_has_imports();
5540        list_append(state->wildcard_imports, i);
5541        import_toplevel(i->package);
5542        (yyval.code)=0;
5543 }
5544     }
5545     break;
5546
5547
5548   
5549     case 120:
5550     if(as3_pass==2) {
5551
5552 /* Line 1464 of skeleton.m4  */
5553 #line 2676 "parser.y"
5554     {PASS12 (yyval.flags).flags=0;(yyval.flags).ns=0;}
5555     }
5556     break;
5557
5558
5559   
5560     case 121:
5561     if(as3_pass==2) {
5562
5563 /* Line 1464 of skeleton.m4  */
5564 #line 2677 "parser.y"
5565     {PASS12 (yyval.flags)=(yyvsp[(1) - (1)].flags);}
5566     }
5567     break;
5568
5569
5570   
5571     case 122:
5572     if(as3_pass==2) {
5573
5574 /* Line 1464 of skeleton.m4  */
5575 #line 2678 "parser.y"
5576     {PASS12 (yyval.flags)=(yyvsp[(1) - (1)].flags);}
5577     }
5578     break;
5579
5580
5581   
5582     case 123:
5583     if(as3_pass==2) {
5584
5585 /* Line 1464 of skeleton.m4  */
5586 #line 2679 "parser.y"
5587     {
5588     PASS12 
5589     (yyval.flags).flags=(yyvsp[(1) - (2)].flags).flags|(yyvsp[(2) - (2)].flags).flags;
5590     if((yyvsp[(1) - (2)].flags).ns && (yyvsp[(2) - (2)].flags).ns) syntaxerror("only one namespace allowed in one declaration");
5591     (yyval.flags).ns=(yyvsp[(1) - (2)].flags).ns?(yyvsp[(1) - (2)].flags).ns:(yyvsp[(2) - (2)].flags).ns;
5592
5593 }
5594     }
5595     break;
5596
5597
5598   
5599     case 124:
5600     if(as3_pass==2) {
5601
5602 /* Line 1464 of skeleton.m4  */
5603 #line 2686 "parser.y"
5604     {PASS12 (yyval.flags).flags=FLAG_PUBLIC;(yyval.flags).ns=0;}
5605     }
5606     break;
5607
5608
5609   
5610     case 125:
5611     if(as3_pass==2) {
5612
5613 /* Line 1464 of skeleton.m4  */
5614 #line 2687 "parser.y"
5615     {PASS12 (yyval.flags).flags=FLAG_PRIVATE;(yyval.flags).ns=0;}
5616     }
5617     break;
5618
5619
5620   
5621     case 126:
5622     if(as3_pass==2) {
5623
5624 /* Line 1464 of skeleton.m4  */
5625 #line 2688 "parser.y"
5626     {PASS12 (yyval.flags).flags=FLAG_PROTECTED;(yyval.flags).ns=0;}
5627     }
5628     break;
5629
5630
5631   
5632     case 127:
5633     if(as3_pass==2) {
5634
5635 /* Line 1464 of skeleton.m4  */
5636 #line 2689 "parser.y"
5637     {PASS12 (yyval.flags).flags=FLAG_STATIC;(yyval.flags).ns=0;}
5638     }
5639     break;
5640
5641
5642   
5643     case 128:
5644     if(as3_pass==2) {
5645
5646 /* Line 1464 of skeleton.m4  */
5647 #line 2690 "parser.y"
5648     {PASS12 (yyval.flags).flags=FLAG_DYNAMIC;(yyval.flags).ns=0;}
5649     }
5650     break;
5651
5652
5653   
5654     case 129:
5655     if(as3_pass==2) {
5656
5657 /* Line 1464 of skeleton.m4  */
5658 #line 2691 "parser.y"
5659     {PASS12 (yyval.flags).flags=FLAG_FINAL;(yyval.flags).ns=0;}
5660     }
5661     break;
5662
5663
5664   
5665     case 130:
5666     if(as3_pass==2) {
5667
5668 /* Line 1464 of skeleton.m4  */
5669 #line 2692 "parser.y"
5670     {PASS12 (yyval.flags).flags=FLAG_OVERRIDE;(yyval.flags).ns=0;}
5671     }
5672     break;
5673
5674
5675   
5676     case 131:
5677     if(as3_pass==2) {
5678
5679 /* Line 1464 of skeleton.m4  */
5680 #line 2693 "parser.y"
5681     {PASS12 (yyval.flags).flags=FLAG_NATIVE;(yyval.flags).ns=0;}
5682     }
5683     break;
5684
5685
5686   
5687     case 132:
5688     if(as3_pass==2) {
5689
5690 /* Line 1464 of skeleton.m4  */
5691 #line 2694 "parser.y"
5692     {PASS12 (yyval.flags).flags=FLAG_PACKAGEINTERNAL;(yyval.flags).ns=0;}
5693     }
5694     break;
5695
5696
5697   
5698     case 133:
5699     if(as3_pass==2) {
5700
5701 /* Line 1464 of skeleton.m4  */
5702 #line 2695 "parser.y"
5703     {PASS12 (yyval.flags).flags=FLAG_NAMESPACE;
5704                                (yyval.flags).ns=(yyvsp[(1) - (1)].id);
5705                        }
5706     }
5707     break;
5708
5709
5710   
5711     case 134:
5712     if(as3_pass==2) {
5713
5714 /* Line 1464 of skeleton.m4  */
5715 #line 2699 "parser.y"
5716     {PASS12 (yyval.classinfo)=0;}
5717     }
5718     break;
5719
5720
5721   
5722     case 135:
5723     if(as3_pass==2) {
5724
5725 /* Line 1464 of skeleton.m4  */
5726 #line 2700 "parser.y"
5727     {PASS12 (yyval.classinfo)=(yyvsp[(2) - (2)].classinfo);}
5728     }
5729     break;
5730
5731
5732   
5733     case 136:
5734     if(as3_pass==2) {
5735
5736 /* Line 1464 of skeleton.m4  */
5737 #line 2702 "parser.y"
5738     {PASS12 (yyval.classinfo_list)=list_new();}
5739     }
5740     break;
5741
5742
5743   
5744     case 137:
5745     if(as3_pass==2) {
5746
5747 /* Line 1464 of skeleton.m4  */
5748 #line 2703 "parser.y"
5749     {PASS12 (yyval.classinfo_list)=(yyvsp[(2) - (2)].classinfo_list);}
5750     }
5751     break;
5752
5753
5754   
5755     case 138:
5756     if(as3_pass==2) {
5757
5758 /* Line 1464 of skeleton.m4  */
5759 #line 2705 "parser.y"
5760     {PASS12 (yyval.classinfo_list)=list_new();}
5761     }
5762     break;
5763
5764
5765   
5766     case 139:
5767     if(as3_pass==2) {
5768
5769 /* Line 1464 of skeleton.m4  */
5770 #line 2706 "parser.y"
5771     {PASS12 (yyval.classinfo_list)=(yyvsp[(2) - (2)].classinfo_list);}
5772     }
5773     break;
5774
5775
5776   
5777     case 140:
5778     if(as3_pass==2) {
5779
5780 /* Line 1464 of skeleton.m4  */
5781 #line 2710 "parser.y"
5782     {PASS12 startclass(&(yyvsp[(1) - (6)].flags),(yyvsp[(3) - (6)].id),(yyvsp[(4) - (6)].classinfo),(yyvsp[(5) - (6)].classinfo_list));}
5783     }
5784     break;
5785
5786
5787   
5788     case 141:
5789     if(as3_pass==2) {
5790
5791 /* Line 1464 of skeleton.m4  */
5792 #line 2712 "parser.y"
5793     {PASS12 endclass();(yyval.code)=0;}
5794     }
5795     break;
5796
5797
5798   
5799     case 142:
5800     if(as3_pass==2) {
5801
5802 /* Line 1464 of skeleton.m4  */
5803 #line 2716 "parser.y"
5804     {PASS12 (yyvsp[(1) - (5)].flags).flags|=FLAG_INTERFACE;
5805                                           startclass(&(yyvsp[(1) - (5)].flags),(yyvsp[(3) - (5)].id),0,(yyvsp[(4) - (5)].classinfo_list));}
5806     }
5807     break;
5808
5809
5810   
5811     case 143:
5812     if(as3_pass==2) {
5813
5814 /* Line 1464 of skeleton.m4  */
5815 #line 2719 "parser.y"
5816     {PASS12 endclass();(yyval.code)=0;}
5817     }
5818     break;
5819
5820
5821   
5822     case 152:
5823     if(as3_pass==2) {
5824
5825 /* Line 1464 of skeleton.m4  */
5826 #line 2732 "parser.y"
5827     {
5828     code_t*c = state->cls->static_init->header;
5829     c = code_append(c, (yyvsp[(1) - (1)].code));  
5830     state->cls->static_init->header = c;
5831 }
5832     }
5833     break;
5834
5835
5836   
5837     case 158:
5838     if(as3_pass==2) {
5839
5840 /* Line 1464 of skeleton.m4  */
5841 #line 2743 "parser.y"
5842     {
5843     syntaxerror("variable declarations not allowed in interfaces");
5844 }
5845     }
5846     break;
5847
5848
5849   
5850     case 159:
5851     if(as3_pass==2) {
5852
5853 /* Line 1464 of skeleton.m4  */
5854 #line 2746 "parser.y"
5855     {
5856     PASS12
5857     (yyvsp[(1) - (8)].flags).flags |= FLAG_PUBLIC;
5858     if((yyvsp[(1) - (8)].flags).flags&(FLAG_PRIVATE|FLAG_PACKAGEINTERNAL|FLAG_PROTECTED)) {
5859         syntaxerror("invalid method modifiers: interface methods always need to be public");
5860     }
5861     startfunction(&(yyvsp[(1) - (8)].flags),(yyvsp[(3) - (8)].token),(yyvsp[(4) - (8)].id),&(yyvsp[(6) - (8)].params),(yyvsp[(8) - (8)].classinfo));
5862     endfunction(&(yyvsp[(1) - (8)].flags),(yyvsp[(3) - (8)].token),(yyvsp[(4) - (8)].id),&(yyvsp[(6) - (8)].params),(yyvsp[(8) - (8)].classinfo), 0);
5863     list_deep_free((yyvsp[(6) - (8)].params).list);
5864 }
5865     }
5866     break;
5867
5868
5869   
5870     case 162:
5871     if(as3_pass==2) {
5872
5873 /* Line 1464 of skeleton.m4  */
5874 #line 2761 "parser.y"
5875     {setslotstate(&(yyvsp[(1) - (2)].flags),(yyvsp[(2) - (2)].token));}
5876     }
5877     break;
5878
5879
5880   
5881     case 163:
5882     if(as3_pass==2) {
5883
5884 /* Line 1464 of skeleton.m4  */
5885 #line 2761 "parser.y"
5886     {(yyval.code)=(yyvsp[(4) - (4)].code);setslotstate(0, 0);}
5887     }
5888     break;
5889
5890
5891   
5892     case 164:
5893     if(as3_pass==2) {
5894
5895 /* Line 1464 of skeleton.m4  */
5896 #line 2763 "parser.y"
5897     {(yyval.code) = (yyvsp[(1) - (1)].code);}
5898     }
5899     break;
5900
5901
5902   
5903     case 165:
5904     if(as3_pass==2) {
5905
5906 /* Line 1464 of skeleton.m4  */
5907 #line 2764 "parser.y"
5908     {(yyval.code) = code_append((yyvsp[(1) - (3)].code), (yyvsp[(3) - (3)].code));}
5909     }
5910     break;
5911
5912
5913   
5914     case 166:
5915     if(as3_pass==2) {
5916
5917 /* Line 1464 of skeleton.m4  */
5918 #line 2767 "parser.y"
5919     {
5920     int flags = slotstate_flags->flags;
5921     namespace_t ns = modifiers2access(slotstate_flags);
5922
5923     varinfo_t* info = 0;
5924     if(state->cls) {
5925         memberinfo_t*i = registry_findmember(state->cls->info, ns.name, (yyvsp[(1) - (3)].id), 1);
5926         if(i) {
5927             check_override(i, flags);
5928         }
5929         info = varinfo_register_onclass(state->cls->info, ns.access, ns.name, (yyvsp[(1) - (3)].id));
5930     } else {
5931         slotinfo_t*i = registry_find(state->package, (yyvsp[(1) - (3)].id));
5932         if(i) {
5933             syntaxerror("package %s already contains '%s'", state->package, (yyvsp[(1) - (3)].id));
5934         }
5935         if(ns.name && ns.name[0]) {
5936             syntaxerror("namespaces not allowed on package-level variables");
5937         }
5938         info = varinfo_register_global(ns.access, state->package, (yyvsp[(1) - (3)].id));
5939     }
5940
5941     info->type = (yyvsp[(2) - (3)].classinfo);
5942     info->flags = flags;
5943
5944     /* slot name */
5945     multiname_t mname = {QNAME, &ns, 0, (yyvsp[(1) - (3)].id)};
5946   
5947     trait_list_t**traits;
5948     code_t**code;
5949     if(!state->cls) {
5950         // global variable
5951         ns.name = state->package;
5952         traits = &global->init->traits;
5953         code = &global->init->method->body->code;
5954     } else if(flags&FLAG_STATIC) {
5955         // static variable
5956         traits = &state->cls->abc->static_traits;
5957         code = &state->cls->static_init->header;
5958     } else {
5959         // instance variable
5960         traits = &state->cls->abc->traits;
5961         code = &state->cls->init->header;
5962     }
5963     
5964     trait_t*t=0;
5965     if((yyvsp[(2) - (3)].classinfo)) {
5966         MULTINAME(m, (yyvsp[(2) - (3)].classinfo));
5967         t = trait_new_member(traits, multiname_clone(&m), multiname_clone(&mname), 0);
5968     } else {
5969         t = trait_new_member(traits, 0, multiname_clone(&mname), 0);
5970     }
5971     info->slot = t->slot_id;
5972     
5973     /* initalization code (if needed) */
5974     code_t*c = 0;
5975     if((yyvsp[(3) - (3)].value).c && !is_pushundefined((yyvsp[(3) - (3)].value).c)) {
5976         c = abc_getlocal_0(c);
5977         c = code_append(c, (yyvsp[(3) - (3)].value).c);
5978         c = converttype(c, (yyvsp[(3) - (3)].value).t, (yyvsp[(2) - (3)].classinfo));
5979         c = abc_setslot(c, t->slot_id);
5980     }
5981
5982     *code = code_append(*code, c);
5983
5984     if(slotstate_varconst==KW_CONST) {
5985         t->kind= TRAIT_CONST;
5986     }
5987
5988     (yyval.code)=0;
5989 }
5990     }
5991     break;
5992
5993
5994   
5995     case 167:
5996     if(as3_pass==2) {
5997
5998 /* Line 1464 of skeleton.m4  */
5999 #line 2841 "parser.y"
6000     {(yyval.constant)=0;}
6001     }
6002     break;
6003
6004
6005   
6006     case 168:
6007     if(as3_pass==2) {
6008
6009 /* Line 1464 of skeleton.m4  */
6010 #line 2842 "parser.y"
6011     {(yyval.constant)=(yyvsp[(2) - (2)].constant);}
6012     }
6013     break;
6014
6015
6016   
6017     case 169:
6018     if(as3_pass==2) {
6019
6020 /* Line 1464 of skeleton.m4  */
6021 #line 2844 "parser.y"
6022     {(yyval.constant) = constant_new_int((yyvsp[(1) - (1)].number_uint));}
6023     }
6024     break;
6025
6026
6027   
6028     case 170:
6029     if(as3_pass==2) {
6030
6031 /* Line 1464 of skeleton.m4  */
6032 #line 2845 "parser.y"
6033     {(yyval.constant) = constant_new_int((yyvsp[(1) - (1)].number_int));}
6034     }
6035     break;
6036
6037
6038   
6039     case 171:
6040     if(as3_pass==2) {
6041
6042 /* Line 1464 of skeleton.m4  */
6043 #line 2846 "parser.y"
6044     {(yyval.constant) = constant_new_uint((yyvsp[(1) - (1)].number_uint));}
6045     }
6046     break;
6047
6048
6049   
6050     case 172:
6051     if(as3_pass==2) {
6052
6053 /* Line 1464 of skeleton.m4  */
6054 #line 2847 "parser.y"
6055     {(yyval.constant) = constant_new_float((yyvsp[(1) - (1)].number_float));}
6056     }
6057     break;
6058
6059
6060   
6061     case 173:
6062     if(as3_pass==2) {
6063
6064 /* Line 1464 of skeleton.m4  */
6065 #line 2848 "parser.y"
6066     {(yyval.constant) = constant_new_string2((yyvsp[(1) - (1)].str).str,(yyvsp[(1) - (1)].str).len);free((char*)(yyvsp[(1) - (1)].str).str);}
6067     }
6068     break;
6069
6070
6071   
6072     case 174:
6073     if(as3_pass==2) {
6074
6075 /* Line 1464 of skeleton.m4  */
6076 #line 2850 "parser.y"
6077     {(yyval.constant) = constant_new_true((yyvsp[(1) - (1)].token));}
6078     }
6079     break;
6080
6081
6082   
6083     case 175:
6084     if(as3_pass==2) {
6085
6086 /* Line 1464 of skeleton.m4  */
6087 #line 2851 "parser.y"
6088     {(yyval.constant) = constant_new_false((yyvsp[(1) - (1)].token));}
6089     }
6090     break;
6091
6092
6093   
6094     case 176:
6095     if(as3_pass==2) {
6096
6097 /* Line 1464 of skeleton.m4  */
6098 #line 2852 "parser.y"
6099     {(yyval.constant) = constant_new_null((yyvsp[(1) - (1)].token));}
6100     }
6101     break;
6102
6103
6104   
6105     case 177:
6106     if(as3_pass==2) {
6107
6108 /* Line 1464 of skeleton.m4  */
6109 #line 2853 "parser.y"
6110     {
6111     if(!strcmp((yyvsp[(1) - (1)].id), "NaN")) {
6112         (yyval.constant) = constant_new_float(__builtin_nan(""));
6113     } else {
6114         as3_warning("Couldn't evaluate constant value of %s", (yyvsp[(1) - (1)].id));
6115         (yyval.constant) = constant_new_null((yyvsp[(1) - (1)].id));
6116     }
6117 }
6118     }
6119     break;
6120
6121
6122   
6123     case 178:
6124     if(as3_pass==2) {
6125
6126 /* Line 1464 of skeleton.m4  */
6127 #line 2865 "parser.y"
6128     {
6129     PASS12
6130     memset(&(yyval.params),0,sizeof((yyval.params)));
6131 }
6132     }
6133     break;
6134
6135
6136   
6137     case 179:
6138     if(as3_pass==2) {
6139
6140 /* Line 1464 of skeleton.m4  */
6141 #line 2869 "parser.y"
6142     {
6143     PASS12
6144     (yyval.params)=(yyvsp[(1) - (1)].params);
6145 }
6146     }
6147     break;
6148
6149
6150   
6151     case 180:
6152     if(as3_pass==2) {
6153
6154 /* Line 1464 of skeleton.m4  */
6155 #line 2875 "parser.y"
6156     {
6157     PASS12
6158     memset(&(yyval.params),0,sizeof((yyval.params)));
6159     (yyval.params).varargs=1;
6160     list_append((yyval.params).list, (yyvsp[(2) - (2)].param));
6161 }
6162     }
6163     break;
6164
6165
6166   
6167     case 181:
6168     if(as3_pass==2) {
6169
6170 /* Line 1464 of skeleton.m4  */
6171 #line 2881 "parser.y"
6172     {
6173     PASS12
6174     (yyval.params) =(yyvsp[(1) - (4)].params);
6175     (yyval.params).varargs=1;
6176     list_append((yyval.params).list, (yyvsp[(4) - (4)].param));
6177 }
6178     }
6179     break;
6180
6181
6182   
6183     case 182:
6184     if(as3_pass==2) {
6185
6186 /* Line 1464 of skeleton.m4  */
6187 #line 2889 "parser.y"
6188     {
6189     PASS12
6190     (yyval.params) = (yyvsp[(1) - (3)].params);
6191     list_append((yyval.params).list, (yyvsp[(3) - (3)].param));
6192 }
6193     }
6194     break;
6195
6196
6197   
6198     case 183:
6199     if(as3_pass==2) {
6200
6201 /* Line 1464 of skeleton.m4  */
6202 #line 2894 "parser.y"
6203     {
6204     PASS12
6205     memset(&(yyval.params),0,sizeof((yyval.params)));
6206     list_append((yyval.params).list, (yyvsp[(1) - (1)].param));
6207 }
6208     }
6209     break;
6210
6211
6212   
6213     case 184:
6214     if(as3_pass==2) {
6215
6216 /* Line 1464 of skeleton.m4  */
6217 #line 2900 "parser.y"
6218     {
6219      PASS12
6220      (yyval.param) = rfx_calloc(sizeof(param_t));
6221      (yyval.param)->name=(yyvsp[(1) - (4)].id);
6222      (yyval.param)->type = (yyvsp[(3) - (4)].classinfo);
6223      PASS2
6224      (yyval.param)->value = (yyvsp[(4) - (4)].constant);
6225 }
6226     }
6227     break;
6228
6229
6230   
6231     case 185:
6232     if(as3_pass==2) {
6233
6234 /* Line 1464 of skeleton.m4  */
6235 #line 2908 "parser.y"
6236     {
6237      PASS12
6238      (yyval.param) = rfx_calloc(sizeof(param_t));
6239      (yyval.param)->name=(yyvsp[(1) - (2)].id);
6240      (yyval.param)->type = TYPE_ANY;
6241      PASS2
6242      (yyval.param)->value = (yyvsp[(2) - (2)].constant);
6243 }
6244     }
6245     break;
6246
6247
6248   
6249     case 188:
6250     if(as3_pass==2) {
6251
6252 /* Line 1464 of skeleton.m4  */
6253 #line 2918 "parser.y"
6254     {PASS12 (yyval.token)=0;}
6255     }
6256     break;
6257
6258
6259   
6260     case 189:
6261     if(as3_pass==2) {
6262
6263 /* Line 1464 of skeleton.m4  */
6264 #line 2921 "parser.y"
6265     {PASS12 startfunction(&(yyvsp[(1) - (9)].flags),(yyvsp[(3) - (9)].token),(yyvsp[(4) - (9)].id),&(yyvsp[(6) - (9)].params),(yyvsp[(8) - (9)].classinfo));}
6266     }
6267     break;
6268
6269
6270   
6271     case 190:
6272     if(as3_pass==2) {
6273
6274 /* Line 1464 of skeleton.m4  */
6275 #line 2922 "parser.y"
6276     {
6277     PASS1 
6278     endfunction(&(yyvsp[(1) - (12)].flags),(yyvsp[(3) - (12)].token),(yyvsp[(4) - (12)].id),&(yyvsp[(6) - (12)].params),0,0);
6279     PASS2
6280     if(!state->method->info) syntaxerror("internal error");
6281     
6282     code_t*c = method_header(state->method);
6283     c = wrap_function(c, 0, (yyvsp[(11) - (12)].code));
6284
6285     endfunction(&(yyvsp[(1) - (12)].flags),(yyvsp[(3) - (12)].token),(yyvsp[(4) - (12)].id),&(yyvsp[(6) - (12)].params),(yyvsp[(8) - (12)].classinfo),c);
6286     PASS12
6287     list_deep_free((yyvsp[(6) - (12)].params).list);
6288     (yyval.code)=0;
6289 }
6290     }
6291     break;
6292
6293
6294   
6295     case 192:
6296     if(as3_pass==2) {
6297
6298 /* Line 1464 of skeleton.m4  */
6299 #line 2938 "parser.y"
6300     {PASS12 (yyval.id)=0;}
6301     }
6302     break;
6303
6304
6305   
6306     case 193:
6307     if(as3_pass==2) {
6308
6309 /* Line 1464 of skeleton.m4  */
6310 #line 2940 "parser.y"
6311     {PASS12 innerfunction((yyvsp[(2) - (7)].id),&(yyvsp[(4) - (7)].params),(yyvsp[(6) - (7)].classinfo));}
6312     }
6313     break;
6314
6315
6316   
6317     case 194:
6318     if(as3_pass==2) {
6319
6320 /* Line 1464 of skeleton.m4  */
6321 #line 2941 "parser.y"
6322     {
6323     PASS1
6324     endfunction(0,0,(yyvsp[(2) - (10)].id),&(yyvsp[(4) - (10)].params),0,0);
6325     PASS2
6326     methodinfo_t*f = state->method->info;
6327     if(!f || !f->kind) syntaxerror("internal error");
6328     
6329     code_t*c = method_header(state->method);
6330     c = wrap_function(c, 0, (yyvsp[(9) - (10)].code));
6331
6332     int index = state->method->var_index;
6333     endfunction(0,0,(yyvsp[(2) - (10)].id),&(yyvsp[(4) - (10)].params),(yyvsp[(6) - (10)].classinfo),c);
6334     
6335     (yyval.value).c = abc_getlocal(0, index);
6336     (yyval.value).t = TYPE_FUNCTION(f);
6337
6338     PASS12 list_deep_free((yyvsp[(4) - (10)].params).list);
6339 }
6340     }
6341     break;
6342
6343
6344   
6345     case 195:
6346     if(as3_pass==2) {
6347
6348 /* Line 1464 of skeleton.m4  */
6349 #line 2963 "parser.y"
6350     {
6351     PASS1 NEW(unresolvedinfo_t,c);
6352           memset(c, 0, sizeof(*c));
6353           c->kind = INFOTYPE_UNRESOLVED;
6354           c->name = (yyvsp[(1) - (1)].id);
6355           c->package = get_package_from_name((yyvsp[(1) - (1)].id));
6356           if(!c->package) {
6357               c->nsset = get_current_imports();
6358               /* make the compiler look for this class in the current directory,
6359                  just in case: */
6360               as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id));
6361           }
6362           (yyval.classinfo) = (classinfo_t*)c;
6363     PASS2
6364     slotinfo_t*s = find_class((yyvsp[(1) - (1)].id));
6365     if(!s) syntaxerror("Could not find class/method %s (current package: %s)\n", (yyvsp[(1) - (1)].id), state->package);
6366     (yyval.classinfo) = (classinfo_t*)s;
6367 }
6368     }
6369     break;
6370
6371
6372   
6373     case 196:
6374     if(as3_pass==2) {
6375
6376 /* Line 1464 of skeleton.m4  */
6377 #line 2982 "parser.y"
6378     {
6379     PASS1 NEW(unresolvedinfo_t,c);
6380           memset(c, 0, sizeof(*c));
6381           c->kind = INFOTYPE_UNRESOLVED;
6382           c->package = (yyvsp[(1) - (3)].id);
6383           c->name = (yyvsp[(3) - (3)].id);
6384           (yyval.classinfo) = (classinfo_t*)c;
6385     PASS2
6386     slotinfo_t*s = registry_find((yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
6387     if(!s) syntaxerror("Couldn't find class/method %s.%s\n", (yyvsp[(1) - (3)].id), (yyvsp[(3) - (3)].id));
6388     free((yyvsp[(1) - (3)].id));(yyvsp[(1) - (3)].id)=0;
6389     (yyval.classinfo) = (classinfo_t*)s;
6390 }
6391     }
6392     break;
6393
6394
6395   
6396     case 199:
6397     if(as3_pass==2) {
6398
6399 /* Line 1464 of skeleton.m4  */
6400 #line 2999 "parser.y"
6401     {PASS12 (yyval.classinfo_list)=list_new();list_append((yyval.classinfo_list), (yyvsp[(1) - (1)].classinfo));}
6402     }
6403     break;
6404
6405
6406   
6407     case 200:
6408     if(as3_pass==2) {
6409
6410 /* Line 1464 of skeleton.m4  */
6411 #line 3000 "parser.y"
6412     {PASS12 (yyval.classinfo_list)=(yyvsp[(1) - (3)].classinfo_list);list_append((yyval.classinfo_list),(yyvsp[(3) - (3)].classinfo));}
6413     }
6414     break;
6415
6416
6417   
6418     case 201:
6419     if(as3_pass==2) {
6420
6421 /* Line 1464 of skeleton.m4  */
6422 #line 3002 "parser.y"
6423     {PASS12 (yyval.classinfo)=(yyvsp[(1) - (1)].classinfo);}
6424     }
6425     break;
6426
6427
6428   
6429     case 202:
6430     if(as3_pass==2) {
6431
6432 /* Line 1464 of skeleton.m4  */
6433 #line 3003 "parser.y"
6434     {PASS12 (yyval.classinfo)=registry_getanytype();}
6435     }
6436     break;
6437
6438
6439   
6440     case 203:
6441     if(as3_pass==2) {
6442
6443 /* Line 1464 of skeleton.m4  */
6444 #line 3004 "parser.y"
6445     {PASS12 (yyval.classinfo)=registry_getanytype();}
6446     }
6447     break;
6448
6449
6450   
6451     case 204:
6452     if(as3_pass==2) {
6453
6454 /* Line 1464 of skeleton.m4  */
6455 #line 3013 "parser.y"
6456     {PASS12 (yyval.classinfo)=(yyvsp[(2) - (2)].classinfo);}
6457     }
6458     break;
6459
6460
6461   
6462     case 205:
6463     if(as3_pass==2) {
6464
6465 /* Line 1464 of skeleton.m4  */
6466 #line 3014 "parser.y"
6467     {PASS12 (yyval.classinfo)=0;}
6468     }
6469     break;
6470
6471
6472   
6473     case 206:
6474     if(as3_pass==2) {
6475
6476 /* Line 1464 of skeleton.m4  */
6477 #line 3018 "parser.y"
6478     {(yyval.value_list).cc=0;(yyval.value_list).number=0;}
6479     }
6480     break;
6481
6482
6483   
6484     case 207:
6485     if(as3_pass==2) {
6486
6487 /* Line 1464 of skeleton.m4  */
6488 #line 3019 "parser.y"
6489     {(yyval.value_list)=(yyvsp[(2) - (3)].value_list);}
6490     }
6491     break;
6492
6493
6494   
6495     case 208:
6496     if(as3_pass==2) {
6497
6498 /* Line 1464 of skeleton.m4  */
6499 #line 3021 "parser.y"
6500     {(yyval.value_list).cc=0;(yyval.value_list).number=0;}
6501     }
6502     break;
6503
6504
6505   
6506     case 211:
6507     if(as3_pass==2) {
6508
6509 /* Line 1464 of skeleton.m4  */
6510 #line 3025 "parser.y"
6511     {(yyval.value_list).number=1;
6512                                                   (yyval.value_list).cc = (yyvsp[(1) - (1)].value).c;
6513                                                  }
6514     }
6515     break;
6516
6517
6518   
6519     case 212:
6520     if(as3_pass==2) {
6521
6522 /* Line 1464 of skeleton.m4  */
6523 #line 3029 "parser.y"
6524     {(yyval.value_list) = (yyvsp[(1) - (2)].value_list);}
6525     }
6526     break;
6527
6528
6529   
6530     case 213:
6531     if(as3_pass==2) {
6532
6533 /* Line 1464 of skeleton.m4  */
6534 #line 3030 "parser.y"
6535     {
6536                                                   (yyval.value_list).number= (yyvsp[(1) - (2)].value_list).number+1;
6537                                                   (yyval.value_list).cc = code_append((yyvsp[(1) - (2)].value_list).cc, (yyvsp[(2) - (2)].value).c);
6538                                                   }
6539     }
6540     break;
6541
6542
6543   
6544     case 215:
6545     if(as3_pass==2) {
6546
6547 /* Line 1464 of skeleton.m4  */
6548 #line 3036 "parser.y"
6549     {
6550     (yyval.value).c = (yyvsp[(2) - (4)].value).c;
6551     if((yyval.value).c->opcode == OPCODE_COERCE_A) (yyval.value).c = code_cutlast((yyval.value).c);
6552     
6553     code_t*paramcode = (yyvsp[(4) - (4)].value_list).cc;
6554     if((yyval.value).c->opcode == OPCODE_GETPROPERTY) {
6555         multiname_t*name = (yyval.value).c->data[0];(yyval.value).c->data[0]=0;
6556         (yyval.value).c = code_cutlast((yyval.value).c);
6557         (yyval.value).c = code_append((yyval.value).c, paramcode);
6558         (yyval.value).c = abc_constructprop2((yyval.value).c, name, (yyvsp[(4) - (4)].value_list).number);
6559         multiname_destroy(name);
6560     } else if((yyval.value).c->opcode == OPCODE_GETSLOT) {
6561         int slot = (int)(ptroff_t)(yyval.value).c->data[0];
6562         trait_t*t = traits_find_slotid(state->cls->abc->traits,slot);//FIXME
6563         multiname_t*name = t->name;
6564         (yyval.value).c = code_cutlast((yyval.value).c);
6565         (yyval.value).c = code_append((yyval.value).c, paramcode);
6566         (yyval.value).c = abc_constructprop2((yyval.value).c, name, (yyvsp[(4) - (4)].value_list).number);
6567     } else {
6568         (yyval.value).c = code_append((yyval.value).c, paramcode);
6569         (yyval.value).c = abc_construct((yyval.value).c, (yyvsp[(4) - (4)].value_list).number);
6570     }
6571    
6572     (yyval.value).t = TYPE_ANY;
6573     if(TYPE_IS_CLASS((yyvsp[(2) - (4)].value).t) && (yyvsp[(2) - (4)].value).t->data) {
6574         (yyval.value).t = (yyvsp[(2) - (4)].value).t->data;
6575     } else {
6576         (yyval.value).c = abc_coerce_a((yyval.value).c);
6577         (yyval.value).t = TYPE_ANY;
6578     }
6579 }
6580     }
6581     break;
6582
6583
6584   
6585     case 216:
6586     if(as3_pass==2) {
6587
6588 /* Line 1464 of skeleton.m4  */
6589 #line 3072 "parser.y"
6590     {
6591     
6592     (yyval.value).c = (yyvsp[(1) - (4)].value).c;
6593     if((yyval.value).c->opcode == OPCODE_COERCE_A) {
6594         (yyval.value).c = code_cutlast((yyval.value).c);
6595     }
6596     code_t*paramcode = (yyvsp[(3) - (4)].value_list).cc;
6597
6598     (yyval.value).t = TYPE_ANY;
6599     if((yyval.value).c->opcode == OPCODE_GETPROPERTY) {
6600         multiname_t*name = (yyval.value).c->data[0];(yyval.value).c->data[0]=0;
6601         (yyval.value).c = code_cutlast((yyval.value).c);
6602         (yyval.value).c = code_append((yyval.value).c, paramcode);
6603         (yyval.value).c = abc_callproperty2((yyval.value).c, name, (yyvsp[(3) - (4)].value_list).number);
6604         multiname_destroy(name);
6605     } else if((yyval.value).c->opcode == OPCODE_GETSLOT && (yyval.value).c->prev->opcode != OPCODE_GETSCOPEOBJECT) {
6606         int slot = (int)(ptroff_t)(yyval.value).c->data[0];
6607         trait_t*t = traits_find_slotid(state->cls->abc->traits,slot);
6608         if(t->kind!=TRAIT_METHOD) {
6609             //ok: flash allows to assign closures to members.
6610         }
6611         multiname_t*name = t->name;
6612         (yyval.value).c = code_cutlast((yyval.value).c);
6613         (yyval.value).c = code_append((yyval.value).c, paramcode);
6614         //$$.c = abc_callmethod($$.c, t->method, len); //#1051 illegal early access binding
6615         (yyval.value).c = abc_callproperty2((yyval.value).c, name, (yyvsp[(3) - (4)].value_list).number);
6616     } else if((yyval.value).c->opcode == OPCODE_GETSUPER) {
6617         multiname_t*name = (yyval.value).c->data[0];(yyval.value).c->data[0]=0;
6618         (yyval.value).c = code_cutlast((yyval.value).c);
6619         (yyval.value).c = code_append((yyval.value).c, paramcode);
6620         (yyval.value).c = abc_callsuper2((yyval.value).c, name, (yyvsp[(3) - (4)].value_list).number);
6621         multiname_destroy(name);
6622     } else {
6623         (yyval.value).c = abc_getglobalscope((yyval.value).c);
6624         (yyval.value).c = code_append((yyval.value).c, paramcode);
6625         (yyval.value).c = abc_call((yyval.value).c, (yyvsp[(3) - (4)].value_list).number);
6626     }
6627    
6628     if(TYPE_IS_FUNCTION((yyvsp[(1) - (4)].value).t) && (yyvsp[(1) - (4)].value).t->data) {
6629         (yyval.value).t = ((methodinfo_t*)((yyvsp[(1) - (4)].value).t->data))->return_type;
6630     } else {
6631         (yyval.value).c = abc_coerce_a((yyval.value).c);
6632         (yyval.value).t = TYPE_ANY;
6633     }
6634 }
6635     }
6636     break;
6637
6638
6639   
6640     case 217:
6641     if(as3_pass==2) {
6642
6643 /* Line 1464 of skeleton.m4  */
6644 #line 3118 "parser.y"
6645     {
6646     if(!state->cls) syntaxerror("super() not allowed outside of a class");
6647     if(!state->method) syntaxerror("super() not allowed outside of a function");
6648     if(!state->method->is_constructor) syntaxerror("super() not allowed outside of a constructor");
6649
6650     (yyval.value).c = code_new();
6651     (yyval.value).c = abc_getlocal_0((yyval.value).c);
6652
6653     (yyval.value).c = code_append((yyval.value).c, (yyvsp[(3) - (4)].value_list).cc);
6654     /*
6655     this is dependent on the control path, check this somewhere else
6656     if(state->method->has_super)
6657         syntaxerror("constructor may call super() only once");
6658     */
6659     state->method->has_super = 1;
6660
6661     (yyval.value).c = abc_constructsuper((yyval.value).c, (yyvsp[(3) - (4)].value_list).number);
6662     (yyval.value).c = abc_pushundefined((yyval.value).c);
6663     (yyval.value).t = TYPE_ANY;
6664 }
6665     }
6666     break;
6667
6668
6669   
6670     case 218:
6671     if(as3_pass==2) {
6672
6673 /* Line 1464 of skeleton.m4  */
6674 #line 3139 "parser.y"
6675     {
6676     (yyval.value).c = (yyvsp[(2) - (2)].value).c;
6677     if((yyval.value).c->opcode == OPCODE_COERCE_A) {
6678         (yyval.value).c = code_cutlast((yyval.value).c);
6679     }
6680     multiname_t*name = 0;
6681     if((yyval.value).c->opcode == OPCODE_GETPROPERTY) {
6682         (yyval.value).c->opcode = OPCODE_DELETEPROPERTY;
6683     } else if((yyval.value).c->opcode == OPCODE_GETSLOT) {
6684         int slot = (int)(ptroff_t)(yyval.value).c->data[0];
6685         multiname_t*name = traits_find_slotid(state->cls->abc->traits,slot)->name;
6686         (yyval.value).c = code_cutlast((yyval.value).c);
6687         (yyval.value).c = abc_deleteproperty2((yyval.value).c, name);
6688     } else {
6689         (yyval.value).c = abc_getlocal_0((yyval.value).c);
6690         MULTINAME_LATE(m, (yyvsp[(2) - (2)].value).t?(yyvsp[(2) - (2)].value).t->access:ACCESS_PACKAGE, "");
6691         (yyval.value).c = abc_deleteproperty2((yyval.value).c, &m);
6692     }
6693     (yyval.value).t = TYPE_BOOLEAN;
6694 }
6695     }
6696     break;
6697
6698
6699   
6700     case 219:
6701     if(as3_pass==2) {
6702
6703 /* Line 1464 of skeleton.m4  */
6704 #line 3160 "parser.y"
6705     {
6706     (yyval.code) = abc_returnvoid(0);
6707 }
6708     }
6709     break;
6710
6711
6712   
6713     case 220:
6714     if(as3_pass==2) {
6715
6716 /* Line 1464 of skeleton.m4  */
6717 #line 3163 "parser.y"
6718     {
6719     (yyval.code) = (yyvsp[(2) - (2)].value).c;
6720     (yyval.code) = abc_returnvalue((yyval.code));
6721 }
6722     }
6723     break;
6724
6725
6726   
6727     case 221:
6728     if(as3_pass==2) {
6729
6730 /* Line 1464 of skeleton.m4  */
6731 #line 3170 "parser.y"
6732     {(yyval.value)=(yyvsp[(1) - (1)].value);}
6733     }
6734     break;
6735
6736
6737   
6738     case 222:
6739     if(as3_pass==2) {
6740
6741 /* Line 1464 of skeleton.m4  */
6742 #line 3171 "parser.y"
6743     {(yyval.value) = (yyvsp[(1) - (1)].value);}
6744     }
6745     break;
6746
6747
6748   
6749     case 223:
6750     if(as3_pass==2) {
6751
6752 /* Line 1464 of skeleton.m4  */
6753 #line 3172 "parser.y"
6754     {
6755     (yyval.value).c = (yyvsp[(1) - (3)].value).c;
6756     (yyval.value).c = cut_last_push((yyval.value).c);
6757     (yyval.value).c = code_append((yyval.value).c,(yyvsp[(3) - (3)].value).c);
6758     (yyval.value).t = (yyvsp[(3) - (3)].value).t;
6759 }
6760     }
6761     break;
6762
6763
6764   
6765     case 224:
6766     if(as3_pass==2) {
6767
6768 /* Line 1464 of skeleton.m4  */
6769 #line 3178 "parser.y"
6770     {
6771     (yyval.code)=cut_last_push((yyvsp[(1) - (1)].value).c);
6772 }
6773     }
6774     break;
6775
6776
6777   
6778     case 225:
6779     if(as3_pass==2) {
6780
6781 /* Line 1464 of skeleton.m4  */
6782 #line 3184 "parser.y"
6783     {(yyval.value) = (yyvsp[(1) - (1)].value);}
6784     }
6785     break;
6786
6787
6788   
6789     case 227:
6790     if(as3_pass==2) {
6791
6792 /* Line 1464 of skeleton.m4  */
6793 #line 3186 "parser.y"
6794     {(yyval.value) = (yyvsp[(1) - (1)].value);}
6795     }
6796     break;
6797
6798
6799   
6800     case 228:
6801     if(as3_pass==2) {
6802
6803 /* Line 1464 of skeleton.m4  */
6804 #line 3187 "parser.y"
6805     {(yyval.value) = (yyvsp[(1) - (1)].value);}
6806     }
6807     break;
6808
6809
6810   
6811     case 229:
6812     if(as3_pass==2) {
6813
6814 /* Line 1464 of skeleton.m4  */
6815 #line 3188 "parser.y"
6816     {(yyval.value) = (yyvsp[(1) - (1)].value);}
6817     }
6818     break;
6819
6820
6821   
6822     case 231:
6823     if(as3_pass==2) {
6824
6825 /* Line 1464 of skeleton.m4  */
6826 #line 3192 "parser.y"
6827     {
6828     (yyval.value).c = 0;
6829     namespace_t ns = {ACCESS_PACKAGE, ""};
6830     multiname_t m = {QNAME, &ns, 0, "RegExp"};
6831     if(!(yyvsp[(1) - (1)].regexp).options) {
6832         (yyval.value).c = abc_getlex2((yyval.value).c, &m);
6833         (yyval.value).c = abc_pushstring((yyval.value).c, (yyvsp[(1) - (1)].regexp).pattern);
6834         (yyval.value).c = abc_construct((yyval.value).c, 1);
6835     } else {
6836         (yyval.value).c = abc_getlex2((yyval.value).c, &m);
6837         (yyval.value).c = abc_pushstring((yyval.value).c, (yyvsp[(1) - (1)].regexp).pattern);
6838         (yyval.value).c = abc_pushstring((yyval.value).c, (yyvsp[(1) - (1)].regexp).options);
6839         (yyval.value).c = abc_construct((yyval.value).c, 2);
6840     }
6841     (yyval.value).t = TYPE_REGEXP;
6842 }
6843     }
6844     break;
6845
6846
6847   
6848     case 232:
6849     if(as3_pass==2) {
6850
6851 /* Line 1464 of skeleton.m4  */
6852 #line 3209 "parser.y"
6853     {(yyval.value).c = abc_pushbyte(0, (yyvsp[(1) - (1)].number_uint));
6854                    //MULTINAME(m, registry_getintclass());
6855                    //$$.c = abc_coerce2($$.c, &m); // FIXME
6856                    (yyval.value).t = TYPE_INT;
6857                   }
6858     }
6859     break;
6860
6861
6862   
6863     case 233:
6864     if(as3_pass==2) {
6865
6866 /* Line 1464 of skeleton.m4  */
6867 #line 3214 "parser.y"
6868     {(yyval.value).c = abc_pushshort(0, (yyvsp[(1) - (1)].number_uint));
6869                     (yyval.value).t = TYPE_INT;
6870                    }
6871     }
6872     break;
6873
6874
6875   
6876     case 234:
6877     if(as3_pass==2) {
6878
6879 /* Line 1464 of skeleton.m4  */
6880 #line 3217 "parser.y"
6881     {(yyval.value).c = abc_pushint(0, (yyvsp[(1) - (1)].number_int));
6882                   (yyval.value).t = TYPE_INT;
6883                  }
6884     }
6885     break;
6886
6887
6888   
6889     case 235:
6890     if(as3_pass==2) {
6891
6892 /* Line 1464 of skeleton.m4  */
6893 #line 3220 "parser.y"
6894     {(yyval.value).c = abc_pushuint(0, (yyvsp[(1) - (1)].number_uint));
6895                    (yyval.value).t = TYPE_UINT;
6896                   }
6897     }
6898     break;
6899
6900
6901   
6902     case 236:
6903     if(as3_pass==2) {
6904
6905 /* Line 1464 of skeleton.m4  */
6906 #line 3223 "parser.y"
6907     {(yyval.value).c = abc_pushdouble(0, (yyvsp[(1) - (1)].number_float));
6908                     (yyval.value).t = TYPE_FLOAT;
6909                    }
6910     }
6911     break;
6912
6913
6914   
6915     case 237:
6916     if(as3_pass==2) {
6917
6918 /* Line 1464 of skeleton.m4  */
6919 #line 3226 "parser.y"
6920     {(yyval.value).c = abc_pushstring2(0, &(yyvsp[(1) - (1)].str));free((char*)(yyvsp[(1) - (1)].str).str);
6921                      (yyval.value).t = TYPE_STRING;
6922                     }
6923     }
6924     break;
6925
6926
6927   
6928     case 238:
6929     if(as3_pass==2) {
6930
6931 /* Line 1464 of skeleton.m4  */
6932 #line 3229 "parser.y"
6933     {(yyval.value).c = abc_pushundefined(0);
6934                     (yyval.value).t = TYPE_ANY;
6935                    }
6936     }
6937     break;
6938
6939
6940   
6941     case 239:
6942     if(as3_pass==2) {
6943
6944 /* Line 1464 of skeleton.m4  */
6945 #line 3232 "parser.y"
6946     {(yyval.value).c = abc_pushtrue(0);
6947                     (yyval.value).t = TYPE_BOOLEAN;
6948                    }
6949     }
6950     break;
6951
6952
6953   
6954     case 240:
6955     if(as3_pass==2) {
6956
6957 /* Line 1464 of skeleton.m4  */
6958 #line 3235 "parser.y"
6959     {(yyval.value).c = abc_pushfalse(0);
6960                      (yyval.value).t = TYPE_BOOLEAN;
6961                     }
6962     }
6963     break;
6964
6965
6966   
6967     case 241:
6968     if(as3_pass==2) {
6969
6970 /* Line 1464 of skeleton.m4  */
6971 #line 3238 "parser.y"
6972     {(yyval.value).c = abc_pushnull(0);
6973                     (yyval.value).t = TYPE_NULL;
6974                    }
6975     }
6976     break;
6977
6978
6979   
6980     case 242:
6981     if(as3_pass==2) {
6982
6983 /* Line 1464 of skeleton.m4  */
6984 #line 3242 "parser.y"
6985     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterequals((yyval.value).c);(yyval.value).c=abc_not((yyval.value).c);
6986              (yyval.value).t = TYPE_BOOLEAN;
6987             }
6988     }
6989     break;
6990
6991
6992   
6993     case 243:
6994     if(as3_pass==2) {
6995
6996 /* Line 1464 of skeleton.m4  */
6997 #line 3245 "parser.y"
6998     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterthan((yyval.value).c);
6999              (yyval.value).t = TYPE_BOOLEAN;
7000             }
7001     }
7002     break;
7003
7004
7005   
7006     case 244:
7007     if(as3_pass==2) {
7008
7009 /* Line 1464 of skeleton.m4  */
7010 #line 3248 "parser.y"
7011     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterthan((yyval.value).c);(yyval.value).c=abc_not((yyval.value).c);
7012               (yyval.value).t = TYPE_BOOLEAN;
7013              }
7014     }
7015     break;
7016
7017
7018   
7019     case 245:
7020     if(as3_pass==2) {
7021
7022 /* Line 1464 of skeleton.m4  */
7023 #line 3251 "parser.y"
7024     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_greaterequals((yyval.value).c);
7025               (yyval.value).t = TYPE_BOOLEAN;
7026              }
7027     }
7028     break;
7029
7030
7031   
7032     case 246:
7033     if(as3_pass==2) {
7034
7035 /* Line 1464 of skeleton.m4  */
7036 #line 3254 "parser.y"
7037     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_equals((yyval.value).c);
7038               (yyval.value).t = TYPE_BOOLEAN;
7039              }
7040     }
7041     break;
7042
7043
7044   
7045     case 247:
7046     if(as3_pass==2) {
7047
7048 /* Line 1464 of skeleton.m4  */
7049 #line 3257 "parser.y"
7050     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_strictequals((yyval.value).c);
7051               (yyval.value).t = TYPE_BOOLEAN;
7052               }
7053     }
7054     break;
7055
7056
7057   
7058     case 248:
7059     if(as3_pass==2) {
7060
7061 /* Line 1464 of skeleton.m4  */
7062 #line 3260 "parser.y"
7063     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_strictequals((yyval.value).c);(yyval.value).c = abc_not((yyval.value).c);
7064               (yyval.value).t = TYPE_BOOLEAN;
7065              }
7066     }
7067     break;
7068
7069
7070   
7071     case 249:
7072     if(as3_pass==2) {
7073
7074 /* Line 1464 of skeleton.m4  */
7075 #line 3263 "parser.y"
7076     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);(yyval.value).c = abc_equals((yyval.value).c);(yyval.value).c = abc_not((yyval.value).c);
7077               (yyval.value).t = TYPE_BOOLEAN;
7078              }
7079     }
7080     break;
7081
7082
7083   
7084     case 250:
7085     if(as3_pass==2) {
7086
7087 /* Line 1464 of skeleton.m4  */
7088 #line 3267 "parser.y"
7089     {(yyval.value).t = join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'O');
7090               (yyval.value).c = (yyvsp[(1) - (3)].value).c;
7091               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(1) - (3)].value).t, (yyval.value).t);
7092               (yyval.value).c = abc_dup((yyval.value).c);
7093               code_t*jmp = (yyval.value).c = abc_iftrue((yyval.value).c, 0);
7094               (yyval.value).c = cut_last_push((yyval.value).c);
7095               (yyval.value).c = code_append((yyval.value).c,(yyvsp[(3) - (3)].value).c);
7096               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(3) - (3)].value).t, (yyval.value).t);
7097               code_t*label = (yyval.value).c = abc_label((yyval.value).c);
7098               jmp->branch = label;
7099              }
7100     }
7101     break;
7102
7103
7104   
7105     case 251:
7106     if(as3_pass==2) {
7107
7108 /* Line 1464 of skeleton.m4  */
7109 #line 3278 "parser.y"
7110     {
7111               (yyval.value).t = join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'A');
7112               /*printf("%08x:\n",$1.t);
7113               code_dump($1.c, 0, 0, "", stdout);
7114               printf("%08x:\n",$3.t);
7115               code_dump($3.c, 0, 0, "", stdout);
7116               printf("joining %08x and %08x to %08x\n", $1.t, $3.t, $$.t);*/
7117               (yyval.value).c = (yyvsp[(1) - (3)].value).c;
7118               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(1) - (3)].value).t, (yyval.value).t);
7119               (yyval.value).c = abc_dup((yyval.value).c);
7120               code_t*jmp = (yyval.value).c = abc_iffalse((yyval.value).c, 0);
7121               (yyval.value).c = cut_last_push((yyval.value).c);
7122               (yyval.value).c = code_append((yyval.value).c,(yyvsp[(3) - (3)].value).c);
7123               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(3) - (3)].value).t, (yyval.value).t);
7124               code_t*label = (yyval.value).c = abc_label((yyval.value).c);
7125               jmp->branch = label;              
7126              }
7127     }
7128     break;
7129
7130
7131   
7132     case 252:
7133     if(as3_pass==2) {
7134
7135 /* Line 1464 of skeleton.m4  */
7136 #line 3296 "parser.y"
7137     {(yyval.value).c=(yyvsp[(2) - (2)].value).c;
7138               (yyval.value).c = abc_not((yyval.value).c);
7139               (yyval.value).t = TYPE_BOOLEAN;
7140              }
7141     }
7142     break;
7143
7144
7145   
7146     case 253:
7147     if(as3_pass==2) {
7148
7149 /* Line 1464 of skeleton.m4  */
7150 #line 3301 "parser.y"
7151     {(yyval.value).c=(yyvsp[(2) - (2)].value).c;
7152               (yyval.value).c = abc_bitnot((yyval.value).c);
7153               (yyval.value).t = TYPE_INT;
7154              }
7155     }
7156     break;
7157
7158
7159   
7160     case 254:
7161     if(as3_pass==2) {
7162
7163 /* Line 1464 of skeleton.m4  */
7164 #line 3306 "parser.y"
7165     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7166              (yyval.value).c = abc_bitand((yyval.value).c);
7167              (yyval.value).t = TYPE_INT;
7168             }
7169     }
7170     break;
7171
7172
7173   
7174     case 255:
7175     if(as3_pass==2) {
7176
7177 /* Line 1464 of skeleton.m4  */
7178 #line 3311 "parser.y"
7179     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7180              (yyval.value).c = abc_bitxor((yyval.value).c);
7181              (yyval.value).t = TYPE_INT;
7182             }
7183     }
7184     break;
7185
7186
7187   
7188     case 256:
7189     if(as3_pass==2) {
7190
7191 /* Line 1464 of skeleton.m4  */
7192 #line 3316 "parser.y"
7193     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7194              (yyval.value).c = abc_bitor((yyval.value).c);
7195              (yyval.value).t = TYPE_INT;
7196             }
7197     }
7198     break;
7199
7200
7201   
7202     case 257:
7203     if(as3_pass==2) {
7204
7205 /* Line 1464 of skeleton.m4  */
7206 #line 3321 "parser.y"
7207     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7208              (yyval.value).c = abc_rshift((yyval.value).c);
7209              (yyval.value).t = TYPE_INT;
7210             }
7211     }
7212     break;
7213
7214
7215   
7216     case 258:
7217     if(as3_pass==2) {
7218
7219 /* Line 1464 of skeleton.m4  */
7220 #line 3325 "parser.y"
7221     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7222              (yyval.value).c = abc_urshift((yyval.value).c);
7223              (yyval.value).t = TYPE_INT;
7224             }
7225     }
7226     break;
7227
7228
7229   
7230     case 259:
7231     if(as3_pass==2) {
7232
7233 /* Line 1464 of skeleton.m4  */
7234 #line 3329 "parser.y"
7235     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7236              (yyval.value).c = abc_lshift((yyval.value).c);
7237              (yyval.value).t = TYPE_INT;
7238             }
7239     }
7240     break;
7241
7242
7243   
7244     case 260:
7245     if(as3_pass==2) {
7246
7247 /* Line 1464 of skeleton.m4  */
7248 #line 3334 "parser.y"
7249     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7250              (yyval.value).c = abc_divide((yyval.value).c);
7251              (yyval.value).t = TYPE_NUMBER;
7252             }
7253     }
7254     break;
7255
7256
7257   
7258     case 261:
7259     if(as3_pass==2) {
7260
7261 /* Line 1464 of skeleton.m4  */
7262 #line 3338 "parser.y"
7263     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7264              (yyval.value).c = abc_modulo((yyval.value).c);
7265              (yyval.value).t = TYPE_NUMBER;
7266             }
7267     }
7268     break;
7269
7270
7271   
7272     case 262:
7273     if(as3_pass==2) {
7274
7275 /* Line 1464 of skeleton.m4  */
7276 #line 3342 "parser.y"
7277     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7278              if(BOTH_INT((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t)) {
7279                 (yyval.value).c = abc_add_i((yyval.value).c);
7280                 (yyval.value).t = TYPE_INT;
7281              } else {
7282                 (yyval.value).c = abc_add((yyval.value).c);
7283                 (yyval.value).t = join_types((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t,'+');
7284              }
7285             }
7286     }
7287     break;
7288
7289
7290   
7291     case 263:
7292     if(as3_pass==2) {
7293
7294 /* Line 1464 of skeleton.m4  */
7295 #line 3351 "parser.y"
7296     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7297              if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) {
7298                 (yyval.value).c = abc_subtract_i((yyval.value).c);
7299                 (yyval.value).t = TYPE_INT;
7300              } else {
7301                 (yyval.value).c = abc_subtract((yyval.value).c);
7302                 (yyval.value).t = TYPE_NUMBER;
7303              }
7304             }
7305     }
7306     break;
7307
7308
7309   
7310     case 264:
7311     if(as3_pass==2) {
7312
7313 /* Line 1464 of skeleton.m4  */
7314 #line 3360 "parser.y"
7315     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7316              if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) {
7317                 (yyval.value).c = abc_multiply_i((yyval.value).c);
7318                 (yyval.value).t = TYPE_INT;
7319              } else {
7320                 (yyval.value).c = abc_multiply((yyval.value).c);
7321                 (yyval.value).t = TYPE_NUMBER;
7322              }
7323             }
7324     }
7325     break;
7326
7327
7328   
7329     case 265:
7330     if(as3_pass==2) {
7331
7332 /* Line 1464 of skeleton.m4  */
7333 #line 3370 "parser.y"
7334     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c,(yyvsp[(3) - (3)].value).c);
7335               (yyval.value).c = abc_in((yyval.value).c);
7336               (yyval.value).t = TYPE_BOOLEAN;
7337              }
7338     }
7339     break;
7340
7341
7342   
7343     case 266:
7344     if(as3_pass==2) {
7345
7346 /* Line 1464 of skeleton.m4  */
7347 #line 3375 "parser.y"
7348     {char use_astype=0; // flash player's astype works differently than astypelate
7349               if(use_astype && TYPE_IS_CLASS((yyvsp[(3) - (3)].value).t) && (yyvsp[(3) - (3)].value).t->data) {
7350                 MULTINAME(m, (classinfo_t*)((yyvsp[(3) - (3)].value).t->data));
7351                 (yyval.value).c = abc_astype2((yyvsp[(1) - (3)].value).c, &m);
7352                 (yyval.value).t = (yyvsp[(3) - (3)].value).t->data;
7353               } else {
7354                 (yyval.value).c = code_append((yyvsp[(1) - (3)].value).c, (yyvsp[(3) - (3)].value).c);
7355                 (yyval.value).c = abc_astypelate((yyval.value).c);
7356                 (yyval.value).t = TYPE_ANY;
7357               }
7358              }
7359     }
7360     break;
7361
7362
7363   
7364     case 267:
7365     if(as3_pass==2) {
7366
7367 /* Line 1464 of skeleton.m4  */
7368 #line 3388 "parser.y"
7369     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c, (yyvsp[(3) - (3)].value).c);
7370               (yyval.value).c = abc_instanceof((yyval.value).c);
7371               (yyval.value).t = TYPE_BOOLEAN;
7372              }
7373     }
7374     break;
7375
7376
7377   
7378     case 268:
7379     if(as3_pass==2) {
7380
7381 /* Line 1464 of skeleton.m4  */
7382 #line 3393 "parser.y"
7383     {(yyval.value).c = code_append((yyvsp[(1) - (3)].value).c, (yyvsp[(3) - (3)].value).c);
7384               (yyval.value).c = abc_istypelate((yyval.value).c);
7385               (yyval.value).t = TYPE_BOOLEAN;
7386              }
7387     }
7388     break;
7389
7390
7391   
7392     case 269:
7393     if(as3_pass==2) {
7394
7395 /* Line 1464 of skeleton.m4  */
7396 #line 3398 "parser.y"
7397     {
7398               (yyval.value).c = (yyvsp[(3) - (4)].value).c;
7399               (yyval.value).c = abc_typeof((yyval.value).c);
7400               (yyval.value).t = TYPE_STRING;
7401              }
7402     }
7403     break;
7404
7405
7406   
7407     case 270:
7408     if(as3_pass==2) {
7409
7410 /* Line 1464 of skeleton.m4  */
7411 #line 3404 "parser.y"
7412     {
7413               (yyval.value).c = cut_last_push((yyvsp[(2) - (2)].value).c);
7414               (yyval.value).c = abc_pushundefined((yyval.value).c);
7415               (yyval.value).t = TYPE_ANY;
7416              }
7417     }
7418     break;
7419
7420
7421   
7422     case 271:
7423     if(as3_pass==2) {
7424
7425 /* Line 1464 of skeleton.m4  */
7426 #line 3410 "parser.y"
7427     { (yyval.value).c = abc_pushundefined(0);
7428              (yyval.value).t = TYPE_ANY;
7429            }
7430     }
7431     break;
7432
7433
7434   
7435     case 272:
7436     if(as3_pass==2) {
7437
7438 /* Line 1464 of skeleton.m4  */
7439 #line 3414 "parser.y"
7440     {(yyval.value)=(yyvsp[(2) - (3)].value);}
7441     }
7442     break;
7443
7444
7445   
7446     case 273:
7447     if(as3_pass==2) {
7448
7449 /* Line 1464 of skeleton.m4  */
7450 #line 3416 "parser.y"
7451     {
7452   (yyval.value)=(yyvsp[(2) - (2)].value);
7453   if(IS_INT((yyvsp[(2) - (2)].value).t)) {
7454    (yyval.value).c=abc_negate_i((yyval.value).c);
7455    (yyval.value).t = TYPE_INT;
7456   } else {
7457    (yyval.value).c=abc_negate((yyval.value).c);
7458    (yyval.value).t = TYPE_NUMBER;
7459   }
7460 }
7461     }
7462     break;
7463
7464
7465   
7466     case 274:
7467     if(as3_pass==2) {
7468
7469 /* Line 1464 of skeleton.m4  */
7470 #line 3427 "parser.y"
7471     {
7472   (yyval.value).c = (yyvsp[(1) - (4)].value).c;
7473   (yyval.value).c = code_append((yyval.value).c, (yyvsp[(3) - (4)].value).c);
7474
7475   MULTINAME_LATE(m, (yyvsp[(1) - (4)].value).t?(yyvsp[(1) - (4)].value).t->access:ACCESS_PACKAGE, "");
7476   (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
7477   (yyval.value).t = 0; // array elements have unknown type
7478 }
7479     }
7480     break;
7481
7482
7483   
7484     case 275:
7485     if(as3_pass==2) {
7486
7487 /* Line 1464 of skeleton.m4  */
7488 #line 3436 "parser.y"
7489     {
7490     (yyval.value).c = code_new();
7491     (yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc);
7492     (yyval.value).c = abc_newarray((yyval.value).c, (yyvsp[(2) - (3)].value_list).number);
7493     (yyval.value).t = registry_getarrayclass();
7494 }
7495     }
7496     break;
7497
7498
7499   
7500     case 276:
7501     if(as3_pass==2) {
7502
7503 /* Line 1464 of skeleton.m4  */
7504 #line 3443 "parser.y"
7505     {(yyval.value_list).cc=0;(yyval.value_list).number=0;}
7506     }
7507     break;
7508
7509
7510   
7511     case 277:
7512     if(as3_pass==2) {
7513
7514 /* Line 1464 of skeleton.m4  */
7515 #line 3444 "parser.y"
7516     {(yyval.value_list)=(yyvsp[(1) - (1)].value_list);}
7517     }
7518     break;
7519
7520
7521   
7522     case 278:
7523     if(as3_pass==2) {
7524
7525 /* Line 1464 of skeleton.m4  */
7526 #line 3446 "parser.y"
7527     {
7528     (yyval.value_list).cc = 0;
7529     (yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(1) - (3)].value).c);
7530     (yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(3) - (3)].value).c);
7531     (yyval.value_list).number = 2;
7532 }
7533     }
7534     break;
7535
7536
7537   
7538     case 279:
7539     if(as3_pass==2) {
7540
7541 /* Line 1464 of skeleton.m4  */
7542 #line 3452 "parser.y"
7543     {
7544     (yyval.value_list).cc = (yyvsp[(1) - (5)].value_list).cc;
7545     (yyval.value_list).number = (yyvsp[(1) - (5)].value_list).number+2;
7546     (yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(3) - (5)].value).c);
7547     (yyval.value_list).cc = code_append((yyval.value_list).cc, (yyvsp[(5) - (5)].value).c);
7548 }
7549     }
7550     break;
7551
7552
7553   
7554     case 280:
7555     if(as3_pass==2) {
7556
7557 /* Line 1464 of skeleton.m4  */
7558 #line 3461 "parser.y"
7559     {
7560     (yyval.value).c = code_new();
7561     (yyval.value).c = code_append((yyval.value).c, (yyvsp[(2) - (3)].value_list).cc);
7562     (yyval.value).c = abc_newobject((yyval.value).c, (yyvsp[(2) - (3)].value_list).number/2);
7563     (yyval.value).t = registry_getobjectclass();
7564 }
7565     }
7566     break;
7567
7568
7569   
7570     case 281:
7571     if(as3_pass==2) {
7572
7573 /* Line 1464 of skeleton.m4  */
7574 #line 3468 "parser.y"
7575     { 
7576                code_t*c = (yyvsp[(3) - (3)].value).c;
7577                if(BOTH_INT((yyvsp[(1) - (3)].value).t,(yyvsp[(3) - (3)].value).t)) {
7578                 c=abc_multiply_i(c);
7579                } else {
7580                 c=abc_multiply(c);
7581                }
7582                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '*'), (yyvsp[(1) - (3)].value).t);
7583                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7584                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7585               }
7586     }
7587     break;
7588
7589
7590   
7591     case 282:
7592     if(as3_pass==2) {
7593
7594 /* Line 1464 of skeleton.m4  */
7595 #line 3480 "parser.y"
7596     { 
7597                code_t*c = abc_modulo((yyvsp[(3) - (3)].value).c);
7598                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '%'), (yyvsp[(1) - (3)].value).t);
7599                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7600                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7601               }
7602     }
7603     break;
7604
7605
7606   
7607     case 283:
7608     if(as3_pass==2) {
7609
7610 /* Line 1464 of skeleton.m4  */
7611 #line 3486 "parser.y"
7612     { 
7613                code_t*c = abc_lshift((yyvsp[(3) - (3)].value).c);
7614                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '<'), (yyvsp[(1) - (3)].value).t);
7615                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7616                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7617               }
7618     }
7619     break;
7620
7621
7622   
7623     case 284:
7624     if(as3_pass==2) {
7625
7626 /* Line 1464 of skeleton.m4  */
7627 #line 3492 "parser.y"
7628     { 
7629                code_t*c = abc_rshift((yyvsp[(3) - (3)].value).c);
7630                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '>'), (yyvsp[(1) - (3)].value).t);
7631                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7632                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7633               }
7634     }
7635     break;
7636
7637
7638   
7639     case 285:
7640     if(as3_pass==2) {
7641
7642 /* Line 1464 of skeleton.m4  */
7643 #line 3498 "parser.y"
7644     { 
7645                code_t*c = abc_urshift((yyvsp[(3) - (3)].value).c);
7646                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, 'U'), (yyvsp[(1) - (3)].value).t);
7647                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7648                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7649               }
7650     }
7651     break;
7652
7653
7654   
7655     case 286:
7656     if(as3_pass==2) {
7657
7658 /* Line 1464 of skeleton.m4  */
7659 #line 3504 "parser.y"
7660     { 
7661                code_t*c = abc_divide((yyvsp[(3) - (3)].value).c);
7662                c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '/'), (yyvsp[(1) - (3)].value).t);
7663                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7664                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7665               }
7666     }
7667     break;
7668
7669
7670   
7671     case 287:
7672     if(as3_pass==2) {
7673
7674 /* Line 1464 of skeleton.m4  */
7675 #line 3510 "parser.y"
7676     { 
7677                code_t*c = abc_bitor((yyvsp[(3) - (3)].value).c);
7678                c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t);
7679                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7680                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7681               }
7682     }
7683     break;
7684
7685
7686   
7687     case 288:
7688     if(as3_pass==2) {
7689
7690 /* Line 1464 of skeleton.m4  */
7691 #line 3516 "parser.y"
7692     { 
7693                code_t*c = abc_bitxor((yyvsp[(3) - (3)].value).c);
7694                c=converttype(c, TYPE_INT, (yyvsp[(1) - (3)].value).t);
7695                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7696                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7697               }
7698     }
7699     break;
7700
7701
7702   
7703     case 289:
7704     if(as3_pass==2) {
7705
7706 /* Line 1464 of skeleton.m4  */
7707 #line 3522 "parser.y"
7708     { 
7709                code_t*c = (yyvsp[(3) - (3)].value).c;
7710
7711                if(TYPE_IS_INT((yyvsp[(1) - (3)].value).t)) {
7712                 c=abc_add_i(c);
7713                } else {
7714                 c=abc_add(c);
7715                 c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '+'), (yyvsp[(1) - (3)].value).t);
7716                }
7717                
7718                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7719                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7720               }
7721     }
7722     break;
7723
7724
7725   
7726     case 290:
7727     if(as3_pass==2) {
7728
7729 /* Line 1464 of skeleton.m4  */
7730 #line 3535 "parser.y"
7731     { code_t*c = (yyvsp[(3) - (3)].value).c; 
7732                if(TYPE_IS_INT((yyvsp[(1) - (3)].value).t)) {
7733                 c=abc_subtract_i(c);
7734                } else {
7735                 c=abc_subtract(c);
7736                 c=converttype(c, join_types((yyvsp[(1) - (3)].value).t, (yyvsp[(3) - (3)].value).t, '-'), (yyvsp[(1) - (3)].value).t);
7737                }
7738                
7739                (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 0, 0);
7740                (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7741              }
7742     }
7743     break;
7744
7745
7746   
7747     case 291:
7748     if(as3_pass==2) {
7749
7750 /* Line 1464 of skeleton.m4  */
7751 #line 3546 "parser.y"
7752     { code_t*c = 0;
7753               c = code_append(c, (yyvsp[(3) - (3)].value).c);
7754               c = converttype(c, (yyvsp[(3) - (3)].value).t, (yyvsp[(1) - (3)].value).t);
7755               (yyval.value).c = toreadwrite((yyvsp[(1) - (3)].value).c, c, 1, 0);
7756               (yyval.value).t = (yyvsp[(1) - (3)].value).t;
7757             }
7758     }
7759     break;
7760
7761
7762   
7763     case 292:
7764     if(as3_pass==2) {
7765
7766 /* Line 1464 of skeleton.m4  */
7767 #line 3553 "parser.y"
7768     { 
7769               (yyval.value).t = join_types((yyvsp[(3) - (5)].value).t,(yyvsp[(5) - (5)].value).t,'?');
7770               (yyval.value).c = (yyvsp[(1) - (5)].value).c;
7771               code_t*j1 = (yyval.value).c = abc_iffalse((yyval.value).c, 0);
7772               (yyval.value).c = code_append((yyval.value).c, (yyvsp[(3) - (5)].value).c);
7773               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(3) - (5)].value).t, (yyval.value).t);
7774               code_t*j2 = (yyval.value).c = abc_jump((yyval.value).c, 0);
7775               (yyval.value).c = j1->branch = abc_label((yyval.value).c);
7776               (yyval.value).c = code_append((yyval.value).c, (yyvsp[(5) - (5)].value).c);
7777               (yyval.value).c = converttype((yyval.value).c, (yyvsp[(5) - (5)].value).t, (yyval.value).t);
7778               (yyval.value).c = j2->branch = abc_label((yyval.value).c);
7779             }
7780     }
7781     break;
7782
7783
7784   
7785     case 293:
7786     if(as3_pass==2) {
7787
7788 /* Line 1464 of skeleton.m4  */
7789 #line 3566 "parser.y"
7790     { code_t*c = 0;
7791              classinfo_t*type = (yyvsp[(1) - (2)].value).t;
7792              if(is_getlocal((yyvsp[(1) - (2)].value).c) && (TYPE_IS_INT((yyvsp[(1) - (2)].value).t) || TYPE_IS_NUMBER((yyvsp[(1) - (2)].value).t))) {
7793                  int nr = getlocalnr((yyvsp[(1) - (2)].value).c);
7794                  code_free((yyvsp[(1) - (2)].value).c);(yyvsp[(1) - (2)].value).c=0;
7795                  if(TYPE_IS_INT((yyvsp[(1) - (2)].value).t)) {
7796                     (yyval.value).c = abc_getlocal(0, nr);
7797                     (yyval.value).c = abc_inclocal_i((yyval.value).c, nr);
7798                  } else if(TYPE_IS_NUMBER((yyvsp[(1) - (2)].value).t)) {
7799                     (yyval.value).c = abc_getlocal(0, nr);
7800                     (yyval.value).c = abc_inclocal((yyval.value).c, nr);
7801                  } else syntaxerror("internal error");
7802              } else {
7803                  if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
7804                      c=abc_increment_i(c);
7805                      type = TYPE_INT;
7806                  } else {
7807                      c=abc_increment(c);
7808                      type = TYPE_NUMBER;
7809                  }
7810                  c=converttype(c, type, (yyvsp[(1) - (2)].value).t);
7811                  (yyval.value).c = toreadwrite((yyvsp[(1) - (2)].value).c, c, 0, 1);
7812                  (yyval.value).t = (yyvsp[(1) - (2)].value).t;
7813              }
7814            }
7815     }
7816     break;
7817
7818
7819   
7820     case 294:
7821     if(as3_pass==2) {
7822
7823 /* Line 1464 of skeleton.m4  */
7824 #line 3593 "parser.y"
7825     { code_t*c = 0;
7826              classinfo_t*type = (yyvsp[(1) - (2)].value).t;
7827              if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
7828                  c=abc_decrement_i(c);
7829                  type = TYPE_INT;
7830              } else {
7831                  c=abc_decrement(c);
7832                  type = TYPE_NUMBER;
7833              }
7834              c=converttype(c, type, (yyvsp[(1) - (2)].value).t);
7835              (yyval.value).c = toreadwrite((yyvsp[(1) - (2)].value).c, c, 0, 1);
7836              (yyval.value).t = (yyvsp[(1) - (2)].value).t;
7837             }
7838     }
7839     break;
7840
7841
7842   
7843     case 295:
7844     if(as3_pass==2) {
7845
7846 /* Line 1464 of skeleton.m4  */
7847 #line 3607 "parser.y"
7848     { code_t*c = 0;
7849              classinfo_t*type = (yyvsp[(2) - (2)].value).t;
7850              if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
7851                  c=abc_increment_i(c);
7852                  type = TYPE_INT;
7853              } else {
7854                  c=abc_increment(c);
7855                  type = TYPE_NUMBER;
7856              }
7857              c=converttype(c, type, (yyvsp[(2) - (2)].value).t);
7858              (yyval.value).c = toreadwrite((yyvsp[(2) - (2)].value).c, c, 0, 0);
7859              (yyval.value).t = (yyvsp[(2) - (2)].value).t;
7860            }
7861     }
7862     break;
7863
7864
7865   
7866     case 296:
7867     if(as3_pass==2) {
7868
7869 /* Line 1464 of skeleton.m4  */
7870 #line 3621 "parser.y"
7871     { code_t*c = 0;
7872              classinfo_t*type = (yyvsp[(2) - (2)].value).t;
7873              if(TYPE_IS_INT(type) || TYPE_IS_UINT(type)) {
7874                  c=abc_decrement_i(c);
7875                  type = TYPE_INT;
7876              } else {
7877                  c=abc_decrement(c);
7878                  type = TYPE_NUMBER;
7879              }
7880              c=converttype(c, type, (yyvsp[(2) - (2)].value).t);
7881              (yyval.value).c = toreadwrite((yyvsp[(2) - (2)].value).c, c, 0, 0);
7882              (yyval.value).t = (yyvsp[(2) - (2)].value).t;
7883            }
7884     }
7885     break;
7886
7887
7888   
7889     case 297:
7890     if(as3_pass==2) {
7891
7892 /* Line 1464 of skeleton.m4  */
7893 #line 3636 "parser.y"
7894     { if(!state->cls->info)
7895                   syntaxerror("super keyword not allowed outside a class");
7896               classinfo_t*t = state->cls->info->superclass;
7897               if(!t) t = TYPE_OBJECT;
7898
7899               memberinfo_t*f = findmember_nsset(t, (yyvsp[(3) - (3)].id), 1);
7900
7901               MEMBER_MULTINAME(m, f, (yyvsp[(3) - (3)].id));
7902               (yyval.value).c = 0;
7903               (yyval.value).c = abc_getlocal_0((yyval.value).c);
7904               (yyval.value).c = abc_getsuper2((yyval.value).c, &m);
7905               (yyval.value).t = slotinfo_gettype((slotinfo_t*)f);
7906            }
7907     }
7908     break;
7909
7910
7911   
7912     case 298:
7913     if(as3_pass==2) {
7914
7915 /* Line 1464 of skeleton.m4  */
7916 #line 3650 "parser.y"
7917     {
7918               // attribute TODO
7919               (yyval.value).c = abc_pushundefined(0);
7920               (yyval.value).t = 0;
7921               as3_warning("ignored @ operator");
7922            }
7923     }
7924     break;
7925
7926
7927   
7928     case 299:
7929     if(as3_pass==2) {
7930
7931 /* Line 1464 of skeleton.m4  */
7932 #line 3657 "parser.y"
7933     {
7934               // child attribute  TODO
7935               (yyval.value).c = abc_pushundefined(0);
7936               (yyval.value).t = 0;
7937               as3_warning("ignored .@ operator");
7938            }
7939     }
7940     break;
7941
7942
7943   
7944     case 300:
7945     if(as3_pass==2) {
7946
7947 /* Line 1464 of skeleton.m4  */
7948 #line 3664 "parser.y"
7949     {
7950               // namespace declaration TODO
7951               (yyval.value).c = abc_pushundefined(0);
7952               (yyval.value).t = 0;
7953               as3_warning("ignored :: operator");
7954            }
7955     }
7956     break;
7957
7958
7959   
7960     case 301:
7961     if(as3_pass==2) {
7962
7963 /* Line 1464 of skeleton.m4  */
7964 #line 3671 "parser.y"
7965     {
7966               // descendants TODO
7967               (yyval.value).c = abc_pushundefined(0);
7968               (yyval.value).t = 0;
7969               as3_warning("ignored .. operator");
7970            }
7971     }
7972     break;
7973
7974
7975   
7976     case 302:
7977     if(as3_pass==2) {
7978
7979 /* Line 1464 of skeleton.m4  */
7980 #line 3678 "parser.y"
7981     {
7982               // filter TODO
7983               (yyval.value).c = abc_pushundefined(0);
7984               (yyval.value).t = 0;
7985               as3_warning("ignored .() operator");
7986            }
7987     }
7988     break;
7989
7990
7991   
7992     case 303:
7993     if(as3_pass==2) {
7994
7995 /* Line 1464 of skeleton.m4  */
7996 #line 3693 "parser.y"
7997     {
7998     (yyval.value).c = (yyvsp[(1) - (3)].value).c;
7999     classinfo_t*t = (yyvsp[(1) - (3)].value).t;
8000     char is_static = 0;
8001     if(TYPE_IS_CLASS(t) && t->data) {
8002         t = t->data;
8003         is_static = 1;
8004     }
8005     if(t) {
8006         if(t->subtype==INFOTYPE_UNRESOLVED) {
8007             syntaxerror("syntaxerror: trying to resolve property '%s' on incomplete object '%s'", (yyvsp[(3) - (3)].id), t->name);
8008         }
8009         memberinfo_t*f = findmember_nsset(t, (yyvsp[(3) - (3)].id), 1);
8010         char noslot = 0;
8011         if(f && !is_static != !(f->flags&FLAG_STATIC))
8012            noslot=1;
8013         if(f && f->slot && !noslot) {
8014             (yyval.value).c = abc_getslot((yyval.value).c, f->slot);
8015         } else {
8016             if(!f) 
8017                 as3_warning("Access of undefined property '%s' in %s", (yyvsp[(3) - (3)].id), t->name);
8018             
8019             MEMBER_MULTINAME(m, f, (yyvsp[(3) - (3)].id));
8020             (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
8021         }
8022         /* determine type */
8023         (yyval.value).t = slotinfo_gettype((slotinfo_t*)f);
8024         if(!(yyval.value).t)
8025            (yyval.value).c = abc_coerce_a((yyval.value).c);
8026     } else if((yyvsp[(1) - (3)].value).c && (yyvsp[(1) - (3)].value).c->opcode == OPCODE___PUSHPACKAGE__) {
8027         string_t*package = (yyvsp[(1) - (3)].value).c->data[0];
8028         char*package2 = concat3(package->str, ".", (yyvsp[(3) - (3)].id));
8029
8030         slotinfo_t*a = registry_find(package->str, (yyvsp[(3) - (3)].id));
8031         if(a) {
8032             (yyval.value) = push_class(a);
8033         } else if(dict_contains(state->import_toplevel_packages, package2) ||
8034                   registry_ispackage(package2)) {
8035             (yyval.value).c = (yyvsp[(1) - (3)].value).c;
8036             (yyval.value).c->data[0] = string_new4(package2);
8037             (yyval.value).t = 0;
8038         } else {
8039             syntaxerror("couldn't resolve %s", package2);
8040         }
8041     } else {
8042         /* when resolving a property on an unknown type, we do know the
8043            name of the property (and don't seem to need the package), but
8044            we need to make avm2 try out all access modes */
8045         as3_warning("Resolving %s on unknown type", (yyvsp[(3) - (3)].id));
8046         multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, (yyvsp[(3) - (3)].id)};
8047         (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
8048         (yyval.value).c = abc_coerce_a((yyval.value).c);
8049         (yyval.value).t = registry_getanytype();
8050     }
8051 }
8052     }
8053     break;
8054
8055
8056   
8057     case 304:
8058     if(as3_pass==2) {
8059
8060 /* Line 1464 of skeleton.m4  */
8061 #line 3749 "parser.y"
8062     {
8063     PASS1
8064     /* Queue unresolved identifiers for checking against the parent
8065        function's variables.
8066        We consider everything which is not a local variable "unresolved".
8067        This encompasses class names, members of the surrounding class
8068        etc. which is *correct* because local variables of the parent function
8069        would shadow those.
8070        */
8071     if(state->method->inner && !find_variable(state, (yyvsp[(1) - (1)].id))) {
8072         unknown_variable((yyvsp[(1) - (1)].id));
8073     }
8074    
8075     /* let the compiler know that it might want to check the current directory/package
8076        for this identifier- maybe there's a file $1.as defining $1. */
8077     as3_schedule_class_noerror(state->package, (yyvsp[(1) - (1)].id));
8078     PASS2
8079
8080     (yyval.value).t = 0;
8081     (yyval.value).c = 0;
8082     slotinfo_t*a = 0;
8083     memberinfo_t*f = 0;
8084
8085     variable_t*v;
8086     /* look at variables */
8087     if((v = find_variable(state, (yyvsp[(1) - (1)].id)))) {
8088         // $1 is a local variable
8089         (yyval.value).c = abc_getlocal((yyval.value).c, v->index);
8090         (yyval.value).t = v->type;
8091         break;
8092     }
8093     if((v = find_slot(state, (yyvsp[(1) - (1)].id)))) {
8094         (yyval.value).c = abc_getscopeobject((yyval.value).c, 1);
8095         (yyval.value).c = abc_getslot((yyval.value).c, v->index);
8096         (yyval.value).t = v->type;
8097         break;
8098     }
8099
8100     int i_am_static = (state->method && state->method->info)?(state->method->info->flags&FLAG_STATIC):FLAG_STATIC;
8101
8102     /* look at current class' members */
8103     if(!state->method->inner && 
8104         state->cls && 
8105         (f = findmember_nsset(state->cls->info, (yyvsp[(1) - (1)].id), 1)) &&
8106         (f->flags&FLAG_STATIC) >= i_am_static) 
8107     {
8108         // $1 is a function in this class
8109         int var_is_static = (f->flags&FLAG_STATIC);
8110
8111         if(f->kind == INFOTYPE_METHOD) {
8112             (yyval.value).t = TYPE_FUNCTION(f);
8113         } else {
8114             (yyval.value).t = f->type;
8115         }
8116         if(var_is_static && !i_am_static) {
8117         /* access to a static member from a non-static location.
8118            do this via findpropstrict:
8119            there doesn't seem to be any non-lookup way to access
8120            static properties of a class */
8121             state->method->late_binding = 1;
8122             (yyval.value).t = f->type;
8123             namespace_t ns = {f->access, f->package};
8124             multiname_t m = {QNAME, &ns, 0, (yyvsp[(1) - (1)].id)};
8125             (yyval.value).c = abc_findpropstrict2((yyval.value).c, &m);
8126             (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
8127             break;
8128         } else if(f->slot>0) {
8129             (yyval.value).c = abc_getlocal_0((yyval.value).c);
8130             (yyval.value).c = abc_getslot((yyval.value).c, f->slot);
8131             break;
8132         } else {
8133             namespace_t ns = {f->access, f->package};
8134             multiname_t m = {QNAME, &ns, 0, (yyvsp[(1) - (1)].id)};
8135             (yyval.value).c = abc_getlocal_0((yyval.value).c);
8136             (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
8137             break;
8138         }
8139     } 
8140     
8141     /* look at actual classes, in the current package and imported */
8142     if((a = find_class((yyvsp[(1) - (1)].id)))) {
8143         (yyval.value) = push_class(a);
8144         break;
8145     }
8146
8147     /* look through package prefixes */
8148     if(dict_contains(state->import_toplevel_packages, (yyvsp[(1) - (1)].id)) || 
8149        registry_ispackage((yyvsp[(1) - (1)].id))) {
8150         (yyval.value).c = abc___pushpackage__((yyval.value).c, (yyvsp[(1) - (1)].id));
8151         (yyval.value).t = 0;
8152         break;
8153     }
8154
8155     /* unknown object, let the avm2 resolve it */
8156     if(1) {
8157         //as3_softwarning("Couldn't resolve '%s', doing late binding", $1);
8158         as3_warning("Couldn't resolve '%s', doing late binding", (yyvsp[(1) - (1)].id));
8159         state->method->late_binding = 1;
8160                 
8161         multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, (yyvsp[(1) - (1)].id)};
8162
8163         (yyval.value).t = 0;
8164         (yyval.value).c = abc_findpropstrict2((yyval.value).c, &m);
8165         (yyval.value).c = abc_getproperty2((yyval.value).c, &m);
8166     }
8167 }
8168     }
8169     break;
8170
8171
8172   
8173     case 305:
8174     if(as3_pass==2) {
8175
8176 /* Line 1464 of skeleton.m4  */
8177 #line 3858 "parser.y"
8178     {
8179     PASS12
8180     NEW(namespace_decl_t,n);
8181     n->name = (yyvsp[(2) - (2)].id);
8182     n->url = (yyvsp[(2) - (2)].id);
8183     (yyval.namespace_decl)=n;
8184 }
8185     }
8186     break;
8187
8188
8189   
8190     case 306:
8191     if(as3_pass==2) {
8192
8193 /* Line 1464 of skeleton.m4  */
8194 #line 3865 "parser.y"
8195     {
8196     PASS12
8197     NEW(namespace_decl_t,n);
8198     n->name = (yyvsp[(2) - (4)].id);
8199     n->url = (yyvsp[(4) - (4)].id);
8200     (yyval.namespace_decl)=n;
8201 }
8202     }
8203     break;
8204
8205
8206   
8207     case 307:
8208     if(as3_pass==2) {
8209
8210 /* Line 1464 of skeleton.m4  */
8211 #line 3872 "parser.y"
8212     {
8213     PASS12
8214     NEW(namespace_decl_t,n);
8215     n->name = (yyvsp[(2) - (4)].id);
8216     n->url = (yyvsp[(4) - (4)].str).str;
8217     (yyval.namespace_decl)=n;
8218 }
8219     }
8220     break;
8221
8222
8223   
8224     case 308:
8225     if(as3_pass==2) {
8226
8227 /* Line 1464 of skeleton.m4  */
8228 #line 3879 "parser.y"
8229     {
8230     PASS12
8231     trie_put(active_namespaces, (yyvsp[(2) - (2)].namespace_decl)->name, (void*)(yyvsp[(2) - (2)].namespace_decl)->url);
8232
8233     namespace_t access = modifiers2access(&(yyvsp[(1) - (2)].flags));
8234     varinfo_t* var = varinfo_register_global(access.access, state->package, (yyvsp[(2) - (2)].namespace_decl)->name);
8235     var->type = TYPE_NAMESPACE;
8236     namespace_t ns;
8237     ns.access = ACCESS_NAMESPACE;
8238     ns.name = (yyvsp[(2) - (2)].namespace_decl)->url;
8239     var->value = constant_new_namespace(&ns);
8240
8241     (yyval.code)=0;
8242 }
8243     }
8244     break;
8245
8246
8247   
8248     case 309:
8249     if(as3_pass==2) {
8250
8251 /* Line 1464 of skeleton.m4  */
8252 #line 3894 "parser.y"
8253     {
8254     PASS12
8255     const char*url = (yyvsp[(3) - (3)].classinfo)->name;
8256
8257     varinfo_t*s = (varinfo_t*)(yyvsp[(3) - (3)].classinfo);
8258     if(s->kind == INFOTYPE_UNRESOLVED) {
8259         s = (varinfo_t*)registry_resolve((slotinfo_t*)s);
8260         if(!s)
8261             syntaxerror("Couldn't resolve namespace %s", (yyvsp[(3) - (3)].classinfo)->name);
8262     }
8263
8264     if(!s || s->kind != INFOTYPE_SLOT)
8265         syntaxerror("%s.%s is not a public namespace (%d)", (yyvsp[(3) - (3)].classinfo)->package, (yyvsp[(3) - (3)].classinfo)->name, s?s->kind:-1);
8266     if(!s->value || !NS_TYPE(s->value->type))
8267         syntaxerror("%s.%s is not a namespace", (yyvsp[(3) - (3)].classinfo)->package, (yyvsp[(3) - (3)].classinfo)->name);
8268     url = s->value->ns->name;
8269
8270     trie_put(active_namespaces, (yyvsp[(3) - (3)].classinfo)->name, (void*)url);
8271     add_active_url(url);
8272     (yyval.code)=0;
8273 }
8274     }
8275     break;
8276
8277
8278
8279
8280 /* Line 1464 of skeleton.m4  */
8281 #line 8282 "parser.tab.c"
8282       default: break;
8283     }
8284   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
8285
8286   YYPOPSTACK (yylen);
8287   yylen = 0;
8288   YY_STACK_PRINT (yyss, yyssp);
8289
8290   *++yyvsp = yyval;
8291
8292   /* Now `shift' the result of the reduction.  Determine what state
8293      that goes to, based on the state we popped back to and the rule
8294      number reduced by.  */
8295
8296   yyn = yyr1[yyn];
8297
8298   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
8299   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
8300     yystate = yytable[yystate];
8301   else
8302     yystate = yydefgoto[yyn - YYNTOKENS];
8303
8304   goto yynewstate;
8305
8306
8307 /*------------------------------------.
8308 | yyerrlab -- here on detecting error |
8309 `------------------------------------*/
8310 yyerrlab:
8311   /* If not already recovering from an error, report this error.  */
8312   if (!yyerrstatus)
8313     {
8314       ++yynerrs;
8315 #if ! YYERROR_VERBOSE
8316       yyerror (YY_("syntax error"));
8317 #else
8318       {
8319         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
8320         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
8321           {
8322             YYSIZE_T yyalloc = 2 * yysize;
8323             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
8324               yyalloc = YYSTACK_ALLOC_MAXIMUM;
8325             if (yymsg != yymsgbuf)
8326               YYSTACK_FREE (yymsg);
8327             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
8328             if (yymsg)
8329               yymsg_alloc = yyalloc;
8330             else
8331               {
8332                 yymsg = yymsgbuf;
8333                 yymsg_alloc = sizeof yymsgbuf;
8334               }
8335           }
8336
8337         if (0 < yysize && yysize <= yymsg_alloc)
8338           {
8339             (void) yysyntax_error (yymsg, yystate, yychar);
8340             yyerror (yymsg);
8341           }
8342         else
8343           {
8344             yyerror (YY_("syntax error"));
8345             if (yysize != 0)
8346               goto yyexhaustedlab;
8347           }
8348       }
8349 #endif
8350     }
8351
8352
8353
8354   if (yyerrstatus == 3)
8355     {
8356       /* If just tried and failed to reuse lookahead token after an
8357          error, discard it.  */
8358
8359       if (yychar <= YYEOF)
8360         {
8361           /* Return failure if at end of input.  */
8362           if (yychar == YYEOF)
8363             YYABORT;
8364         }
8365       else
8366         {
8367           yydestruct ("Error: discarding",
8368                       yytoken, &yylval);
8369           yychar = YYEMPTY;
8370         }
8371     }
8372
8373   /* Else will try to reuse lookahead token after shifting the error
8374      token.  */
8375   goto yyerrlab1;
8376
8377
8378 /*---------------------------------------------------.
8379 | yyerrorlab -- error raised explicitly by YYERROR.  |
8380 `---------------------------------------------------*/
8381 yyerrorlab:
8382
8383   /* Pacify compilers like GCC when the user code never invokes
8384      YYERROR and the label yyerrorlab therefore never appears in user
8385      code.  */
8386   if (/*CONSTCOND*/ 0)
8387      goto yyerrorlab;
8388
8389   /* Do not reclaim the symbols of the rule which action triggered
8390      this YYERROR.  */
8391   YYPOPSTACK (yylen);
8392   yylen = 0;
8393   YY_STACK_PRINT (yyss, yyssp);
8394   yystate = *yyssp;
8395   goto yyerrlab1;
8396
8397
8398 /*-------------------------------------------------------------.
8399 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
8400 `-------------------------------------------------------------*/
8401 yyerrlab1:
8402   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
8403
8404   for (;;)
8405     {
8406       yyn = yypact[yystate];
8407       if (yyn != YYPACT_NINF)
8408         {
8409           yyn += YYTERROR;
8410           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
8411             {
8412               yyn = yytable[yyn];
8413               if (0 < yyn)
8414                 break;
8415             }
8416         }
8417
8418       /* Pop the current state because it cannot handle the error token.  */
8419       if (yyssp == yyss)
8420         YYABORT;
8421
8422
8423       yydestruct ("Error: popping",
8424                   yystos[yystate], yyvsp);
8425       YYPOPSTACK (1);
8426       yystate = *yyssp;
8427       YY_STACK_PRINT (yyss, yyssp);
8428     }
8429
8430   *++yyvsp = yylval;
8431
8432
8433   /* Shift the error token.  */
8434   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
8435
8436   yystate = yyn;
8437   goto yynewstate;
8438
8439
8440 /*-------------------------------------.
8441 | yyacceptlab -- YYACCEPT comes here.  |
8442 `-------------------------------------*/
8443 yyacceptlab:
8444   yyresult = 0;
8445   goto yyreturn;
8446
8447 /*-----------------------------------.
8448 | yyabortlab -- YYABORT comes here.  |
8449 `-----------------------------------*/
8450 yyabortlab:
8451   yyresult = 1;
8452   goto yyreturn;
8453
8454 #if !defined(yyoverflow) || YYERROR_VERBOSE
8455 /*-------------------------------------------------.
8456 | yyexhaustedlab -- memory exhaustion comes here.  |
8457 `-------------------------------------------------*/
8458 yyexhaustedlab:
8459   yyerror (YY_("memory exhausted"));
8460   yyresult = 2;
8461   /* Fall through.  */
8462 #endif
8463
8464 yyreturn:
8465   if (yychar != YYEMPTY)
8466      yydestruct ("Cleanup: discarding lookahead",
8467                  yytoken, &yylval);
8468   /* Do not reclaim the symbols of the rule which action triggered
8469      this YYABORT or YYACCEPT.  */
8470   YYPOPSTACK (yylen);
8471   YY_STACK_PRINT (yyss, yyssp);
8472   while (yyssp != yyss)
8473     {
8474       yydestruct ("Cleanup: popping",
8475                   yystos[*yyssp], yyvsp);
8476       YYPOPSTACK (1);
8477     }
8478 #ifndef yyoverflow
8479   if (yyss != yyssa)
8480     YYSTACK_FREE (yyss);
8481 #endif
8482 #if YYERROR_VERBOSE
8483   if (yymsg != yymsgbuf)
8484     YYSTACK_FREE (yymsg);
8485 #endif
8486   /* Make sure YYID is used.  */
8487   return YYID (yyresult);
8488 }
8489
8490
8491