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