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