home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu 2008 / 2008-06-02_hobbes.nmsu.edu.zip / new / scummc-0.2.0-os2.zip / ScummC / src / scc_parse.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-11  |  133.3 KB  |  4,393 lines

  1. /* A Bison parser, made by GNU Bison 2.3.  */
  2.  
  3. /* Skeleton implementation for Bison's Yacc-like parsers in C
  4.  
  5.    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  6.    Free Software Foundation, Inc.
  7.  
  8.    This program is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2, or (at your option)
  11.    any later version.
  12.  
  13.    This program is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with this program; if not, write to the Free Software
  20.    Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21.    Boston, MA 02110-1301, USA.  */
  22.  
  23. /* As a special exception, you may create a larger work that contains
  24.    part or all of the Bison parser skeleton and distribute that work
  25.    under terms of your choice, so long as that work isn't itself a
  26.    parser generator using the skeleton or a modified version thereof
  27.    as a parser skeleton.  Alternatively, if you modify or redistribute
  28.    the parser skeleton itself, you may (at your option) remove this
  29.    special exception, which will cause the skeleton and the resulting
  30.    Bison output files to be licensed under the GNU General Public
  31.    License without this special exception.
  32.  
  33.    This special exception was added by the Free Software Foundation in
  34.    version 2.2 of Bison.  */
  35.  
  36. /* C LALR(1) parser skeleton written by Richard Stallman, by
  37.    simplifying the original so-called "semantic" parser.  */
  38.  
  39. /* All symbols defined below should begin with yy or YY, to avoid
  40.    infringing on user name space.  This should be done even for local
  41.    variables, as they might otherwise be expanded by user macros.
  42.    There are some unavoidable exceptions within include files to
  43.    define necessary library symbols; they are noted "INFRINGES ON
  44.    USER NAME SPACE" below.  */
  45.  
  46. /* Identify Bison output.  */
  47. #define YYBISON 1
  48.  
  49. /* Bison version.  */
  50. #define YYBISON_VERSION "2.3"
  51.  
  52. /* Skeleton name.  */
  53. #define YYSKELETON_NAME "yacc.c"
  54.  
  55. /* Pure parsers.  */
  56. #define YYPURE 1
  57.  
  58. /* Using locations.  */
  59. #define YYLSP_NEEDED 1
  60.  
  61.  
  62.  
  63. /* Tokens.  */
  64. #ifndef YYTOKENTYPE
  65. # define YYTOKENTYPE
  66.    /* Put the tokens into the symbol table, so that GDB and other debuggers
  67.       know about them.  */
  68.    enum yytokentype {
  69.      AADD = 258,
  70.      ASUB = 259,
  71.      AMUL = 260,
  72.      ADIV = 261,
  73.      AAND = 262,
  74.      AOR = 263,
  75.      INC = 264,
  76.      DEC = 265,
  77.      PREINC = 266,
  78.      POSTINC = 267,
  79.      PREDEC = 268,
  80.      POSTDEC = 269,
  81.      ASSIGN = 270,
  82.      LOR = 271,
  83.      LAND = 272,
  84.      IS = 273,
  85.      EQ = 274,
  86.      NEQ = 275,
  87.      GE = 276,
  88.      LE = 277,
  89.      NEG = 278,
  90.      SUFFIX = 279,
  91.      PREFIX = 280,
  92.      POSTFIX = 281,
  93.      INTEGER = 282,
  94.      RESTYPE = 283,
  95.      STRING = 284,
  96.      STRVAR = 285,
  97.      SYM = 286,
  98.      TYPE = 287,
  99.      NUL = 288,
  100.      BRANCH = 289,
  101.      RETURN = 290,
  102.      ROOM = 291,
  103.      OBJECT = 292,
  104.      NS = 293,
  105.      SCRIPT = 294,
  106.      VERB = 295,
  107.      ACTOR = 296,
  108.      VOICE = 297,
  109.      CYCL = 298,
  110.      IF = 299,
  111.      ELSE = 300,
  112.      FOR = 301,
  113.      WHILE = 302,
  114.      DO = 303,
  115.      SWITCH = 304,
  116.      CASE = 305,
  117.      DEFAULT = 306,
  118.      CUTSCENE = 307,
  119.      CLASS = 308,
  120.      TRY = 309,
  121.      OVERRIDE = 310,
  122.      SCRTYPE = 311,
  123.      ERROR = 312
  124.    };
  125. #endif
  126. /* Tokens.  */
  127. #define AADD 258
  128. #define ASUB 259
  129. #define AMUL 260
  130. #define ADIV 261
  131. #define AAND 262
  132. #define AOR 263
  133. #define INC 264
  134. #define DEC 265
  135. #define PREINC 266
  136. #define POSTINC 267
  137. #define PREDEC 268
  138. #define POSTDEC 269
  139. #define ASSIGN 270
  140. #define LOR 271
  141. #define LAND 272
  142. #define IS 273
  143. #define EQ 274
  144. #define NEQ 275
  145. #define GE 276
  146. #define LE 277
  147. #define NEG 278
  148. #define SUFFIX 279
  149. #define PREFIX 280
  150. #define POSTFIX 281
  151. #define INTEGER 282
  152. #define RESTYPE 283
  153. #define STRING 284
  154. #define STRVAR 285
  155. #define SYM 286
  156. #define TYPE 287
  157. #define NUL 288
  158. #define BRANCH 289
  159. #define RETURN 290
  160. #define ROOM 291
  161. #define OBJECT 292
  162. #define NS 293
  163. #define SCRIPT 294
  164. #define VERB 295
  165. #define ACTOR 296
  166. #define VOICE 297
  167. #define CYCL 298
  168. #define IF 299
  169. #define ELSE 300
  170. #define FOR 301
  171. #define WHILE 302
  172. #define DO 303
  173. #define SWITCH 304
  174. #define CASE 305
  175. #define DEFAULT 306
  176. #define CUTSCENE 307
  177. #define CLASS 308
  178. #define TRY 309
  179. #define OVERRIDE 310
  180. #define SCRTYPE 311
  181. #define ERROR 312
  182.  
  183.  
  184.  
  185.  
  186. /* Copy the first part of user declarations.  */
  187. #line 26 "/usr/tmp/scc_parse.y"
  188.  
  189. #include "config.h"
  190.  
  191. #include <stdlib.h>
  192. #include <stdio.h>
  193. #include <string.h>
  194. #include <inttypes.h>
  195. #include <errno.h>
  196.  
  197.  
  198. #include <sys/types.h>
  199. #include <sys/stat.h>
  200. #include <fcntl.h>
  201. #include "scc_fd.h"
  202. #include "scc_util.h"
  203.  
  204. #include "scc_parse.h"
  205. #include "scc_ns.h"
  206. #include "scc_img.h"
  207. #include "scc_cost.h"
  208. #include "scc.h"
  209. #include "scc_roobj.h"
  210. #include "scc_code.h"
  211. #include "scc_param.h"
  212.  
  213. #include "scc_parse.tab.h"
  214.  
  215. #include "scc_lex.h"
  216.  
  217. #include "scc_help.h"
  218.  
  219. #define YYERROR_VERBOSE 1
  220.  
  221. typedef struct scc_parser {
  222.   // targeted vm version
  223.   scc_target_t* target;;
  224.   scc_lex_t* lex;
  225.   scc_ns_t* ns;
  226.   scc_roobj_t* roobj_list;
  227.   scc_roobj_t* roobj;
  228.   scc_roobj_obj_t* obj;
  229.   int local_vars;
  230.   int local_scr;
  231.   int cycl;
  232.   // ressources include paths
  233.   char** res_path;
  234.   // deps
  235.   char do_deps;
  236.   int num_deps;
  237.   char** deps;
  238. } scc_parser_t;
  239.  
  240. #define YYPARSE_PARAM v_sccp
  241. #define sccp ((scc_parser_t*)v_sccp)
  242. #define YYLEX_PARAM sccp->lex
  243.  
  244. // redefined the function names
  245. #define yyparse scc_parser_parse_internal
  246. #define yylex scc_lex_lex
  247. #define yyerror(msg) scc_parser_error(sccp,&yyloc,msg)
  248.  
  249. int scc_parser_error (scc_parser_t* p,YYLTYPE *llocp, const char *s);
  250. void scc_parser_add_dep(scc_parser_t* p, char* dep);
  251.  
  252. static void scc_parser_find_res(scc_parser_t* p, char** file_ptr);
  253.  
  254.  
  255. #define SCC_LIST_ADD(list,last,c) if(c){                  \
  256.   if(last) last->next = c;                                \
  257.   else list = c;                                          \
  258.   for(last = c ; last && last->next ; last = last->next); \
  259. }
  260.  
  261. #define SCC_BOP(d,bop,a,cop,b) {                              \
  262.   if(a->type == SCC_ST_VAL &&                                 \
  263.      b->type == SCC_ST_VAL) {                                 \
  264.     a->val.i = ((int16_t)a->val.i) bop ((int16_t)b->val.i);   \
  265.     free(b);                                                  \
  266.     d = a;                                                    \
  267.   } else {                                                    \
  268.     d = calloc(1,sizeof(scc_statement_t));                    \
  269.     d->type = SCC_ST_OP;                                      \
  270.     d->val.o.type = SCC_OT_BINARY;                            \
  271.     d->val.o.op = cop;                                        \
  272.     d->val.o.argc = 2;                                        \
  273.     d->val.o.argv = a;                                        \
  274.     a->next = b;                                              \
  275.   }                                                           \
  276. }
  277.  
  278. #define SCC_ABORT(at,msg...)  { \
  279.   scc_log(LOG_ERR,"%s: ",scc_lex_get_file(sccp->lex));        \
  280.   scc_log(LOG_ERR,msg); \
  281.   YYABORT; \
  282. }
  283.  
  284.   // output filename
  285.   static char* scc_output = NULL;
  286.  
  287.   scc_func_t* scc_get_func(scc_parser_t* p, char* sym) {
  288.     int i,j;
  289.  
  290.     if(!sym) return NULL;
  291.  
  292.     for(i = 0 ; p->target->func_list[i] ; i++) {
  293.       scc_func_t* list = p->target->func_list[i];
  294.       for(j = 0 ; list[j].sym ; j++) {
  295.         if(strcmp(sym,list[j].sym)) continue;
  296.         return &list[j];
  297.       }
  298.     }
  299.  
  300.     return NULL;
  301.   }
  302.  
  303.   char* scc_statement_check_func(scc_call_t* c) {
  304.     int n,min_argc = c->func->argc;
  305.     scc_statement_t* a;
  306.     // should be big enouth
  307.     static char func_err[2048];
  308.  
  309.     while(min_argc > 0 && (c->func->argt[min_argc-1] & SCC_FA_DEFAULT))
  310.       min_argc--;
  311.  
  312.     if(c->argc > c->func->argc || c->argc < min_argc) {
  313.       sprintf(func_err,"Function %s needs %d args, %d found.\n",
  314.           c->func->sym,c->func->argc,c->argc);
  315.       return func_err;
  316.     }
  317.       
  318.     for(n = 0, a = c->argv ; a ; n++, a = a->next) {
  319.       if(c->func->argt[n] == SCC_FA_VAL) {
  320.     if(a->type == SCC_ST_STR ||
  321.        a->type == SCC_ST_LIST) {
  322.       sprintf(func_err,"Argument %d of call to %s is of the wrong type.\n",
  323.           n+1,c->func->sym);
  324.       return func_err;
  325.     }
  326.       } else if(c->func->argt[n] == SCC_FA_ARRAY) {
  327.     if(a->type != SCC_ST_VAR ||
  328.        !(a->val.v.r->subtype & SCC_VAR_ARRAY)) {
  329.       sprintf(func_err,"Argument %d of call to %s must be an array variable.\n",
  330.           n+1,c->func->sym);
  331.       return func_err;
  332.     }
  333.  
  334.       } else if(c->func->argt[n] == SCC_FA_LIST &&
  335.         a->type != SCC_ST_LIST) {
  336.     sprintf(func_err,"Argument %d of %s must be a list.\n",
  337.         n+1,c->func->sym);
  338.     return func_err;
  339.       } else if(c->func->argt[n] == SCC_FA_STR &&
  340.         a->type != SCC_ST_STR) {
  341.     sprintf(func_err,"Argument %d of %s must be a string.\n",
  342.         n+1,c->func->sym);
  343.     return func_err;
  344.       }
  345.     
  346.     }
  347.  
  348.     return NULL;
  349.   }
  350.  
  351.  
  352.  
  353. /* Enabling traces.  */
  354. #ifndef YYDEBUG
  355. # define YYDEBUG 0
  356. #endif
  357.  
  358. /* Enabling verbose error messages.  */
  359. #ifdef YYERROR_VERBOSE
  360. # undef YYERROR_VERBOSE
  361. # define YYERROR_VERBOSE 1
  362. #else
  363. # define YYERROR_VERBOSE 0
  364. #endif
  365.  
  366. /* Enabling the token table.  */
  367. #ifndef YYTOKEN_TABLE
  368. # define YYTOKEN_TABLE 0
  369. #endif
  370.  
  371. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  372. typedef union YYSTYPE
  373. #line 193 "/usr/tmp/scc_parse.y"
  374. {
  375.   int integer;
  376.   char* str;
  377.   char** strlist;
  378.   scc_symbol_t* sym;
  379.   scc_statement_t* st;
  380.   scc_instruct_t* inst;
  381.   scc_scr_arg_t* arg;
  382.   scc_script_t* scr;
  383.   scc_str_t* strvar;
  384.   int* intlist;
  385.   scc_verb_script_t* vscr;
  386. }
  387. /* Line 187 of yacc.c.  */
  388. #line 389 "scc_parse.tab.c"
  389.     YYSTYPE;
  390. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  391. # define YYSTYPE_IS_DECLARED 1
  392. # define YYSTYPE_IS_TRIVIAL 1
  393. #endif
  394.  
  395. #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
  396. typedef struct YYLTYPE
  397. {
  398.   int first_line;
  399.   int first_column;
  400.   int last_line;
  401.   int last_column;
  402. } YYLTYPE;
  403. # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
  404. # define YYLTYPE_IS_DECLARED 1
  405. # define YYLTYPE_IS_TRIVIAL 1
  406. #endif
  407.  
  408.  
  409. /* Copy the second part of user declarations.  */
  410.  
  411.  
  412. /* Line 216 of yacc.c.  */
  413. #line 414 "scc_parse.tab.c"
  414.  
  415. #ifdef short
  416. # undef short
  417. #endif
  418.  
  419. #ifdef YYTYPE_UINT8
  420. typedef YYTYPE_UINT8 yytype_uint8;
  421. #else
  422. typedef unsigned char yytype_uint8;
  423. #endif
  424.  
  425. #ifdef YYTYPE_INT8
  426. typedef YYTYPE_INT8 yytype_int8;
  427. #elif (defined __STDC__ || defined __C99__FUNC__ \
  428.      || defined __cplusplus || defined _MSC_VER)
  429. typedef signed char yytype_int8;
  430. #else
  431. typedef short int yytype_int8;
  432. #endif
  433.  
  434. #ifdef YYTYPE_UINT16
  435. typedef YYTYPE_UINT16 yytype_uint16;
  436. #else
  437. typedef unsigned short int yytype_uint16;
  438. #endif
  439.  
  440. #ifdef YYTYPE_INT16
  441. typedef YYTYPE_INT16 yytype_int16;
  442. #else
  443. typedef short int yytype_int16;
  444. #endif
  445.  
  446. #ifndef YYSIZE_T
  447. # ifdef __SIZE_TYPE__
  448. #  define YYSIZE_T __SIZE_TYPE__
  449. # elif defined size_t
  450. #  define YYSIZE_T size_t
  451. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  452.      || defined __cplusplus || defined _MSC_VER)
  453. #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  454. #  define YYSIZE_T size_t
  455. # else
  456. #  define YYSIZE_T unsigned int
  457. # endif
  458. #endif
  459.  
  460. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  461.  
  462. #ifndef YY_
  463. # if YYENABLE_NLS
  464. #  if ENABLE_NLS
  465. #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  466. #   define YY_(msgid) dgettext ("bison-runtime", msgid)
  467. #  endif
  468. # endif
  469. # ifndef YY_
  470. #  define YY_(msgid) msgid
  471. # endif
  472. #endif
  473.  
  474. /* Suppress unused-variable warnings by "using" E.  */
  475. #if ! defined lint || defined __GNUC__
  476. # define YYUSE(e) ((void) (e))
  477. #else
  478. # define YYUSE(e) /* empty */
  479. #endif
  480.  
  481. /* Identity function, used to suppress warnings about constant conditions.  */
  482. #ifndef lint
  483. # define YYID(n) (n)
  484. #else
  485. #if (defined __STDC__ || defined __C99__FUNC__ \
  486.      || defined __cplusplus || defined _MSC_VER)
  487. static int
  488. YYID (int i)
  489. #else
  490. static int
  491. YYID (i)
  492.     int i;
  493. #endif
  494. {
  495.   return i;
  496. }
  497. #endif
  498.  
  499. #if ! defined yyoverflow || YYERROR_VERBOSE
  500.  
  501. /* The parser invokes alloca or malloc; define the necessary symbols.  */
  502.  
  503. # ifdef YYSTACK_USE_ALLOCA
  504. #  if YYSTACK_USE_ALLOCA
  505. #   ifdef __GNUC__
  506. #    define YYSTACK_ALLOC __builtin_alloca
  507. #   elif defined __BUILTIN_VA_ARG_INCR
  508. #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  509. #   elif defined _AIX
  510. #    define YYSTACK_ALLOC __alloca
  511. #   elif defined _MSC_VER
  512. #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  513. #    define alloca _alloca
  514. #   else
  515. #    define YYSTACK_ALLOC alloca
  516. #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  517.      || defined __cplusplus || defined _MSC_VER)
  518. #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  519. #     ifndef _STDLIB_H
  520. #      define _STDLIB_H 1
  521. #     endif
  522. #    endif
  523. #   endif
  524. #  endif
  525. # endif
  526.  
  527. # ifdef YYSTACK_ALLOC
  528.    /* Pacify GCC's `empty if-body' warning.  */
  529. #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  530. #  ifndef YYSTACK_ALLOC_MAXIMUM
  531.     /* The OS might guarantee only one guard page at the bottom of the stack,
  532.        and a page size can be as small as 4096 bytes.  So we cannot safely
  533.        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
  534.        to allow for a few compiler-allocated temporary stack slots.  */
  535. #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  536. #  endif
  537. # else
  538. #  define YYSTACK_ALLOC YYMALLOC
  539. #  define YYSTACK_FREE YYFREE
  540. #  ifndef YYSTACK_ALLOC_MAXIMUM
  541. #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  542. #  endif
  543. #  if (defined __cplusplus && ! defined _STDLIB_H \
  544.        && ! ((defined YYMALLOC || defined malloc) \
  545.          && (defined YYFREE || defined free)))
  546. #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  547. #   ifndef _STDLIB_H
  548. #    define _STDLIB_H 1
  549. #   endif
  550. #  endif
  551. #  ifndef YYMALLOC
  552. #   define YYMALLOC malloc
  553. #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  554.      || defined __cplusplus || defined _MSC_VER)
  555. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  556. #   endif
  557. #  endif
  558. #  ifndef YYFREE
  559. #   define YYFREE free
  560. #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  561.      || defined __cplusplus || defined _MSC_VER)
  562. void free (void *); /* INFRINGES ON USER NAME SPACE */
  563. #   endif
  564. #  endif
  565. # endif
  566. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  567.  
  568.  
  569. #if (! defined yyoverflow \
  570.      && (! defined __cplusplus \
  571.      || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
  572.          && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  573.  
  574. /* A type that is properly aligned for any stack member.  */
  575. union yyalloc
  576. {
  577.   yytype_int16 yyss;
  578.   YYSTYPE yyvs;
  579.     YYLTYPE yyls;
  580. };
  581.  
  582. /* The size of the maximum gap between one aligned stack and the next.  */
  583. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  584.  
  585. /* The size of an array large to enough to hold all stacks, each with
  586.    N elements.  */
  587. # define YYSTACK_BYTES(N) \
  588.      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
  589.       + 2 * YYSTACK_GAP_MAXIMUM)
  590.  
  591. /* Copy COUNT objects from FROM to TO.  The source and destination do
  592.    not overlap.  */
  593. # ifndef YYCOPY
  594. #  if defined __GNUC__ && 1 < __GNUC__
  595. #   define YYCOPY(To, From, Count) \
  596.       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  597. #  else
  598. #   define YYCOPY(To, From, Count)        \
  599.       do                    \
  600.     {                    \
  601.       YYSIZE_T yyi;                \
  602.       for (yyi = 0; yyi < (Count); yyi++)    \
  603.         (To)[yyi] = (From)[yyi];        \
  604.     }                    \
  605.       while (YYID (0))
  606. #  endif
  607. # endif
  608.  
  609. /* Relocate STACK from its old location to the new one.  The
  610.    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  611.    elements in the stack, and YYPTR gives the new location of the
  612.    stack.  Advance YYPTR to a properly aligned location for the next
  613.    stack.  */
  614. # define YYSTACK_RELOCATE(Stack)                    \
  615.     do                                    \
  616.       {                                    \
  617.     YYSIZE_T yynewbytes;                        \
  618.     YYCOPY (&yyptr->Stack, Stack, yysize);                \
  619.     Stack = &yyptr->Stack;                        \
  620.     yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  621.     yyptr += yynewbytes / sizeof (*yyptr);                \
  622.       }                                    \
  623.     while (YYID (0))
  624.  
  625. #endif
  626.  
  627. /* YYFINAL -- State number of the termination state.  */
  628. #define YYFINAL  26
  629. /* YYLAST -- Last index in YYTABLE.  */
  630. #define YYLAST   856
  631.  
  632. /* YYNTOKENS -- Number of terminals.  */
  633. #define YYNTOKENS  78
  634. /* YYNNTS -- Number of nonterminals.  */
  635. #define YYNNTS  75
  636. /* YYNRULES -- Number of rules.  */
  637. #define YYNRULES  192
  638. /* YYNRULES -- Number of states.  */
  639. #define YYNSTATES  402
  640.  
  641. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
  642. #define YYUNDEFTOK  2
  643. #define YYMAXUTOK   312
  644.  
  645. #define YYTRANSLATE(YYX)                        \
  646.   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  647.  
  648. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
  649. static const yytype_uint8 yytranslate[] =
  650. {
  651.        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  652.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  653.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  654.        2,     2,     2,    34,     2,     2,     2,     2,    22,     2,
  655.       73,    74,    31,    30,    70,    29,     2,    32,     2,     2,
  656.        2,     2,     2,     2,     2,     2,     2,     2,    17,    69,
  657.       27,     2,    25,    16,    75,     2,     2,     2,     2,     2,
  658.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  659.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  660.        2,    76,     2,    77,     2,     2,     2,     2,     2,     2,
  661.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  662.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  663.        2,     2,     2,    71,    21,    72,     2,     2,     2,     2,
  664.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  665.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  666.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  667.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  668.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  669.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  670.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  671.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  672.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  673.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  674.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  675.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  676.        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
  677.        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  678.       15,    18,    19,    20,    23,    24,    26,    28,    33,    35,
  679.       36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  680.       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  681.       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
  682.       66,    67,    68
  683. };
  684.  
  685. #if YYDEBUG
  686. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  687.    YYRHS.  */
  688. static const yytype_uint16 yyprhs[] =
  689. {
  690.        0,     0,     3,     4,     6,     8,    11,    13,    15,    18,
  691.       21,    24,    27,    32,    38,    39,    41,    45,    50,    54,
  692.       59,    61,    63,    65,    71,    78,    80,    82,    84,    86,
  693.       88,    92,    95,    98,   102,   107,   109,   112,   117,   120,
  694.      126,   129,   132,   135,   138,   141,   144,   147,   155,   159,
  695.      161,   164,   169,   176,   181,   193,   197,   205,   211,   214,
  696.      216,   220,   225,   231,   232,   235,   238,   242,   246,   250,
  697.      256,   260,   266,   268,   272,   274,   278,   286,   298,   300,
  698.      304,   305,   311,   316,   319,   323,   324,   326,   330,   333,
  699.      334,   336,   337,   341,   347,   348,   351,   352,   355,   356,
  700.      358,   361,   365,   369,   374,   376,   380,   382,   385,   388,
  701.      390,   392,   394,   397,   399,   402,   404,   408,   410,   412,
  702.      414,   417,   425,   430,   440,   446,   449,   455,   456,   459,
  703.      465,   468,   473,   476,   480,   482,   485,   489,   494,   500,
  704.      508,   510,   514,   515,   517,   519,   521,   526,   533,   535,
  705.      539,   543,   549,   553,   557,   561,   565,   569,   573,   577,
  706.      581,   585,   589,   593,   597,   601,   605,   609,   612,   615,
  707.      618,   621,   625,   627,   631,   636,   643,   644,   646,   650,
  708.      652,   656,   658,   662,   664,   667,   669,   671,   673,   676,
  709.      678,   680,   682
  710. };
  711.  
  712. /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
  713. static const yytype_int16 yyrhs[] =
  714. {
  715.       79,     0,    -1,    -1,    80,    -1,    81,    -1,    80,    81,
  716.       -1,    91,    -1,    82,    -1,    83,    69,    -1,    86,    69,
  717.       -1,    88,    69,    -1,    85,    69,    -1,    43,    84,    42,
  718.      119,    -1,    83,    70,    84,    42,   119,    -1,    -1,    31,
  719.       -1,    47,    42,   119,    -1,    85,    70,    42,   119,    -1,
  720.       87,    42,   119,    -1,    86,    70,    42,   119,    -1,    52,
  721.       -1,    51,    -1,    64,    -1,    89,    42,    49,    42,   119,
  722.       -1,    88,    70,    42,    49,    42,   119,    -1,    39,    -1,
  723.       48,    -1,    50,    -1,    53,    -1,    54,    -1,    47,    42,
  724.      119,    -1,    90,    92,    -1,    71,    72,    -1,    71,    93,
  725.       72,    -1,    71,    97,    93,    72,    -1,    94,    -1,    93,
  726.       94,    -1,    95,    71,   120,    72,    -1,    95,    69,    -1,
  727.       96,    71,   106,   112,    72,    -1,    96,    69,    -1,   101,
  728.       69,    -1,   102,    69,    -1,    99,    69,    -1,   100,    69,
  729.       -1,   104,    69,    -1,    83,    69,    -1,   117,    50,    42,
  730.       73,   118,    74,   119,    -1,    48,    42,   119,    -1,    98,
  731.       -1,    97,    98,    -1,    42,    15,    40,    69,    -1,    42,
  732.       15,    71,   111,    72,    69,    -1,    42,    15,    38,    69,
  733.       -1,   100,    15,    71,    38,    70,    38,    70,    38,    70,
  734.       38,    72,    -1,    54,    42,   119,    -1,   102,    15,    71,
  735.       40,    70,   103,    72,    -1,   102,    15,    71,    40,    72,
  736.       -1,    53,    42,    -1,    38,    -1,   103,    70,    38,    -1,
  737.       39,    42,   119,   105,    -1,   104,    70,    42,   119,   105,
  738.       -1,    -1,    15,    40,    -1,   107,    69,    -1,   106,   107,
  739.       69,    -1,    42,    15,    40,    -1,    42,    15,   152,    -1,
  740.       42,    15,    71,   109,    72,    -1,    42,    15,    42,    -1,
  741.       64,    15,    71,   108,    72,    -1,    42,    -1,   108,    70,
  742.       42,    -1,   110,    -1,   109,    70,   110,    -1,    71,   152,
  743.       70,   152,    70,    40,    72,    -1,    71,   152,    70,   152,
  744.       70,    40,    70,    71,   111,    72,    72,    -1,    40,    -1,
  745.      111,    70,    40,    -1,    -1,   113,    71,   121,   114,    72,
  746.       -1,    51,    73,   118,    74,    -1,   116,   115,    -1,   114,
  747.      116,   115,    -1,    -1,   125,    -1,    61,    42,    17,    -1,
  748.       62,    17,    -1,    -1,    67,    -1,    -1,    43,    84,    42,
  749.       -1,   118,    70,    43,    84,    42,    -1,    -1,    75,    38,
  750.       -1,    -1,   121,   125,    -1,    -1,   122,    -1,   123,    69,
  751.       -1,   122,   123,    69,    -1,    43,    84,    42,    -1,   123,
  752.       70,    84,    42,    -1,   126,    -1,    71,   125,    72,    -1,
  753.      126,    -1,   125,   126,    -1,   127,    69,    -1,   129,    -1,
  754.      140,    -1,    45,    -1,    45,    42,    -1,    46,    -1,    46,
  755.      140,    -1,   127,    -1,    71,   125,    72,    -1,   139,    -1,
  756.      135,    -1,   130,    -1,   131,   124,    -1,   132,   128,    58,
  757.       73,   140,    74,    69,    -1,   133,    71,   136,    72,    -1,
  758.      134,    57,    73,   141,    69,   140,    69,   141,    74,    -1,
  759.      134,    58,    73,   140,    74,    -1,   134,    59,    -1,   134,
  760.       60,    73,   140,    74,    -1,    -1,    42,    17,    -1,    63,
  761.       73,   145,    74,   124,    -1,    65,   124,    -1,    65,   124,
  762.       66,   124,    -1,   137,   125,    -1,   136,   137,   125,    -1,
  763.      138,    -1,    62,    17,    -1,    61,   142,    17,    -1,   138,
  764.       61,   142,    17,    -1,    55,    73,   140,    74,   124,    -1,
  765.       55,    73,   140,    74,   124,    56,   124,    -1,   142,    -1,
  766.      140,    70,   142,    -1,    -1,   140,    -1,   149,    -1,   143,
  767.       -1,   143,    76,   142,    77,    -1,   143,    76,   142,    70,
  768.      142,    77,    -1,   144,    -1,    76,   145,    77,    -1,   142,
  769.       15,   142,    -1,   142,    16,   142,    17,   142,    -1,   142,
  770.       18,   142,    -1,   142,    19,   142,    -1,   142,    20,   146,
  771.       -1,   142,    21,   142,    -1,   142,    22,   142,    -1,   142,
  772.       24,   142,    -1,   142,    23,   142,    -1,   142,    26,   142,
  773.       -1,   142,    25,   142,    -1,   142,    28,   142,    -1,   142,
  774.       27,   142,    -1,   142,    29,   142,    -1,   142,    30,   142,
  775.       -1,   142,    32,   142,    -1,   142,    31,   142,    -1,    29,
  776.      142,    -1,    34,   142,    -1,    35,   142,    -1,   142,    35,
  777.       -1,    73,   140,    74,    -1,    42,    -1,    42,    49,    42,
  778.       -1,    42,    73,   145,    74,    -1,    42,    49,    42,    73,
  779.      145,    74,    -1,    -1,   142,    -1,   145,    70,   142,    -1,
  780.      148,    -1,    76,   147,    77,    -1,   148,    -1,   147,    70,
  781.      148,    -1,    42,    -1,    34,    42,    -1,    38,    -1,   150,
  782.       -1,   151,    -1,   150,   151,    -1,    40,    -1,    41,    -1,
  783.       38,    -1,    29,    38,    -1
  784. };
  785.  
  786. /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
  787. static const yytype_uint16 yyrline[] =
  788. {
  789.        0,   337,   337,   338,   341,   342,   345,   346,   349,   351,
  790.      353,   355,   358,   367,   379,   382,   390,   394,   400,   404,
  791.      410,   414,   418,   425,   430,   436,   437,   441,   445,   449,
  792.      457,   467,   492,   493,   495,   498,   499,   503,   515,   522,
  793.      530,   535,   537,   539,   541,   543,   545,   549,   575,   593,
  794.      594,   597,   609,   621,   637,   647,   656,   671,   686,   693,
  795.      699,   709,   724,   742,   745,   755,   756,   760,   768,   777,
  796.      785,   815,   822,   839,   857,   858,   861,   868,   877,   885,
  797.      898,   900,   919,   935,   942,   959,   962,   965,   979,   988,
  798.      991,   998,  1001,  1011,  1025,  1028,  1035,  1039,  1053,  1054,
  799.     1057,  1060,  1064,  1074,  1082,  1087,  1093,  1098,  1106,  1107,
  800.     1110,  1117,  1127,  1138,  1145,  1160,  1165,  1171,  1175,  1177,
  801.     1183,  1189,  1197,  1206,  1217,  1228,  1237,  1248,  1251,  1257,
  802.     1265,  1272,  1281,  1289,  1308,  1313,  1318,  1323,  1332,  1341,
  803.     1353,  1358,  1379,  1382,  1388,  1393,  1398,  1412,  1427,  1432,
  804.     1447,  1470,  1482,  1487,  1492,  1524,  1529,  1534,  1539,  1544,
  805.     1549,  1554,  1559,  1564,  1569,  1574,  1579,  1584,  1599,  1614,
  806.     1627,  1640,  1646,  1667,  1691,  1741,  1785,  1789,  1794,  1805,
  807.     1810,  1816,  1821,  1832,  1858,  1878,  1885,  1892,  1896,  1905,
  808.     1911,  1945,  1949
  809. };
  810. #endif
  811.  
  812. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  813. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  814.    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  815. static const char *const yytname[] =
  816. {
  817.   "$end", "error", "$undefined", "AADD", "ASUB", "AMUL", "ADIV", "AAND",
  818.   "AOR", "INC", "DEC", "PREINC", "POSTINC", "PREDEC", "POSTDEC", "ASSIGN",
  819.   "'?'", "':'", "LOR", "LAND", "IS", "'|'", "'&'", "EQ", "NEQ", "'>'",
  820.   "GE", "'<'", "LE", "'-'", "'+'", "'*'", "'/'", "NEG", "'!'", "SUFFIX",
  821.   "PREFIX", "POSTFIX", "INTEGER", "RESTYPE", "STRING", "STRVAR", "SYM",
  822.   "TYPE", "NUL", "BRANCH", "RETURN", "ROOM", "OBJECT", "NS", "SCRIPT",
  823.   "VERB", "ACTOR", "VOICE", "CYCL", "IF", "ELSE", "FOR", "WHILE", "DO",
  824.   "SWITCH", "CASE", "DEFAULT", "CUTSCENE", "CLASS", "TRY", "OVERRIDE",
  825.   "SCRTYPE", "ERROR", "';'", "','", "'{'", "'}'", "'('", "')'", "'@'",
  826.   "'['", "']'", "$accept", "srcfile", "srcs", "src", "gdecl", "gvardecl",
  827.   "typemod", "groomdecl", "gresdecl", "globalres", "groomresdecl",
  828.   "roomres", "roombdecl", "room", "roombody", "roombodyentries",
  829.   "roombodyentry", "roomscrdecl", "roomobjdecl", "roomdecls", "roomdecl",
  830.   "cycledef", "cycledecl", "voicedef", "voicedecl", "synclist", "resdecl",
  831.   "resdef", "objectparams", "objectparam", "classlist", "imgdecls",
  832.   "imgdecl", "zbufs", "objectverbs", "verbentrydecl", "verbsblock",
  833.   "verbcode", "verbentry", "scripttype", "scriptargs", "location",
  834.   "scriptbody", "vardecl", "vardec", "vdecl", "body", "instructions",
  835.   "instruct", "oneinstruct", "dobody", "block", "loopblock", "loophead",
  836.   "dohead", "switchhead", "label", "cutsceneblock", "switchblock",
  837.   "caseblock", "caseval", "ifblock", "statements", "opt_statements",
  838.   "statement", "var", "call", "cargs", "isargs", "isarglist", "isarg",
  839.   "dval", "string", "str", "natural", 0
  840. };
  841. #endif
  842.  
  843. # ifdef YYPRINT
  844. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  845.    token YYLEX-NUM.  */
  846. static const yytype_uint16 yytoknum[] =
  847. {
  848.        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
  849.      265,   266,   267,   268,   269,   270,    63,    58,   271,   272,
  850.      273,   124,    38,   274,   275,    62,   276,    60,   277,    45,
  851.       43,    42,    47,   278,    33,   279,   280,   281,   282,   283,
  852.      284,   285,   286,   287,   288,   289,   290,   291,   292,   293,
  853.      294,   295,   296,   297,   298,   299,   300,   301,   302,   303,
  854.      304,   305,   306,   307,   308,   309,   310,   311,   312,    59,
  855.       44,   123,   125,    40,    41,    64,    91,    93
  856. };
  857. # endif
  858.  
  859. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
  860. static const yytype_uint8 yyr1[] =
  861. {
  862.        0,    78,    79,    79,    80,    80,    81,    81,    82,    82,
  863.       82,    82,    83,    83,    84,    84,    85,    85,    86,    86,
  864.       87,    87,    87,    88,    88,    89,    89,    89,    89,    89,
  865.       90,    91,    92,    92,    92,    93,    93,    94,    94,    94,
  866.       94,    94,    94,    94,    94,    94,    94,    95,    96,    97,
  867.       97,    98,    98,    98,    99,   100,   101,   101,   102,   103,
  868.      103,   104,   104,   105,   105,   106,   106,   107,   107,   107,
  869.      107,   107,   108,   108,   109,   109,   110,   110,   111,   111,
  870.      112,   112,   113,   114,   114,   115,   115,   116,   116,   117,
  871.      117,   118,   118,   118,   119,   119,   120,   120,   121,   121,
  872.      122,   122,   123,   123,   124,   124,   125,   125,   126,   126,
  873.      127,   127,   127,   127,   127,   128,   128,   129,   129,   129,
  874.      130,   130,   130,   131,   131,   132,   133,   134,   134,   135,
  875.      135,   135,   136,   136,   137,   137,   138,   138,   139,   139,
  876.      140,   140,   141,   141,   142,   142,   142,   142,   142,   142,
  877.      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
  878.      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
  879.      142,   142,   143,   143,   144,   144,   145,   145,   145,   146,
  880.      146,   147,   147,   148,   148,   149,   149,   150,   150,   151,
  881.      151,   152,   152
  882. };
  883.  
  884. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
  885. static const yytype_uint8 yyr2[] =
  886. {
  887.        0,     2,     0,     1,     1,     2,     1,     1,     2,     2,
  888.        2,     2,     4,     5,     0,     1,     3,     4,     3,     4,
  889.        1,     1,     1,     5,     6,     1,     1,     1,     1,     1,
  890.        3,     2,     2,     3,     4,     1,     2,     4,     2,     5,
  891.        2,     2,     2,     2,     2,     2,     2,     7,     3,     1,
  892.        2,     4,     6,     4,    11,     3,     7,     5,     2,     1,
  893.        3,     4,     5,     0,     2,     2,     3,     3,     3,     5,
  894.        3,     5,     1,     3,     1,     3,     7,    11,     1,     3,
  895.        0,     5,     4,     2,     3,     0,     1,     3,     2,     0,
  896.        1,     0,     3,     5,     0,     2,     0,     2,     0,     1,
  897.        2,     3,     3,     4,     1,     3,     1,     2,     2,     1,
  898.        1,     1,     2,     1,     2,     1,     3,     1,     1,     1,
  899.        2,     7,     4,     9,     5,     2,     5,     0,     2,     5,
  900.        2,     4,     2,     3,     1,     2,     3,     4,     5,     7,
  901.        1,     3,     0,     1,     1,     1,     4,     6,     1,     3,
  902.        3,     5,     3,     3,     3,     3,     3,     3,     3,     3,
  903.        3,     3,     3,     3,     3,     3,     3,     2,     2,     2,
  904.        2,     3,     1,     3,     4,     6,     0,     1,     3,     1,
  905.        3,     1,     3,     1,     2,     1,     1,     1,     2,     1,
  906.        1,     1,     2
  907. };
  908.  
  909. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  910.    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
  911.    means the default is an error.  */
  912. static const yytype_uint8 yydefact[] =
  913. {
  914.        2,    25,    14,     0,    26,    27,    21,    20,    28,    29,
  915.       22,     0,     3,     4,     7,     0,     0,     0,     0,     0,
  916.        0,     0,     6,    15,     0,    94,     1,     5,     8,    14,
  917.       11,     0,     9,     0,    94,    10,     0,     0,    89,    31,
  918.       94,     0,    16,     0,    94,    94,    18,     0,     0,     0,
  919.        0,     0,     0,     0,    90,    32,     0,    89,    35,     0,
  920.        0,    89,    49,     0,     0,     0,     0,     0,     0,    12,
  921.       95,    94,    17,    19,     0,    94,    94,     0,    94,    58,
  922.       94,    46,    33,    36,    38,    98,    40,     0,    89,    50,
  923.       43,     0,    44,    41,     0,    42,    45,     0,     0,    13,
  924.       94,    23,    63,     0,     0,     0,    48,    55,    14,     0,
  925.      127,    99,     0,     0,     0,    80,     0,    34,     0,     0,
  926.       94,     0,    24,     0,    61,    53,    51,    78,     0,     0,
  927.       37,     0,     0,     0,   185,   189,   190,   172,   111,   113,
  928.        0,     0,   127,     0,   176,   127,   106,     0,   109,   119,
  929.      127,     0,     0,     0,   118,   117,   110,   140,   145,   148,
  930.      144,   186,   187,     0,   100,    14,     0,     0,     0,     0,
  931.        0,     0,    65,     0,     0,    63,    91,    64,     0,     0,
  932.      102,   172,   167,   168,   169,   128,     0,   176,   112,   114,
  933.        0,   176,   127,   130,   104,     0,   177,     0,   107,   108,
  934.      120,   127,   115,     0,     0,     0,     0,   125,     0,     0,
  935.        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  936.        0,     0,     0,     0,     0,     0,     0,   170,     0,   188,
  937.      101,     0,     0,   191,    67,    70,     0,    68,     0,    91,
  938.       66,    39,    98,     0,     0,    57,    62,    14,     0,    79,
  939.       52,   173,     0,     0,     0,   127,   127,   171,     0,   149,
  940.      127,     0,     0,     0,     0,   127,   134,   142,     0,     0,
  941.      141,   150,     0,   152,   153,     0,   183,     0,   154,   179,
  942.      155,   156,   158,   157,   160,   159,   162,   161,   163,   164,
  943.      166,   165,     0,   103,   192,     0,     0,    74,    72,     0,
  944.        0,     0,     0,    59,     0,     0,     0,    94,   176,   174,
  945.      127,   127,   105,   131,   178,   116,     0,     0,   135,   122,
  946.      127,   127,     0,   143,     0,     0,     0,     0,   184,     0,
  947.      181,     0,   146,     0,     0,    69,     0,    71,    82,     0,
  948.        0,     0,   127,     0,     0,    56,    92,    14,    47,     0,
  949.      138,   129,     0,   136,   127,     0,     0,   124,   126,   151,
  950.        0,   180,     0,     0,    75,    73,     0,    88,    81,   127,
  951.       83,   127,     0,    60,     0,   175,   127,     0,   137,     0,
  952.      182,   147,     0,    87,    84,     0,    93,   139,   121,   142,
  953.        0,     0,     0,     0,    54,   123,     0,    76,     0,     0,
  954.        0,    77
  955. };
  956.  
  957. /* YYDEFGOTO[NTERM-NUM].  */
  958. static const yytype_int16 yydefgoto[] =
  959. {
  960.       -1,    11,    12,    13,    14,    56,    24,    16,    17,    18,
  961.       19,    20,    21,    22,    39,    57,    58,    59,    60,    61,
  962.       62,    63,    64,    65,    66,   304,    67,   124,   115,   116,
  963.      299,   296,   297,   128,   170,   171,   341,   370,   342,    68,
  964.      248,    42,   109,   110,   111,   112,   193,   371,   146,   147,
  965.      203,   148,   149,   150,   151,   152,   153,   154,   264,   265,
  966.      266,   155,   156,   324,   157,   158,   159,   197,   278,   329,
  967.      279,   160,   161,   162,   237
  968. };
  969.  
  970. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  971.    STATE-NUM.  */
  972. #define YYPACT_NINF -286
  973. static const yytype_int16 yypact[] =
  974. {
  975.      625,  -286,    35,   -20,  -286,  -286,  -286,  -286,  -286,  -286,
  976.     -286,    69,   625,  -286,  -286,    33,    65,   119,    32,   165,
  977.       75,    13,  -286,  -286,   100,    80,  -286,  -286,  -286,    35,
  978.     -286,   125,  -286,   168,    80,  -286,   174,   202,    46,  -286,
  979.       80,   185,   159,   203,    80,    80,  -286,   204,   215,   229,
  980.      252,   261,   273,   274,  -286,  -286,   200,    53,  -286,     6,
  981.       99,   118,  -286,   248,     2,   251,     4,   221,   271,  -286,
  982.     -286,    80,  -286,  -286,   280,    80,    80,    -9,    80,  -286,
  983.       80,  -286,  -286,  -286,  -286,   -23,  -286,    -7,   189,  -286,
  984.     -286,   253,  -286,  -286,   259,  -286,  -286,   281,   286,  -286,
  985.       80,  -286,   316,   263,   266,   301,  -286,  -286,    35,   275,
  986.      584,   300,   225,   333,   345,    12,   293,  -286,   325,   324,
  987.       80,   295,  -286,   330,  -286,  -286,  -286,  -286,   110,   329,
  988.     -286,    -8,    -8,    -8,  -286,  -286,  -286,    -3,   332,    -8,
  989.      299,   302,   424,    -8,    -8,   464,  -286,   312,  -286,  -286,
  990.      424,   621,   317,   181,  -286,  -286,   313,   743,   311,  -286,
  991.     -286,   256,  -286,   231,  -286,    35,    10,   320,   319,   327,
  992.      321,   323,  -286,   328,   161,   316,   352,  -286,   357,   331,
  993.     -286,     7,   366,   366,  -286,  -286,   360,    -8,  -286,   313,
  994.       -8,    -8,   584,   337,  -286,    34,   743,    20,  -286,  -286,
  995.     -286,   584,  -286,   346,   246,   335,   338,  -286,   339,    -8,
  996.       -8,    -8,    -8,    -8,   -18,    -8,    -8,    -8,    -8,    -8,
  997.       -8,    -8,    -8,    -8,    -8,    -8,    -8,  -286,    -8,  -286,
  998.     -286,   368,   376,  -286,  -286,  -286,   350,  -286,   373,   352,
  999.     -286,  -286,   300,   385,   389,  -286,  -286,    35,    42,  -286,
  1000.     -286,   355,    88,    95,   117,   504,   424,  -286,    -8,  -286,
  1001.      544,   358,    -8,   415,   -21,   584,   372,    -8,    -8,    -8,
  1002.      743,   743,   683,   778,   794,   392,  -286,    -6,  -286,  -286,
  1003.      808,   821,   326,   326,   146,   146,    92,    92,    79,    79,
  1004.      366,   366,   177,  -286,  -286,    26,   176,  -286,  -286,   188,
  1005.      141,   250,   365,  -286,   192,   394,   395,    80,    -8,  -286,
  1006.      424,   424,  -286,  -286,   743,  -286,    -8,   704,  -286,  -286,
  1007.      584,   264,    -8,   313,   371,   143,   150,    -8,  -286,    28,
  1008.     -286,    -8,  -286,   367,   350,  -286,   399,  -286,  -286,   400,
  1009.      426,    21,   304,   406,   410,  -286,  -286,    35,  -286,   151,
  1010.      396,  -286,   152,  -286,   344,   725,    -8,  -286,  -286,   761,
  1011.       -6,  -286,   257,    26,  -286,  -286,   433,  -286,  -286,   304,
  1012.     -286,   384,   381,  -286,   412,  -286,   424,   386,  -286,   244,
  1013.     -286,  -286,   391,  -286,  -286,   425,  -286,  -286,  -286,    -8,
  1014.      427,   401,   397,   193,  -286,  -286,   403,  -286,   301,   196,
  1015.      404,  -286
  1016. };
  1017.  
  1018. /* YYPGOTO[NTERM-NUM].  */
  1019. static const yytype_int16 yypgoto[] =
  1020. {
  1021.     -286,  -286,  -286,   456,  -286,    25,   -29,  -286,  -286,  -286,
  1022.     -286,  -286,  -286,  -286,  -286,   411,   -44,  -286,  -286,  -286,
  1023.      414,  -286,  -286,  -286,  -286,  -286,  -286,   303,  -286,   362,
  1024.     -286,  -286,   147,    82,  -286,  -286,  -286,   113,   142,  -286,
  1025.      245,   -33,  -286,   243,  -286,   375,  -147,  -106,  -127,   340,
  1026.     -286,  -286,  -286,  -286,  -286,  -286,  -286,  -286,  -286,   224,
  1027.     -286,  -286,  -137,   101,   -72,  -286,  -286,  -182,  -286,  -286,
  1028.     -269,  -286,  -286,   342,  -285
  1029. };
  1030.  
  1031. /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
  1032.    positive, shift that token.  If negative, reduce the rule which
  1033.    number is the opposite.  If zero, do what YYDEFACT says.
  1034.    If YYTABLE_NINF, syntax error.  */
  1035. #define YYTABLE_NINF -134
  1036. static const yytype_int16 yytable[] =
  1037. {
  1038.       43,    46,   189,   200,   145,   252,   195,    69,   330,   254,
  1039.      333,    72,    73,    83,   185,   194,   275,    91,   198,    94,
  1040.      108,   131,    25,   194,   276,    15,   132,   133,   275,   103,
  1041.      134,   104,   135,   136,   181,   113,   276,    15,    99,   232,
  1042.      262,   263,   101,   102,    83,   106,   186,   107,   233,   -96,
  1043.      234,   319,   235,   253,   113,   232,   186,   114,   277,   182,
  1044.      183,   184,   105,   168,   233,   143,    23,   122,   144,    26,
  1045.      187,    92,   196,    95,    34,    84,   114,    85,   382,   129,
  1046.      187,   236,   339,   340,    38,    49,   255,   175,    50,     2,
  1047.      258,   380,    49,   368,    51,   260,     2,   259,   360,    52,
  1048.       53,    51,    28,    29,   209,   361,    52,    53,   257,   313,
  1049.      225,   226,   306,    54,   227,   196,   307,    37,    55,   196,
  1050.       54,   223,   224,   225,   226,    82,   349,   227,   198,   194,
  1051.      323,   325,   326,   198,    30,    31,   231,   270,   271,   272,
  1052.      273,   274,    40,   280,   281,   282,   283,   284,   285,   286,
  1053.      287,   288,   289,   290,   291,    41,   292,    49,   258,   321,
  1054.       50,     2,   309,   350,   351,   209,    51,    44,    86,   310,
  1055.       87,    52,    53,   221,   222,   223,   224,   225,   226,   352,
  1056.      178,   227,   179,   194,   194,    54,   314,   258,    32,    33,
  1057.      317,   311,   210,   211,   198,   212,   213,   214,   215,   216,
  1058.      217,   218,   219,   220,   221,   222,   223,   224,   225,   226,
  1059.       45,   306,   227,   209,   354,   338,    47,   357,   305,   379,
  1060.      209,   258,   209,    70,   358,   375,   377,   198,    49,   387,
  1061.      -30,   244,     2,   245,    35,    36,   196,    51,   205,   206,
  1062.      207,   208,    52,    53,   198,    71,   334,   331,   335,   194,
  1063.      355,    48,   323,    74,   332,   359,    54,    75,   336,   362,
  1064.      337,   117,   344,   396,   345,   397,   178,    77,   400,    81,
  1065.       29,    76,   210,   211,   348,   212,   213,   214,   215,   216,
  1066.      217,   218,   219,   220,   221,   222,   223,   224,   225,   226,
  1067.       96,    97,   227,   131,   164,   165,   135,   136,   132,   133,
  1068.      230,   165,   134,    78,   135,   136,   137,   262,   263,   138,
  1069.      139,   339,   340,   389,   209,    79,    80,    90,   374,   140,
  1070.       93,    98,   100,   120,   118,  -132,  -132,   141,   121,   142,
  1071.      119,   123,   125,   131,   381,   126,  -132,   143,   132,   133,
  1072.      144,   127,   134,   108,   135,   136,   137,   130,   166,   138,
  1073.      139,   219,   220,   221,   222,   223,   224,   225,   226,   140,
  1074.      167,   227,   172,   173,   174,   -85,   -85,   141,   176,   142,
  1075.      177,   180,   190,   131,   188,   191,   -85,   143,   132,   133,
  1076.      144,   199,   134,   209,   135,   136,   137,   228,   204,   138,
  1077.      139,   238,   239,   241,   242,   247,   240,   249,   243,   140,
  1078.      250,   227,   251,   256,   261,  -133,  -133,   141,   267,   142,
  1079.      293,   268,   269,   131,   294,   298,  -133,   143,   132,   133,
  1080.      144,   295,   134,   302,   135,   136,   137,   303,   308,   138,
  1081.      139,   316,   318,   322,   328,   343,   346,   363,   347,   140,
  1082.      356,   365,   366,   367,   372,   -86,   -86,   141,   373,   142,
  1083.      383,   385,   376,   131,   386,   388,   -86,   143,   132,   133,
  1084.      144,   390,   134,   391,   135,   136,   137,   393,    27,   138,
  1085.      139,   395,    88,   394,   398,    89,   401,   169,   246,   140,
  1086.      399,   364,   384,   369,   300,   301,   163,   141,   320,   142,
  1087.      392,   202,     0,   131,     0,   192,     0,   143,   132,   133,
  1088.      144,     0,   134,   229,   135,   136,   137,     0,     0,   138,
  1089.      139,     0,     0,     0,     0,     0,     0,     0,     0,   140,
  1090.        0,     0,     0,     0,     0,     0,     0,   141,     0,   142,
  1091.        0,     0,     0,   131,     0,     0,   -97,   143,   132,   133,
  1092.      144,     0,   134,     0,   135,   136,   137,     0,     0,   138,
  1093.      139,     0,     0,     0,     0,     0,     0,     0,     0,   140,
  1094.        0,     0,     0,     0,     0,     0,     0,   141,     0,   142,
  1095.        0,     0,     0,   131,     0,     0,   312,   143,   132,   133,
  1096.      144,     0,   134,     0,   135,   136,   137,     0,     0,   138,
  1097.      139,     0,     0,     0,     0,     0,     0,     0,     0,   140,
  1098.        0,     0,     0,     0,     0,     0,     0,   141,     0,   142,
  1099.        0,     0,     0,   131,     0,     0,   315,   143,   132,   133,
  1100.      144,     0,   134,     0,   135,   136,   137,     0,     0,   138,
  1101.      139,     0,     0,     0,     0,     0,     0,     0,     0,   140,
  1102.        0,     0,     0,     0,     0,     0,     0,   141,     0,   142,
  1103.      131,     0,     0,     0,     0,   132,   133,   143,     0,   134,
  1104.      144,   135,   136,   181,     1,     0,   138,   139,     2,     0,
  1105.        0,     0,     3,     4,     0,     5,     6,     7,     8,     9,
  1106.        0,     0,     0,     0,     0,     0,     0,     0,     0,    10,
  1107.        0,     0,   201,     0,   143,     0,     0,   144,   210,   211,
  1108.      327,   212,   213,   214,   215,   216,   217,   218,   219,   220,
  1109.      221,   222,   223,   224,   225,   226,     0,     0,   227,   210,
  1110.      211,   353,   212,   213,   214,   215,   216,   217,   218,   219,
  1111.      220,   221,   222,   223,   224,   225,   226,     0,     0,   227,
  1112.      210,   211,   378,   212,   213,   214,   215,   216,   217,   218,
  1113.      219,   220,   221,   222,   223,   224,   225,   226,   210,   211,
  1114.      227,   212,   213,   214,   215,   216,   217,   218,   219,   220,
  1115.      221,   222,   223,   224,   225,   226,     0,   211,   227,   212,
  1116.      213,   214,   215,   216,   217,   218,   219,   220,   221,   222,
  1117.      223,   224,   225,   226,     0,     0,   227,   213,   214,   215,
  1118.      216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
  1119.      226,     0,     0,   227,   214,   215,   216,   217,   218,   219,
  1120.      220,   221,   222,   223,   224,   225,   226,     0,     0,   227,
  1121.      216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
  1122.      226,     0,     0,   227,   217,   218,   219,   220,   221,   222,
  1123.      223,   224,   225,   226,     0,     0,   227
  1124. };
  1125.  
  1126. static const yytype_int16 yycheck[] =
  1127. {
  1128.       29,    34,   139,   150,   110,   187,   143,    40,   277,   191,
  1129.      295,    44,    45,    57,    17,   142,    34,    15,   145,    15,
  1130.       43,    29,    42,   150,    42,     0,    34,    35,    34,    38,
  1131.       38,    40,    40,    41,    42,    42,    42,    12,    71,    29,
  1132.       61,    62,    75,    76,    88,    78,    49,    80,    38,    72,
  1133.       40,    72,    42,   190,    42,    29,    49,    64,    76,   131,
  1134.      132,   133,    71,    51,    38,    73,    31,   100,    76,     0,
  1135.       73,    69,   144,    69,    42,    69,    64,    71,   363,   108,
  1136.       73,    71,    61,    62,    71,    39,   192,   120,    42,    43,
  1137.       70,   360,    39,    72,    48,   201,    43,    77,    70,    53,
  1138.       54,    48,    69,    70,    70,    77,    53,    54,    74,   256,
  1139.       31,    32,    70,    67,    35,   187,    74,    42,    72,   191,
  1140.       67,    29,    30,    31,    32,    72,   308,    35,   255,   256,
  1141.      267,   268,   269,   260,    69,    70,   165,   209,   210,   211,
  1142.      212,   213,    42,   215,   216,   217,   218,   219,   220,   221,
  1143.      222,   223,   224,   225,   226,    75,   228,    39,    70,   265,
  1144.       42,    43,    74,   310,   311,    70,    48,    42,    69,    74,
  1145.       71,    53,    54,    27,    28,    29,    30,    31,    32,   316,
  1146.       70,    35,    72,   310,   311,    67,   258,    70,    69,    70,
  1147.      262,    74,    15,    16,   321,    18,    19,    20,    21,    22,
  1148.       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  1149.       42,    70,    35,    70,   320,    74,    42,    74,   247,   356,
  1150.       70,    70,    70,    38,    74,    74,    74,   354,    39,   376,
  1151.       71,    70,    43,    72,    69,    70,   308,    48,    57,    58,
  1152.       59,    60,    53,    54,   371,    42,    70,    70,    72,   376,
  1153.      322,    49,   389,    49,    77,   327,    67,    42,    70,   331,
  1154.       72,    72,    70,    70,    72,    72,    70,    15,    72,    69,
  1155.       70,    42,    15,    16,   307,    18,    19,    20,    21,    22,
  1156.       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  1157.       69,    70,    35,    29,    69,    70,    40,    41,    34,    35,
  1158.       69,    70,    38,    42,    40,    41,    42,    61,    62,    45,
  1159.       46,    61,    62,    69,    70,    42,    42,    69,   347,    55,
  1160.       69,    50,    42,    42,    71,    61,    62,    63,    42,    65,
  1161.       71,    15,    69,    29,    77,    69,    72,    73,    34,    35,
  1162.       76,    40,    38,    43,    40,    41,    42,    72,    15,    45,
  1163.       46,    25,    26,    27,    28,    29,    30,    31,    32,    55,
  1164.       15,    35,    69,    38,    40,    61,    62,    63,    73,    65,
  1165.       40,    42,    73,    29,    42,    73,    72,    73,    34,    35,
  1166.       76,    69,    38,    70,    40,    41,    42,    76,    71,    45,
  1167.       46,    71,    73,    72,    71,    43,    69,    40,    70,    55,
  1168.       69,    35,    42,    66,    58,    61,    62,    63,    73,    65,
  1169.       42,    73,    73,    29,    38,    42,    72,    73,    34,    35,
  1170.       76,    71,    38,    38,    40,    41,    42,    38,    73,    45,
  1171.       46,    73,    17,    61,    42,    70,    42,    70,    43,    55,
  1172.       69,    42,    42,    17,    38,    61,    62,    63,    38,    65,
  1173.       17,    70,    56,    29,    42,    69,    72,    73,    34,    35,
  1174.       76,    70,    38,    38,    40,    41,    42,    40,    12,    45,
  1175.       46,    74,    61,    72,    71,    61,    72,   115,   175,    55,
  1176.      398,   334,   369,   341,   239,   242,   111,    63,   264,    65,
  1177.      389,   151,    -1,    29,    -1,    71,    -1,    73,    34,    35,
  1178.       76,    -1,    38,   161,    40,    41,    42,    -1,    -1,    45,
  1179.       46,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
  1180.       -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    65,
  1181.       -1,    -1,    -1,    29,    -1,    -1,    72,    73,    34,    35,
  1182.       76,    -1,    38,    -1,    40,    41,    42,    -1,    -1,    45,
  1183.       46,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
  1184.       -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    65,
  1185.       -1,    -1,    -1,    29,    -1,    -1,    72,    73,    34,    35,
  1186.       76,    -1,    38,    -1,    40,    41,    42,    -1,    -1,    45,
  1187.       46,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
  1188.       -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    65,
  1189.       -1,    -1,    -1,    29,    -1,    -1,    72,    73,    34,    35,
  1190.       76,    -1,    38,    -1,    40,    41,    42,    -1,    -1,    45,
  1191.       46,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
  1192.       -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    65,
  1193.       29,    -1,    -1,    -1,    -1,    34,    35,    73,    -1,    38,
  1194.       76,    40,    41,    42,    39,    -1,    45,    46,    43,    -1,
  1195.       -1,    -1,    47,    48,    -1,    50,    51,    52,    53,    54,
  1196.       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    64,
  1197.       -1,    -1,    71,    -1,    73,    -1,    -1,    76,    15,    16,
  1198.       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
  1199.       27,    28,    29,    30,    31,    32,    -1,    -1,    35,    15,
  1200.       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  1201.       26,    27,    28,    29,    30,    31,    32,    -1,    -1,    35,
  1202.       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
  1203.       25,    26,    27,    28,    29,    30,    31,    32,    15,    16,
  1204.       35,    18,    19,    20,    21,    22,    23,    24,    25,    26,
  1205.       27,    28,    29,    30,    31,    32,    -1,    16,    35,    18,
  1206.       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
  1207.       29,    30,    31,    32,    -1,    -1,    35,    19,    20,    21,
  1208.       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  1209.       32,    -1,    -1,    35,    20,    21,    22,    23,    24,    25,
  1210.       26,    27,    28,    29,    30,    31,    32,    -1,    -1,    35,
  1211.       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  1212.       32,    -1,    -1,    35,    23,    24,    25,    26,    27,    28,
  1213.       29,    30,    31,    32,    -1,    -1,    35
  1214. };
  1215.  
  1216. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  1217.    symbol of state STATE-NUM.  */
  1218. static const yytype_uint8 yystos[] =
  1219. {
  1220.        0,    39,    43,    47,    48,    50,    51,    52,    53,    54,
  1221.       64,    79,    80,    81,    82,    83,    85,    86,    87,    88,
  1222.       89,    90,    91,    31,    84,    42,     0,    81,    69,    70,
  1223.       69,    70,    69,    70,    42,    69,    70,    42,    71,    92,
  1224.       42,    75,   119,    84,    42,    42,   119,    42,    49,    39,
  1225.       42,    48,    53,    54,    67,    72,    83,    93,    94,    95,
  1226.       96,    97,    98,    99,   100,   101,   102,   104,   117,   119,
  1227.       38,    42,   119,   119,    49,    42,    42,    15,    42,    42,
  1228.       42,    69,    72,    94,    69,    71,    69,    71,    93,    98,
  1229.       69,    15,    69,    69,    15,    69,    69,    70,    50,   119,
  1230.       42,   119,   119,    38,    40,    71,   119,   119,    43,   120,
  1231.      121,   122,   123,    42,    64,   106,   107,    72,    71,    71,
  1232.       42,    42,   119,    15,   105,    69,    69,    40,   111,    84,
  1233.       72,    29,    34,    35,    38,    40,    41,    42,    45,    46,
  1234.       55,    63,    65,    73,    76,   125,   126,   127,   129,   130,
  1235.      131,   132,   133,   134,   135,   139,   140,   142,   143,   144,
  1236.      149,   150,   151,   123,    69,    70,    15,    15,    51,   107,
  1237.      112,   113,    69,    38,    40,   119,    73,    40,    70,    72,
  1238.       42,    42,   142,   142,   142,    17,    49,    73,    42,   140,
  1239.       73,    73,    71,   124,   126,   140,   142,   145,   126,    69,
  1240.      124,    71,   127,   128,    71,    57,    58,    59,    60,    70,
  1241.       15,    16,    18,    19,    20,    21,    22,    23,    24,    25,
  1242.       26,    27,    28,    29,    30,    31,    32,    35,    76,   151,
  1243.       69,    84,    29,    38,    40,    42,    71,   152,    71,    73,
  1244.       69,    72,    71,    70,    70,    72,   105,    43,   118,    40,
  1245.       69,    42,   145,   140,   145,   125,    66,    74,    70,    77,
  1246.      125,    58,    61,    62,   136,   137,   138,    73,    73,    73,
  1247.      142,   142,   142,   142,   142,    34,    42,    76,   146,   148,
  1248.      142,   142,   142,   142,   142,   142,   142,   142,   142,   142,
  1249.      142,   142,   142,    42,    38,    71,   109,   110,    42,   108,
  1250.      118,   121,    38,    38,   103,    84,    70,    74,    73,    74,
  1251.       74,    74,    72,   124,   142,    72,    73,   142,    17,    72,
  1252.      137,   125,    61,   140,   141,   140,   140,    17,    42,   147,
  1253.      148,    70,    77,   152,    70,    72,    70,    72,    74,    61,
  1254.       62,   114,   116,    70,    70,    72,    42,    43,   119,   145,
  1255.      124,   124,   140,    17,   125,   142,    69,    74,    74,   142,
  1256.       70,    77,   142,    70,   110,    42,    42,    17,    72,   116,
  1257.      115,   125,    38,    38,    84,    74,    56,    74,    17,   140,
  1258.      148,    77,   152,    17,   115,    70,    42,   124,    69,    69,
  1259.       70,    38,   141,    40,    72,    74,    70,    72,    71,   111,
  1260.       72,    72
  1261. };
  1262.  
  1263. #define yyerrok        (yyerrstatus = 0)
  1264. #define yyclearin    (yychar = YYEMPTY)
  1265. #define YYEMPTY        (-2)
  1266. #define YYEOF        0
  1267.  
  1268. #define YYACCEPT    goto yyacceptlab
  1269. #define YYABORT        goto yyabortlab
  1270. #define YYERROR        goto yyerrorlab
  1271.  
  1272.  
  1273. /* Like YYERROR except do call yyerror.  This remains here temporarily
  1274.    to ease the transition to the new meaning of YYERROR, for GCC.
  1275.    Once GCC version 2 has supplanted version 1, this can go.  */
  1276.  
  1277. #define YYFAIL        goto yyerrlab
  1278.  
  1279. #define YYRECOVERING()  (!!yyerrstatus)
  1280.  
  1281. #define YYBACKUP(Token, Value)                    \
  1282. do                                \
  1283.   if (yychar == YYEMPTY && yylen == 1)                \
  1284.     {                                \
  1285.       yychar = (Token);                        \
  1286.       yylval = (Value);                        \
  1287.       yytoken = YYTRANSLATE (yychar);                \
  1288.       YYPOPSTACK (1);                        \
  1289.       goto yybackup;                        \
  1290.     }                                \
  1291.   else                                \
  1292.     {                                \
  1293.       yyerror (YY_("syntax error: cannot back up")); \
  1294.       YYERROR;                            \
  1295.     }                                \
  1296. while (YYID (0))
  1297.  
  1298.  
  1299. #define YYTERROR    1
  1300. #define YYERRCODE    256
  1301.  
  1302.  
  1303. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  1304.    If N is 0, then set CURRENT to the empty location which ends
  1305.    the previous symbol: RHS[0] (always defined).  */
  1306.  
  1307. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  1308. #ifndef YYLLOC_DEFAULT
  1309. # define YYLLOC_DEFAULT(Current, Rhs, N)                \
  1310.     do                                    \
  1311.       if (YYID (N))                                                    \
  1312.     {                                \
  1313.       (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;    \
  1314.       (Current).first_column = YYRHSLOC (Rhs, 1).first_column;    \
  1315.       (Current).last_line    = YYRHSLOC (Rhs, N).last_line;        \
  1316.       (Current).last_column  = YYRHSLOC (Rhs, N).last_column;    \
  1317.     }                                \
  1318.       else                                \
  1319.     {                                \
  1320.       (Current).first_line   = (Current).last_line   =        \
  1321.         YYRHSLOC (Rhs, 0).last_line;                \
  1322.       (Current).first_column = (Current).last_column =        \
  1323.         YYRHSLOC (Rhs, 0).last_column;                \
  1324.     }                                \
  1325.     while (YYID (0))
  1326. #endif
  1327.  
  1328.  
  1329. /* YY_LOCATION_PRINT -- Print the location on the stream.
  1330.    This macro was not mandated originally: define only if we know
  1331.    we won't break user code: when these are the locations we know.  */
  1332.  
  1333. #ifndef YY_LOCATION_PRINT
  1334. # if YYLTYPE_IS_TRIVIAL
  1335. #  define YY_LOCATION_PRINT(File, Loc)            \
  1336.      fprintf (File, "%d.%d-%d.%d",            \
  1337.           (Loc).first_line, (Loc).first_column,    \
  1338.           (Loc).last_line,  (Loc).last_column)
  1339. # else
  1340. #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  1341. # endif
  1342. #endif
  1343.  
  1344.  
  1345. /* YYLEX -- calling `yylex' with the right arguments.  */
  1346.  
  1347. #ifdef YYLEX_PARAM
  1348. # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
  1349. #else
  1350. # define YYLEX yylex (&yylval, &yylloc)
  1351. #endif
  1352.  
  1353. /* Enable debugging if requested.  */
  1354. #if YYDEBUG
  1355.  
  1356. # ifndef YYFPRINTF
  1357. #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  1358. #  define YYFPRINTF fprintf
  1359. # endif
  1360.  
  1361. # define YYDPRINTF(Args)            \
  1362. do {                        \
  1363.   if (yydebug)                    \
  1364.     YYFPRINTF Args;                \
  1365. } while (YYID (0))
  1366.  
  1367. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)              \
  1368. do {                                      \
  1369.   if (yydebug)                                  \
  1370.     {                                      \
  1371.       YYFPRINTF (stderr, "%s ", Title);                      \
  1372.       yy_symbol_print (stderr,                          \
  1373.           Type, Value, Location); \
  1374.       YYFPRINTF (stderr, "\n");                          \
  1375.     }                                      \
  1376. } while (YYID (0))
  1377.  
  1378.  
  1379. /*--------------------------------.
  1380. | Print this symbol on YYOUTPUT.  |
  1381. `--------------------------------*/
  1382.  
  1383. /*ARGSUSED*/
  1384. #if (defined __STDC__ || defined __C99__FUNC__ \
  1385.      || defined __cplusplus || defined _MSC_VER)
  1386. static void
  1387. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  1388. #else
  1389. static void
  1390. yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
  1391.     FILE *yyoutput;
  1392.     int yytype;
  1393.     YYSTYPE const * const yyvaluep;
  1394.     YYLTYPE const * const yylocationp;
  1395. #endif
  1396. {
  1397.   if (!yyvaluep)
  1398.     return;
  1399.   YYUSE (yylocationp);
  1400. # ifdef YYPRINT
  1401.   if (yytype < YYNTOKENS)
  1402.     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  1403. # else
  1404.   YYUSE (yyoutput);
  1405. # endif
  1406.   switch (yytype)
  1407.     {
  1408.       default:
  1409.     break;
  1410.     }
  1411. }
  1412.  
  1413.  
  1414. /*--------------------------------.
  1415. | Print this symbol on YYOUTPUT.  |
  1416. `--------------------------------*/
  1417.  
  1418. #if (defined __STDC__ || defined __C99__FUNC__ \
  1419.      || defined __cplusplus || defined _MSC_VER)
  1420. static void
  1421. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
  1422. #else
  1423. static void
  1424. yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
  1425.     FILE *yyoutput;
  1426.     int yytype;
  1427.     YYSTYPE const * const yyvaluep;
  1428.     YYLTYPE const * const yylocationp;
  1429. #endif
  1430. {
  1431.   if (yytype < YYNTOKENS)
  1432.     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  1433.   else
  1434.     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  1435.  
  1436.   YY_LOCATION_PRINT (yyoutput, *yylocationp);
  1437.   YYFPRINTF (yyoutput, ": ");
  1438.   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
  1439.   YYFPRINTF (yyoutput, ")");
  1440. }
  1441.  
  1442. /*------------------------------------------------------------------.
  1443. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1444. | TOP (included).                                                   |
  1445. `------------------------------------------------------------------*/
  1446.  
  1447. #if (defined __STDC__ || defined __C99__FUNC__ \
  1448.      || defined __cplusplus || defined _MSC_VER)
  1449. static void
  1450. yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
  1451. #else
  1452. static void
  1453. yy_stack_print (bottom, top)
  1454.     yytype_int16 *bottom;
  1455.     yytype_int16 *top;
  1456. #endif
  1457. {
  1458.   YYFPRINTF (stderr, "Stack now");
  1459.   for (; bottom <= top; ++bottom)
  1460.     YYFPRINTF (stderr, " %d", *bottom);
  1461.   YYFPRINTF (stderr, "\n");
  1462. }
  1463.  
  1464. # define YY_STACK_PRINT(Bottom, Top)                \
  1465. do {                                \
  1466.   if (yydebug)                            \
  1467.     yy_stack_print ((Bottom), (Top));                \
  1468. } while (YYID (0))
  1469.  
  1470.  
  1471. /*------------------------------------------------.
  1472. | Report that the YYRULE is going to be reduced.  |
  1473. `------------------------------------------------*/
  1474.  
  1475. #if (defined __STDC__ || defined __C99__FUNC__ \
  1476.      || defined __cplusplus || defined _MSC_VER)
  1477. static void
  1478. yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
  1479. #else
  1480. static void
  1481. yy_reduce_print (yyvsp, yylsp, yyrule)
  1482.     YYSTYPE *yyvsp;
  1483.     YYLTYPE *yylsp;
  1484.     int yyrule;
  1485. #endif
  1486. {
  1487.   int yynrhs = yyr2[yyrule];
  1488.   int yyi;
  1489.   unsigned long int yylno = yyrline[yyrule];
  1490.   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1491.          yyrule - 1, yylno);
  1492.   /* The symbols being reduced.  */
  1493.   for (yyi = 0; yyi < yynrhs; yyi++)
  1494.     {
  1495.       fprintf (stderr, "   $%d = ", yyi + 1);
  1496.       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  1497.                &(yyvsp[(yyi + 1) - (yynrhs)])
  1498.                , &(yylsp[(yyi + 1) - (yynrhs)])               );
  1499.       fprintf (stderr, "\n");
  1500.     }
  1501. }
  1502.  
  1503. # define YY_REDUCE_PRINT(Rule)        \
  1504. do {                    \
  1505.   if (yydebug)                \
  1506.     yy_reduce_print (yyvsp, yylsp, Rule); \
  1507. } while (YYID (0))
  1508.  
  1509. /* Nonzero means print parse trace.  It is left uninitialized so that
  1510.    multiple parsers can coexist.  */
  1511. int yydebug;
  1512. #else /* !YYDEBUG */
  1513. # define YYDPRINTF(Args)
  1514. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1515. # define YY_STACK_PRINT(Bottom, Top)
  1516. # define YY_REDUCE_PRINT(Rule)
  1517. #endif /* !YYDEBUG */
  1518.  
  1519.  
  1520. /* YYINITDEPTH -- initial size of the parser's stacks.  */
  1521. #ifndef    YYINITDEPTH
  1522. # define YYINITDEPTH 200
  1523. #endif
  1524.  
  1525. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1526.    if the built-in stack extension method is used).
  1527.  
  1528.    Do not make this value too large; the results are undefined if
  1529.    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1530.    evaluated with infinite-precision integer arithmetic.  */
  1531.  
  1532. #ifndef YYMAXDEPTH
  1533. # define YYMAXDEPTH 10000
  1534. #endif
  1535.  
  1536.  
  1537.  
  1538. #if YYERROR_VERBOSE
  1539.  
  1540. # ifndef yystrlen
  1541. #  if defined __GLIBC__ && defined _STRING_H
  1542. #   define yystrlen strlen
  1543. #  else
  1544. /* Return the length of YYSTR.  */
  1545. #if (defined __STDC__ || defined __C99__FUNC__ \
  1546.      || defined __cplusplus || defined _MSC_VER)
  1547. static YYSIZE_T
  1548. yystrlen (const char *yystr)
  1549. #else
  1550. static YYSIZE_T
  1551. yystrlen (yystr)
  1552.     const char *yystr;
  1553. #endif
  1554. {
  1555.   YYSIZE_T yylen;
  1556.   for (yylen = 0; yystr[yylen]; yylen++)
  1557.     continue;
  1558.   return yylen;
  1559. }
  1560. #  endif
  1561. # endif
  1562.  
  1563. # ifndef yystpcpy
  1564. #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1565. #   define yystpcpy stpcpy
  1566. #  else
  1567. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1568.    YYDEST.  */
  1569. #if (defined __STDC__ || defined __C99__FUNC__ \
  1570.      || defined __cplusplus || defined _MSC_VER)
  1571. static char *
  1572. yystpcpy (char *yydest, const char *yysrc)
  1573. #else
  1574. static char *
  1575. yystpcpy (yydest, yysrc)
  1576.     char *yydest;
  1577.     const char *yysrc;
  1578. #endif
  1579. {
  1580.   char *yyd = yydest;
  1581.   const char *yys = yysrc;
  1582.  
  1583.   while ((*yyd++ = *yys++) != '\0')
  1584.     continue;
  1585.  
  1586.   return yyd - 1;
  1587. }
  1588. #  endif
  1589. # endif
  1590.  
  1591. # ifndef yytnamerr
  1592. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1593.    quotes and backslashes, so that it's suitable for yyerror.  The
  1594.    heuristic is that double-quoting is unnecessary unless the string
  1595.    contains an apostrophe, a comma, or backslash (other than
  1596.    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
  1597.    null, do not copy; instead, return the length of what the result
  1598.    would have been.  */
  1599. static YYSIZE_T
  1600. yytnamerr (char *yyres, const char *yystr)
  1601. {
  1602.   if (*yystr == '"')
  1603.     {
  1604.       YYSIZE_T yyn = 0;
  1605.       char const *yyp = yystr;
  1606.  
  1607.       for (;;)
  1608.     switch (*++yyp)
  1609.       {
  1610.       case '\'':
  1611.       case ',':
  1612.         goto do_not_strip_quotes;
  1613.  
  1614.       case '\\':
  1615.         if (*++yyp != '\\')
  1616.           goto do_not_strip_quotes;
  1617.         /* Fall through.  */
  1618.       default:
  1619.         if (yyres)
  1620.           yyres[yyn] = *yyp;
  1621.         yyn++;
  1622.         break;
  1623.  
  1624.       case '"':
  1625.         if (yyres)
  1626.           yyres[yyn] = '\0';
  1627.         return yyn;
  1628.       }
  1629.     do_not_strip_quotes: ;
  1630.     }
  1631.  
  1632.   if (! yyres)
  1633.     return yystrlen (yystr);
  1634.  
  1635.   return yystpcpy (yyres, yystr) - yyres;
  1636. }
  1637. # endif
  1638.  
  1639. /* Copy into YYRESULT an error message about the unexpected token
  1640.    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
  1641.    including the terminating null byte.  If YYRESULT is null, do not
  1642.    copy anything; just return the number of bytes that would be
  1643.    copied.  As a special case, return 0 if an ordinary "syntax error"
  1644.    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
  1645.    size calculation.  */
  1646. static YYSIZE_T
  1647. yysyntax_error (char *yyresult, int yystate, int yychar)
  1648. {
  1649.   int yyn = yypact[yystate];
  1650.  
  1651.   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
  1652.     return 0;
  1653.   else
  1654.     {
  1655.       int yytype = YYTRANSLATE (yychar);
  1656.       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
  1657.       YYSIZE_T yysize = yysize0;
  1658.       YYSIZE_T yysize1;
  1659.       int yysize_overflow = 0;
  1660.       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1661.       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1662.       int yyx;
  1663.  
  1664. # if 0
  1665.       /* This is so xgettext sees the translatable formats that are
  1666.      constructed on the fly.  */
  1667.       YY_("syntax error, unexpected %s");
  1668.       YY_("syntax error, unexpected %s, expecting %s");
  1669.       YY_("syntax error, unexpected %s, expecting %s or %s");
  1670.       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
  1671.       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
  1672. # endif
  1673.       char *yyfmt;
  1674.       char const *yyf;
  1675.       static char const yyunexpected[] = "syntax error, unexpected %s";
  1676.       static char const yyexpecting[] = ", expecting %s";
  1677.       static char const yyor[] = " or %s";
  1678.       char yyformat[sizeof yyunexpected
  1679.             + sizeof yyexpecting - 1
  1680.             + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
  1681.                * (sizeof yyor - 1))];
  1682.       char const *yyprefix = yyexpecting;
  1683.  
  1684.       /* Start YYX at -YYN if negative to avoid negative indexes in
  1685.      YYCHECK.  */
  1686.       int yyxbegin = yyn < 0 ? -yyn : 0;
  1687.  
  1688.       /* Stay within bounds of both yycheck and yytname.  */
  1689.       int yychecklim = YYLAST - yyn + 1;
  1690.       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1691.       int yycount = 1;
  1692.  
  1693.       yyarg[0] = yytname[yytype];
  1694.       yyfmt = yystpcpy (yyformat, yyunexpected);
  1695.  
  1696.       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1697.     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1698.       {
  1699.         if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1700.           {
  1701.         yycount = 1;
  1702.         yysize = yysize0;
  1703.         yyformat[sizeof yyunexpected - 1] = '\0';
  1704.         break;
  1705.           }
  1706.         yyarg[yycount++] = yytname[yyx];
  1707.         yysize1 = yysize + yytnamerr (0, yytname[yyx]);
  1708.         yysize_overflow |= (yysize1 < yysize);
  1709.         yysize = yysize1;
  1710.         yyfmt = yystpcpy (yyfmt, yyprefix);
  1711.         yyprefix = yyor;
  1712.       }
  1713.  
  1714.       yyf = YY_(yyformat);
  1715.       yysize1 = yysize + yystrlen (yyf);
  1716.       yysize_overflow |= (yysize1 < yysize);
  1717.       yysize = yysize1;
  1718.  
  1719.       if (yysize_overflow)
  1720.     return YYSIZE_MAXIMUM;
  1721.  
  1722.       if (yyresult)
  1723.     {
  1724.       /* Avoid sprintf, as that infringes on the user's name space.
  1725.          Don't have undefined behavior even if the translation
  1726.          produced a string with the wrong number of "%s"s.  */
  1727.       char *yyp = yyresult;
  1728.       int yyi = 0;
  1729.       while ((*yyp = *yyf) != '\0')
  1730.         {
  1731.           if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
  1732.         {
  1733.           yyp += yytnamerr (yyp, yyarg[yyi++]);
  1734.           yyf += 2;
  1735.         }
  1736.           else
  1737.         {
  1738.           yyp++;
  1739.           yyf++;
  1740.         }
  1741.         }
  1742.     }
  1743.       return yysize;
  1744.     }
  1745. }
  1746. #endif /* YYERROR_VERBOSE */
  1747.  
  1748.  
  1749. /*-----------------------------------------------.
  1750. | Release the memory associated to this symbol.  |
  1751. `-----------------------------------------------*/
  1752.  
  1753. /*ARGSUSED*/
  1754. #if (defined __STDC__ || defined __C99__FUNC__ \
  1755.      || defined __cplusplus || defined _MSC_VER)
  1756. static void
  1757. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
  1758. #else
  1759. static void
  1760. yydestruct (yymsg, yytype, yyvaluep, yylocationp)
  1761.     const char *yymsg;
  1762.     int yytype;
  1763.     YYSTYPE *yyvaluep;
  1764.     YYLTYPE *yylocationp;
  1765. #endif
  1766. {
  1767.   YYUSE (yyvaluep);
  1768.   YYUSE (yylocationp);
  1769.  
  1770.   if (!yymsg)
  1771.     yymsg = "Deleting";
  1772.   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1773.  
  1774.   switch (yytype)
  1775.     {
  1776.  
  1777.       default:
  1778.     break;
  1779.     }
  1780. }
  1781.  
  1782.  
  1783. /* Prevent warnings from -Wmissing-prototypes.  */
  1784.  
  1785. #ifdef YYPARSE_PARAM
  1786. #if defined __STDC__ || defined __cplusplus
  1787. int yyparse (void *YYPARSE_PARAM);
  1788. #else
  1789. int yyparse ();
  1790. #endif
  1791. #else /* ! YYPARSE_PARAM */
  1792. #if defined __STDC__ || defined __cplusplus
  1793. int yyparse (void);
  1794. #else
  1795. int yyparse ();
  1796. #endif
  1797. #endif /* ! YYPARSE_PARAM */
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804. /*----------.
  1805. | yyparse.  |
  1806. `----------*/
  1807.  
  1808. #ifdef YYPARSE_PARAM
  1809. #if (defined __STDC__ || defined __C99__FUNC__ \
  1810.      || defined __cplusplus || defined _MSC_VER)
  1811. int
  1812. yyparse (void *YYPARSE_PARAM)
  1813. #else
  1814. int
  1815. yyparse (YYPARSE_PARAM)
  1816.     void *YYPARSE_PARAM;
  1817. #endif
  1818. #else /* ! YYPARSE_PARAM */
  1819. #if (defined __STDC__ || defined __C99__FUNC__ \
  1820.      || defined __cplusplus || defined _MSC_VER)
  1821. int
  1822. yyparse (void)
  1823. #else
  1824. int
  1825. yyparse ()
  1826.  
  1827. #endif
  1828. #endif
  1829. {
  1830.   /* The look-ahead symbol.  */
  1831. int yychar;
  1832.  
  1833. /* The semantic value of the look-ahead symbol.  */
  1834. YYSTYPE yylval;
  1835.  
  1836. /* Number of syntax errors so far.  */
  1837. int yynerrs;
  1838. /* Location data for the look-ahead symbol.  */
  1839. YYLTYPE yylloc;
  1840.  
  1841.   int yystate;
  1842.   int yyn;
  1843.   int yyresult;
  1844.   /* Number of tokens to shift before error messages enabled.  */
  1845.   int yyerrstatus;
  1846.   /* Look-ahead token as an internal (translated) token number.  */
  1847.   int yytoken = 0;
  1848. #if YYERROR_VERBOSE
  1849.   /* Buffer for error messages, and its allocated size.  */
  1850.   char yymsgbuf[128];
  1851.   char *yymsg = yymsgbuf;
  1852.   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1853. #endif
  1854.  
  1855.   /* Three stacks and their tools:
  1856.      `yyss': related to states,
  1857.      `yyvs': related to semantic values,
  1858.      `yyls': related to locations.
  1859.  
  1860.      Refer to the stacks thru separate pointers, to allow yyoverflow
  1861.      to reallocate them elsewhere.  */
  1862.  
  1863.   /* The state stack.  */
  1864.   yytype_int16 yyssa[YYINITDEPTH];
  1865.   yytype_int16 *yyss = yyssa;
  1866.   yytype_int16 *yyssp;
  1867.  
  1868.   /* The semantic value stack.  */
  1869.   YYSTYPE yyvsa[YYINITDEPTH];
  1870.   YYSTYPE *yyvs = yyvsa;
  1871.   YYSTYPE *yyvsp;
  1872.  
  1873.   /* The location stack.  */
  1874.   YYLTYPE yylsa[YYINITDEPTH];
  1875.   YYLTYPE *yyls = yylsa;
  1876.   YYLTYPE *yylsp;
  1877.   /* The locations where the error started and ended.  */
  1878.   YYLTYPE yyerror_range[2];
  1879.  
  1880. #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
  1881.  
  1882.   YYSIZE_T yystacksize = YYINITDEPTH;
  1883.  
  1884.   /* The variables used to return semantic value and location from the
  1885.      action routines.  */
  1886.   YYSTYPE yyval;
  1887.   YYLTYPE yyloc;
  1888.  
  1889.   /* The number of symbols on the RHS of the reduced rule.
  1890.      Keep to zero when no symbol should be popped.  */
  1891.   int yylen = 0;
  1892.  
  1893.   YYDPRINTF ((stderr, "Starting parse\n"));
  1894.  
  1895.   yystate = 0;
  1896.   yyerrstatus = 0;
  1897.   yynerrs = 0;
  1898.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  1899.  
  1900.   /* Initialize stack pointers.
  1901.      Waste one element of value and location stack
  1902.      so that they stay on the same level as the state stack.
  1903.      The wasted elements are never initialized.  */
  1904.  
  1905.   yyssp = yyss;
  1906.   yyvsp = yyvs;
  1907.   yylsp = yyls;
  1908. #if YYLTYPE_IS_TRIVIAL
  1909.   /* Initialize the default location before parsing starts.  */
  1910.   yylloc.first_line   = yylloc.last_line   = 1;
  1911.   yylloc.first_column = yylloc.last_column = 0;
  1912. #endif
  1913.  
  1914.   goto yysetstate;
  1915.  
  1916. /*------------------------------------------------------------.
  1917. | yynewstate -- Push a new state, which is found in yystate.  |
  1918. `------------------------------------------------------------*/
  1919.  yynewstate:
  1920.   /* In all cases, when you get here, the value and location stacks
  1921.      have just been pushed.  So pushing a state here evens the stacks.  */
  1922.   yyssp++;
  1923.  
  1924.  yysetstate:
  1925.   *yyssp = yystate;
  1926.  
  1927.   if (yyss + yystacksize - 1 <= yyssp)
  1928.     {
  1929.       /* Get the current used size of the three stacks, in elements.  */
  1930.       YYSIZE_T yysize = yyssp - yyss + 1;
  1931.  
  1932. #ifdef yyoverflow
  1933.       {
  1934.     /* Give user a chance to reallocate the stack.  Use copies of
  1935.        these so that the &'s don't force the real ones into
  1936.        memory.  */
  1937.     YYSTYPE *yyvs1 = yyvs;
  1938.     yytype_int16 *yyss1 = yyss;
  1939.     YYLTYPE *yyls1 = yyls;
  1940.  
  1941.     /* Each stack pointer address is followed by the size of the
  1942.        data in use in that stack, in bytes.  This used to be a
  1943.        conditional around just the two extra args, but that might
  1944.        be undefined if yyoverflow is a macro.  */
  1945.     yyoverflow (YY_("memory exhausted"),
  1946.             &yyss1, yysize * sizeof (*yyssp),
  1947.             &yyvs1, yysize * sizeof (*yyvsp),
  1948.             &yyls1, yysize * sizeof (*yylsp),
  1949.             &yystacksize);
  1950.     yyls = yyls1;
  1951.     yyss = yyss1;
  1952.     yyvs = yyvs1;
  1953.       }
  1954. #else /* no yyoverflow */
  1955. # ifndef YYSTACK_RELOCATE
  1956.       goto yyexhaustedlab;
  1957. # else
  1958.       /* Extend the stack our own way.  */
  1959.       if (YYMAXDEPTH <= yystacksize)
  1960.     goto yyexhaustedlab;
  1961.       yystacksize *= 2;
  1962.       if (YYMAXDEPTH < yystacksize)
  1963.     yystacksize = YYMAXDEPTH;
  1964.  
  1965.       {
  1966.     yytype_int16 *yyss1 = yyss;
  1967.     union yyalloc *yyptr =
  1968.       (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1969.     if (! yyptr)
  1970.       goto yyexhaustedlab;
  1971.     YYSTACK_RELOCATE (yyss);
  1972.     YYSTACK_RELOCATE (yyvs);
  1973.     YYSTACK_RELOCATE (yyls);
  1974. #  undef YYSTACK_RELOCATE
  1975.     if (yyss1 != yyssa)
  1976.       YYSTACK_FREE (yyss1);
  1977.       }
  1978. # endif
  1979. #endif /* no yyoverflow */
  1980.  
  1981.       yyssp = yyss + yysize - 1;
  1982.       yyvsp = yyvs + yysize - 1;
  1983.       yylsp = yyls + yysize - 1;
  1984.  
  1985.       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1986.           (unsigned long int) yystacksize));
  1987.  
  1988.       if (yyss + yystacksize - 1 <= yyssp)
  1989.     YYABORT;
  1990.     }
  1991.  
  1992.   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1993.  
  1994.   goto yybackup;
  1995.  
  1996. /*-----------.
  1997. | yybackup.  |
  1998. `-----------*/
  1999. yybackup:
  2000.  
  2001.   /* Do appropriate processing given the current state.  Read a
  2002.      look-ahead token if we need one and don't already have one.  */
  2003.  
  2004.   /* First try to decide what to do without reference to look-ahead token.  */
  2005.   yyn = yypact[yystate];
  2006.   if (yyn == YYPACT_NINF)
  2007.     goto yydefault;
  2008.  
  2009.   /* Not known => get a look-ahead token if don't already have one.  */
  2010.  
  2011.   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
  2012.   if (yychar == YYEMPTY)
  2013.     {
  2014.       YYDPRINTF ((stderr, "Reading a token: "));
  2015.       yychar = YYLEX;
  2016.     }
  2017.  
  2018.   if (yychar <= YYEOF)
  2019.     {
  2020.       yychar = yytoken = YYEOF;
  2021.       YYDPRINTF ((stderr, "Now at end of input.\n"));
  2022.     }
  2023.   else
  2024.     {
  2025.       yytoken = YYTRANSLATE (yychar);
  2026.       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  2027.     }
  2028.  
  2029.   /* If the proper action on seeing token YYTOKEN is to reduce or to
  2030.      detect an error, take that action.  */
  2031.   yyn += yytoken;
  2032.   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  2033.     goto yydefault;
  2034.   yyn = yytable[yyn];
  2035.   if (yyn <= 0)
  2036.     {
  2037.       if (yyn == 0 || yyn == YYTABLE_NINF)
  2038.     goto yyerrlab;
  2039.       yyn = -yyn;
  2040.       goto yyreduce;
  2041.     }
  2042.  
  2043.   if (yyn == YYFINAL)
  2044.     YYACCEPT;
  2045.  
  2046.   /* Count tokens shifted since error; after three, turn off error
  2047.      status.  */
  2048.   if (yyerrstatus)
  2049.     yyerrstatus--;
  2050.  
  2051.   /* Shift the look-ahead token.  */
  2052.   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  2053.  
  2054.   /* Discard the shifted token unless it is eof.  */
  2055.   if (yychar != YYEOF)
  2056.     yychar = YYEMPTY;
  2057.  
  2058.   yystate = yyn;
  2059.   *++yyvsp = yylval;
  2060.   *++yylsp = yylloc;
  2061.   goto yynewstate;
  2062.  
  2063.  
  2064. /*-----------------------------------------------------------.
  2065. | yydefault -- do the default action for the current state.  |
  2066. `-----------------------------------------------------------*/
  2067. yydefault:
  2068.   yyn = yydefact[yystate];
  2069.   if (yyn == 0)
  2070.     goto yyerrlab;
  2071.   goto yyreduce;
  2072.  
  2073.  
  2074. /*-----------------------------.
  2075. | yyreduce -- Do a reduction.  |
  2076. `-----------------------------*/
  2077. yyreduce:
  2078.   /* yyn is the number of a rule to reduce with.  */
  2079.   yylen = yyr2[yyn];
  2080.  
  2081.   /* If YYLEN is nonzero, implement the default value of the action:
  2082.      `$$ = $1'.
  2083.  
  2084.      Otherwise, the following line sets YYVAL to garbage.
  2085.      This behavior is undocumented and Bison
  2086.      users should not rely upon it.  Assigning to YYVAL
  2087.      unconditionally makes the parser a bit smaller, and it avoids a
  2088.      GCC warning that YYVAL may be used uninitialized.  */
  2089.   yyval = yyvsp[1-yylen];
  2090.  
  2091.   /* Default location.  */
  2092.   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  2093.   YY_REDUCE_PRINT (yyn);
  2094.   switch (yyn)
  2095.     {
  2096.         case 8:
  2097. #line 350 "/usr/tmp/scc_parse.y"
  2098.     {;}
  2099.     break;
  2100.  
  2101.   case 9:
  2102. #line 352 "/usr/tmp/scc_parse.y"
  2103.     {;}
  2104.     break;
  2105.  
  2106.   case 10:
  2107. #line 354 "/usr/tmp/scc_parse.y"
  2108.     {;}
  2109.     break;
  2110.  
  2111.   case 12:
  2112. #line 359 "/usr/tmp/scc_parse.y"
  2113.     {
  2114.   if((yyvsp[(1) - (4)].integer) == SCC_VAR_BIT && !(yyvsp[(2) - (4)].integer))
  2115.     scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (4)].str),SCC_RES_BVAR,(yyvsp[(1) - (4)].integer),(yyvsp[(4) - (4)].integer));
  2116.   else
  2117.     scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (4)].str),SCC_RES_VAR,(yyvsp[(1) - (4)].integer) | (yyvsp[(2) - (4)].integer),(yyvsp[(4) - (4)].integer));
  2118.  
  2119.   (yyval.integer) = (yyvsp[(1) - (4)].integer);
  2120. ;}
  2121.     break;
  2122.  
  2123.   case 13:
  2124. #line 368 "/usr/tmp/scc_parse.y"
  2125.     {
  2126.   if((yyvsp[(1) - (5)].integer) == SCC_VAR_BIT && !(yyvsp[(3) - (5)].integer))
  2127.     scc_ns_decl(sccp->ns,NULL,(yyvsp[(4) - (5)].str),SCC_RES_BVAR,(yyvsp[(1) - (5)].integer),(yyvsp[(5) - (5)].integer));
  2128.   else
  2129.     scc_ns_decl(sccp->ns,NULL,(yyvsp[(4) - (5)].str),SCC_RES_VAR,(yyvsp[(1) - (5)].integer) | (yyvsp[(3) - (5)].integer),(yyvsp[(5) - (5)].integer));
  2130.  
  2131.   (yyval.integer) = (yyvsp[(1) - (5)].integer);
  2132. ;}
  2133.     break;
  2134.  
  2135.   case 14:
  2136. #line 379 "/usr/tmp/scc_parse.y"
  2137.     {
  2138.   (yyval.integer) = 0;
  2139. ;}
  2140.     break;
  2141.  
  2142.   case 15:
  2143. #line 383 "/usr/tmp/scc_parse.y"
  2144.     {
  2145.   (yyval.integer) = SCC_VAR_ARRAY;
  2146. ;}
  2147.     break;
  2148.  
  2149.   case 16:
  2150. #line 391 "/usr/tmp/scc_parse.y"
  2151.     {
  2152.   scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (3)].str),SCC_RES_ROOM,0,(yyvsp[(3) - (3)].integer));
  2153. ;}
  2154.     break;
  2155.  
  2156.   case 17:
  2157. #line 395 "/usr/tmp/scc_parse.y"
  2158.     {
  2159.   scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (4)].str),SCC_RES_ROOM,0,(yyvsp[(4) - (4)].integer));
  2160. ;}
  2161.     break;
  2162.  
  2163.   case 18:
  2164. #line 401 "/usr/tmp/scc_parse.y"
  2165.     {
  2166.   scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (3)].str),(yyvsp[(1) - (3)].integer),0,(yyvsp[(3) - (3)].integer));
  2167. ;}
  2168.     break;
  2169.  
  2170.   case 19:
  2171. #line 405 "/usr/tmp/scc_parse.y"
  2172.     {
  2173.   scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (4)].str),(yyvsp[(1) - (4)].integer),0,(yyvsp[(4) - (4)].integer));
  2174. ;}
  2175.     break;
  2176.  
  2177.   case 20:
  2178. #line 411 "/usr/tmp/scc_parse.y"
  2179.     { 
  2180.   (yyval.integer) = SCC_RES_ACTOR;
  2181. ;}
  2182.     break;
  2183.  
  2184.   case 21:
  2185. #line 415 "/usr/tmp/scc_parse.y"
  2186.     { 
  2187.   (yyval.integer) = SCC_RES_VERB;
  2188. ;}
  2189.     break;
  2190.  
  2191.   case 22:
  2192. #line 419 "/usr/tmp/scc_parse.y"
  2193.     { 
  2194.   (yyval.integer) = SCC_RES_CLASS;
  2195. ;}
  2196.     break;
  2197.  
  2198.   case 23:
  2199. #line 426 "/usr/tmp/scc_parse.y"
  2200.     {
  2201.   scc_ns_decl(sccp->ns,(yyvsp[(2) - (5)].str),(yyvsp[(4) - (5)].str),(yyvsp[(1) - (5)].integer),0,(yyvsp[(5) - (5)].integer));
  2202.   (yyval.integer) = (yyvsp[(1) - (5)].integer); // hack to propagte the type
  2203. ;}
  2204.     break;
  2205.  
  2206.   case 24:
  2207. #line 431 "/usr/tmp/scc_parse.y"
  2208.     {
  2209.   scc_ns_decl(sccp->ns,(yyvsp[(3) - (6)].str),(yyvsp[(5) - (6)].str),(yyvsp[(1) - (6)].integer),0,(yyvsp[(6) - (6)].integer));
  2210. ;}
  2211.     break;
  2212.  
  2213.   case 26:
  2214. #line 438 "/usr/tmp/scc_parse.y"
  2215.     { 
  2216.   (yyval.integer) = SCC_RES_OBJ;
  2217. ;}
  2218.     break;
  2219.  
  2220.   case 27:
  2221. #line 442 "/usr/tmp/scc_parse.y"
  2222.     { 
  2223.   (yyval.integer) = SCC_RES_SCR;
  2224. ;}
  2225.     break;
  2226.  
  2227.   case 28:
  2228. #line 446 "/usr/tmp/scc_parse.y"
  2229.     { 
  2230.   (yyval.integer) = SCC_RES_VOICE;
  2231. ;}
  2232.     break;
  2233.  
  2234.   case 29:
  2235. #line 450 "/usr/tmp/scc_parse.y"
  2236.     { 
  2237.   (yyval.integer) = SCC_RES_CYCL;
  2238. ;}
  2239.     break;
  2240.  
  2241.   case 30:
  2242. #line 458 "/usr/tmp/scc_parse.y"
  2243.     {
  2244.   scc_symbol_t* sym = scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (3)].str),SCC_RES_ROOM,0,(yyvsp[(3) - (3)].integer));
  2245.   scc_ns_get_rid(sccp->ns,sym);
  2246.   scc_ns_push(sccp->ns,sym);
  2247.   sccp->roobj = scc_roobj_new(sccp->target,sym);
  2248. ;}
  2249.     break;
  2250.  
  2251.   case 31:
  2252. #line 468 "/usr/tmp/scc_parse.y"
  2253.     {
  2254.   scc_log(LOG_DBG,"Room done :)\n");
  2255.   sccp->local_scr = sccp->target->max_global_scr;
  2256.   memset(&sccp->ns->as[SCC_RES_LSCR],0,0x10000/8);
  2257.   sccp->cycl = 1;
  2258.   scc_ns_clear(sccp->ns,SCC_RES_CYCL);
  2259.   scc_ns_pop(sccp->ns);
  2260.  
  2261.   if(!sccp->roobj->scr &&
  2262.      !sccp->roobj->lscr &&
  2263.      !sccp->roobj->obj &&
  2264.      !sccp->roobj->res &&
  2265.      !sccp->roobj->cycl &&
  2266.      !sccp->roobj->image) {
  2267.     scc_log(LOG_DBG,"Room is empty, only declarations.\n");
  2268.     scc_roobj_free(sccp->roobj);
  2269.   } else {
  2270.     sccp->roobj->next = sccp->roobj_list;
  2271.     sccp->roobj_list = sccp->roobj;
  2272.   }
  2273.   sccp->roobj = NULL;
  2274. ;}
  2275.     break;
  2276.  
  2277.   case 37:
  2278. #line 504 "/usr/tmp/scc_parse.y"
  2279.     {
  2280.   if(!(yyvsp[(1) - (4)].sym)->rid) scc_ns_get_rid(sccp->ns,(yyvsp[(1) - (4)].sym));
  2281.   if((yyvsp[(3) - (4)].scr)) {
  2282.     (yyvsp[(3) - (4)].scr)->sym = (yyvsp[(1) - (4)].sym);
  2283.     scc_roobj_add_scr(sccp->roobj,(yyvsp[(3) - (4)].scr));
  2284.   }
  2285.  
  2286.   scc_ns_clear(sccp->ns,SCC_RES_LVAR);
  2287.   scc_ns_pop(sccp->ns);
  2288. ;}
  2289.     break;
  2290.  
  2291.   case 38:
  2292. #line 516 "/usr/tmp/scc_parse.y"
  2293.     {
  2294.   // well :)
  2295.   scc_ns_clear(sccp->ns,SCC_RES_LVAR);
  2296.   scc_ns_pop(sccp->ns);
  2297. ;}
  2298.     break;
  2299.  
  2300.   case 39:
  2301. #line 523 "/usr/tmp/scc_parse.y"
  2302.     {
  2303.   if(!(yyvsp[(1) - (5)].sym)->rid) scc_ns_get_rid(sccp->ns,(yyvsp[(1) - (5)].sym));
  2304.   // add the obj to the room
  2305.   scc_roobj_add_obj(sccp->roobj,sccp->obj);
  2306.   sccp->obj = NULL;
  2307. ;}
  2308.     break;
  2309.  
  2310.   case 40:
  2311. #line 531 "/usr/tmp/scc_parse.y"
  2312.     {
  2313.   scc_roobj_obj_free(sccp->obj);
  2314.   sccp->obj = NULL;
  2315. ;}
  2316.     break;
  2317.  
  2318.   case 41:
  2319. #line 536 "/usr/tmp/scc_parse.y"
  2320.     {;}
  2321.     break;
  2322.  
  2323.   case 42:
  2324. #line 538 "/usr/tmp/scc_parse.y"
  2325.     {;}
  2326.     break;
  2327.  
  2328.   case 43:
  2329. #line 540 "/usr/tmp/scc_parse.y"
  2330.     {;}
  2331.     break;
  2332.  
  2333.   case 44:
  2334. #line 542 "/usr/tmp/scc_parse.y"
  2335.     {;}
  2336.     break;
  2337.  
  2338.   case 45:
  2339. #line 544 "/usr/tmp/scc_parse.y"
  2340.     {;}
  2341.     break;
  2342.  
  2343.   case 46:
  2344. #line 546 "/usr/tmp/scc_parse.y"
  2345.     {;}
  2346.     break;
  2347.  
  2348.   case 47:
  2349. #line 550 "/usr/tmp/scc_parse.y"
  2350.     {
  2351.   scc_scr_arg_t* a = (yyvsp[(5) - (7)].arg);
  2352.   scc_symbol_t* s;
  2353.  
  2354.   s = scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (7)].str),(yyvsp[(1) - (7)].integer),0,(yyvsp[(7) - (7)].integer));
  2355.   if(!s) SCC_ABORT((yylsp[(3) - (7)]),"Failed to declare script %s.\n",(yyvsp[(3) - (7)].str));
  2356.  
  2357.   if((yyvsp[(1) - (7)].integer) == SCC_RES_LSCR && s->addr < 0 &&
  2358.      strcmp((yyvsp[(3) - (7)].str),"entry") && strcmp((yyvsp[(3) - (7)].str),"exit"))
  2359.     if(!scc_ns_alloc_sym_addr(sccp->ns,s,&sccp->local_scr))
  2360.       SCC_ABORT((yylsp[(3) - (7)]),"Failed to allocate local script address.\n");
  2361.  
  2362.   scc_ns_push(sccp->ns,s);
  2363.  
  2364.   // declare the arguments
  2365.   sccp->local_vars = 0;
  2366.   while(a) {
  2367.     scc_ns_decl(sccp->ns,NULL,a->sym,SCC_RES_LVAR,a->type,sccp->local_vars);
  2368.     sccp->local_vars++;
  2369.     a = a->next;
  2370.   }
  2371.   (yyval.sym) = s;
  2372. ;}
  2373.     break;
  2374.  
  2375.   case 48:
  2376. #line 576 "/usr/tmp/scc_parse.y"
  2377.     {
  2378.   scc_symbol_t* sym;
  2379.  
  2380.   if(sccp->obj)
  2381.     SCC_ABORT((yylsp[(1) - (3)]),"Something went wrong with object declarations.\n");
  2382.  
  2383.  
  2384.   sym = scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (3)].str),SCC_RES_OBJ,0,(yyvsp[(3) - (3)].integer));
  2385.   if(!sym) SCC_ABORT((yylsp[(1) - (3)]),"Failed to declare object %s.\n",(yyvsp[(2) - (3)].str));
  2386.   
  2387.   sccp->obj = scc_roobj_obj_new(sym);
  2388.   (yyval.sym) = sym;
  2389. ;}
  2390.     break;
  2391.  
  2392.   case 51:
  2393. #line 598 "/usr/tmp/scc_parse.y"
  2394.     {
  2395.   if((yyvsp[(2) - (4)].integer) != '=')
  2396.     SCC_ABORT((yylsp[(2) - (4)]),"Invalid operator for parameter setting.\n");
  2397.  
  2398.   scc_parser_find_res(sccp,&(yyvsp[(3) - (4)].str));
  2399.   if(!scc_roobj_set_param(sccp->roobj,sccp->ns,(yyvsp[(1) - (4)].str),(yyvsp[(3) - (4)].str)))
  2400.     SCC_ABORT((yylsp[(1) - (4)]),"Failed to set room %s.\n",(yyvsp[(1) - (4)].str));
  2401.  
  2402.   // add dep
  2403.   if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(3) - (4)].str));
  2404. ;}
  2405.     break;
  2406.  
  2407.   case 52:
  2408. #line 610 "/usr/tmp/scc_parse.y"
  2409.     {
  2410.   int i;
  2411.   if((yyvsp[(2) - (6)].integer) != '=')
  2412.     SCC_ABORT((yylsp[(2) - (6)]),"Invalid operator for parameter setting.\n");
  2413.  
  2414.   for(i = 0 ; (yyvsp[(4) - (6)].strlist)[i] ; i++) {
  2415.     if((yyvsp[(4) - (6)].strlist)[i][0] == '\0') continue;
  2416.     if(!scc_roobj_set_zplane(sccp->roobj,i+1,(yyvsp[(4) - (6)].strlist)[i]))
  2417.       SCC_ABORT((yylsp[(1) - (6)]),"Failed to set room zplane %d.\n",i+1);
  2418.   }
  2419. ;}
  2420.     break;
  2421.  
  2422.   case 53:
  2423. #line 622 "/usr/tmp/scc_parse.y"
  2424.     {
  2425.   if((yyvsp[(2) - (4)].integer) != '=')
  2426.     SCC_ABORT((yylsp[(2) - (4)]),"Invalid operator for parameter setting.\n");
  2427.  
  2428.   if(strcmp((yyvsp[(1) - (4)].str),"trans"))
  2429.     SCC_ABORT((yylsp[(1) - (4)]),"Rooms have no parameter named %s.\n",(yyvsp[(1) - (4)].str));
  2430.  
  2431.   if((yyvsp[(3) - (4)].integer) < 0 || (yyvsp[(3) - (4)].integer) > 255)
  2432.     SCC_ABORT((yylsp[(3) - (4)]),"Invalid transparent color index: %d\n",(yyvsp[(3) - (4)].integer));
  2433.  
  2434.   sccp->roobj->trans = (yyvsp[(3) - (4)].integer);
  2435. ;}
  2436.     break;
  2437.  
  2438.   case 54:
  2439. #line 638 "/usr/tmp/scc_parse.y"
  2440.     {
  2441.   if((yyvsp[(2) - (11)].integer) != '=')
  2442.     SCC_ABORT((yylsp[(3) - (11)]),"Invalid operator for cycle declaration.\n");
  2443.  
  2444.   if(!scc_roobj_add_cycl(sccp->roobj,(yyvsp[(1) - (11)].sym),(yyvsp[(4) - (11)].integer),(yyvsp[(6) - (11)].integer),(yyvsp[(8) - (11)].integer),(yyvsp[(10) - (11)].integer)))
  2445.     SCC_ABORT((yylsp[(1) - (11)]),"Failed to add cycl.\n");
  2446. ;}
  2447.     break;
  2448.  
  2449.   case 55:
  2450. #line 648 "/usr/tmp/scc_parse.y"
  2451.     {
  2452.   (yyval.sym) = scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (3)].str),SCC_RES_CYCL,0,(yyvsp[(3) - (3)].integer));
  2453.   if(!(yyval.sym)) SCC_ABORT((yylsp[(1) - (3)]),"Cycl declaration failed.\n");
  2454.   if((yyval.sym)->addr < 0 && !scc_ns_alloc_sym_addr(sccp->ns,(yyval.sym),&sccp->cycl))
  2455.       SCC_ABORT((yylsp[(1) - (3)]),"Failed to allocate cycle address.\n");
  2456. ;}
  2457.     break;
  2458.  
  2459.   case 56:
  2460. #line 657 "/usr/tmp/scc_parse.y"
  2461.     {
  2462.   if((yyvsp[(2) - (7)].integer) != '=')
  2463.     SCC_ABORT((yylsp[(2) - (7)]),"Invalid operator for voice declaration.\n");
  2464.  
  2465.   if(!(yyvsp[(1) - (7)].sym)->rid) scc_ns_get_rid(sccp->ns,(yyvsp[(1) - (7)].sym));
  2466.  
  2467.   scc_parser_find_res(sccp,&(yyvsp[(4) - (7)].str));
  2468.   if(!scc_roobj_add_voice(sccp->roobj,(yyvsp[(1) - (7)].sym),(yyvsp[(4) - (7)].str),(yyvsp[(6) - (7)].intlist)[0],(yyvsp[(6) - (7)].intlist)+1))
  2469.     SCC_ABORT((yylsp[(1) - (7)]),"Failed to add voice.");
  2470.  
  2471.   if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(4) - (7)].str));
  2472.  
  2473.   free((yyvsp[(6) - (7)].intlist));
  2474. ;}
  2475.     break;
  2476.  
  2477.   case 57:
  2478. #line 672 "/usr/tmp/scc_parse.y"
  2479.     {
  2480.   if((yyvsp[(2) - (5)].integer) != '=')
  2481.     SCC_ABORT((yylsp[(3) - (5)]),"Invalid operator for voice declaration.\n");
  2482.  
  2483.   if(!(yyvsp[(1) - (5)].sym)->rid) scc_ns_get_rid(sccp->ns,(yyvsp[(1) - (5)].sym));
  2484.  
  2485.   scc_parser_find_res(sccp,&(yyvsp[(4) - (5)].str));
  2486.   if(!scc_roobj_add_voice(sccp->roobj,(yyvsp[(1) - (5)].sym),(yyvsp[(4) - (5)].str),0,NULL))
  2487.     SCC_ABORT((yylsp[(1) - (5)]),"Failed to add voice.");
  2488.  
  2489.   if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(4) - (5)].str));
  2490. ;}
  2491.     break;
  2492.  
  2493.   case 58:
  2494. #line 687 "/usr/tmp/scc_parse.y"
  2495.     {
  2496.   (yyval.sym) = scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (2)].str),SCC_RES_VOICE,0,-1);
  2497.   if(!(yyval.sym)) SCC_ABORT((yylsp[(1) - (2)]),"Declaration failed.\n");
  2498. ;}
  2499.     break;
  2500.  
  2501.   case 59:
  2502. #line 694 "/usr/tmp/scc_parse.y"
  2503.     {
  2504.   (yyval.intlist) = malloc(2*sizeof(int));
  2505.   (yyval.intlist)[0] = 1;
  2506.   (yyval.intlist)[1] = (yyvsp[(1) - (1)].integer);
  2507. ;}
  2508.     break;
  2509.  
  2510.   case 60:
  2511. #line 700 "/usr/tmp/scc_parse.y"
  2512.     {
  2513.   int l = (yyvsp[(1) - (3)].intlist)[0]+1;
  2514.   (yyval.intlist) = realloc((yyvsp[(1) - (3)].intlist),(l+1)*sizeof(int));
  2515.   (yyval.intlist)[l] = (yyvsp[(3) - (3)].integer);
  2516.   (yyval.intlist)[0] = l;
  2517. ;}
  2518.     break;
  2519.  
  2520.   case 61:
  2521. #line 710 "/usr/tmp/scc_parse.y"
  2522.     {
  2523.   scc_symbol_t* r = scc_ns_decl(sccp->ns,NULL,(yyvsp[(2) - (4)].str),(yyvsp[(1) - (4)].integer),0,(yyvsp[(3) - (4)].integer));
  2524.   
  2525.   if((yyvsp[(4) - (4)].str)) {
  2526.     scc_parser_find_res(sccp,&(yyvsp[(4) - (4)].str));
  2527.     // then we need to add that to the roobj
  2528.     if(!sccp->do_deps && !scc_roobj_add_res(sccp->roobj,r,(yyvsp[(4) - (4)].str)))
  2529.       SCC_ABORT((yylsp[(2) - (4)]),"Failed to declare %s.\n",(yyvsp[(2) - (4)].str));
  2530.     if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(4) - (4)].str));
  2531.  
  2532.     if(!r->rid) scc_ns_get_rid(sccp->ns,r);
  2533.   }
  2534.   (yyval.integer) = (yyvsp[(1) - (4)].integer); // propagate type  
  2535. ;}
  2536.     break;
  2537.  
  2538.   case 62:
  2539. #line 725 "/usr/tmp/scc_parse.y"
  2540.     {
  2541.   scc_symbol_t* r = scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (5)].str),(yyvsp[(1) - (5)].integer),0,(yyvsp[(4) - (5)].integer));
  2542.   
  2543.   if((yyvsp[(5) - (5)].str)) {
  2544.     scc_parser_find_res(sccp,&(yyvsp[(5) - (5)].str));
  2545.     // then we need to add that to the roobj
  2546.     if(!sccp->do_deps && !scc_roobj_add_res(sccp->roobj,r,(yyvsp[(5) - (5)].str)))
  2547.       SCC_ABORT((yylsp[(3) - (5)]),"Failed to declare %s.\n",(yyvsp[(3) - (5)].str));
  2548.     if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(5) - (5)].str));
  2549.  
  2550.     if(!r->rid) scc_ns_get_rid(sccp->ns,r);
  2551.   }
  2552.   (yyval.integer) = (yyvsp[(1) - (5)].integer); // propagate type
  2553. ;}
  2554.     break;
  2555.  
  2556.   case 63:
  2557. #line 742 "/usr/tmp/scc_parse.y"
  2558.     {
  2559.   (yyval.str) = NULL;
  2560. ;}
  2561.     break;
  2562.  
  2563.   case 64:
  2564. #line 746 "/usr/tmp/scc_parse.y"
  2565.     {
  2566.   if((yyvsp[(1) - (2)].integer) != '=')
  2567.     SCC_ABORT((yylsp[(1) - (2)]),"Invalid operator for resource definition.\n");
  2568.   (yyval.str) = (yyvsp[(2) - (2)].str);
  2569. ;}
  2570.     break;
  2571.  
  2572.   case 67:
  2573. #line 761 "/usr/tmp/scc_parse.y"
  2574.     {
  2575.   if((yyvsp[(2) - (3)].integer) != '=')
  2576.     SCC_ABORT((yylsp[(2) - (3)]),"Invalid operator for parameter setting.\n");
  2577.  
  2578.   if(!scc_roobj_obj_set_param(sccp->obj,(yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].str)))
  2579.     SCC_ABORT((yylsp[(1) - (3)]),"Failed to set object parameter.\n");
  2580. ;}
  2581.     break;
  2582.  
  2583.   case 68:
  2584. #line 769 "/usr/tmp/scc_parse.y"
  2585.     {
  2586.   if((yyvsp[(2) - (3)].integer) != '=')
  2587.     SCC_ABORT((yylsp[(2) - (3)]),"Invalid operator for parameter setting.\n");
  2588.  
  2589.   if(!scc_roobj_obj_set_int_param(sccp->obj,(yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].integer)))
  2590.     SCC_ABORT((yylsp[(1) - (3)]),"Failed to set object parameter.\n");
  2591.  
  2592. ;}
  2593.     break;
  2594.  
  2595.   case 69:
  2596. #line 778 "/usr/tmp/scc_parse.y"
  2597.     {
  2598.   if((yyvsp[(2) - (5)].integer) != '=')
  2599.     SCC_ABORT((yylsp[(2) - (5)]),"Invalid operator for parameter setting.\n");
  2600.   // bitch on the keyword
  2601.   if(strcmp((yyvsp[(1) - (5)].str),"states"))
  2602.     SCC_ABORT((yylsp[(1) - (5)]),"Expected \"images\".\n");
  2603. ;}
  2604.     break;
  2605.  
  2606.   case 70:
  2607. #line 786 "/usr/tmp/scc_parse.y"
  2608.     {
  2609.   scc_symbol_t* sym;
  2610.  
  2611.   if((yyvsp[(2) - (3)].integer) != '=')
  2612.     SCC_ABORT((yylsp[(2) - (3)]),"Invalid operator for parameter setting.\n");
  2613.  
  2614.   if(!strcmp((yyvsp[(1) - (3)].str),"owner")) {
  2615.     sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(3) - (3)].str));
  2616.     if(!sym)
  2617.       SCC_ABORT((yylsp[(3) - (3)]),"%s is not a declared actor.\n",(yyvsp[(3) - (3)].str));
  2618.     if(sym->type != SCC_RES_ACTOR)
  2619.       SCC_ABORT((yylsp[(3) - (3)]),"%s is not an actor.\n",sym->sym);
  2620.   
  2621.     sccp->obj->owner = sym;
  2622.  
  2623.   } else if(!strcmp((yyvsp[(1) - (3)].str),"parent")) {
  2624.     sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(3) - (3)].str));
  2625.     if(!sym)
  2626.       SCC_ABORT((yylsp[(3) - (3)]),"%s is not a declared object.\n",(yyvsp[(3) - (3)].str));
  2627.     if(sym->type != SCC_RES_OBJ)
  2628.       SCC_ABORT((yylsp[(3) - (3)]),"%s is not an object.\n",sym->sym);
  2629.     if(sym->parent != sccp->roobj->sym)
  2630.       SCC_ABORT((yylsp[(3) - (3)]),"%s doesn't belong to room %s.\n",sym->sym,sccp->roobj->sym->sym);
  2631.  
  2632.     sccp->obj->parent = sym;
  2633.   } else
  2634.     SCC_ABORT((yylsp[(1) - (3)]),"Expected 'owner' or 'parent'.\n");
  2635.     
  2636. ;}
  2637.     break;
  2638.  
  2639.   case 71:
  2640. #line 816 "/usr/tmp/scc_parse.y"
  2641.     {
  2642.   if((yyvsp[(2) - (5)].integer) != '=')
  2643.     SCC_ABORT((yylsp[(2) - (5)]),"Invalid operator for parameter setting.\n");
  2644. ;}
  2645.     break;
  2646.  
  2647.   case 72:
  2648. #line 823 "/usr/tmp/scc_parse.y"
  2649.     {
  2650.   scc_symbol_t* sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(1) - (1)].str));
  2651.  
  2652.   if(!sym)
  2653.     SCC_ABORT((yylsp[(1) - (1)]),"%s is not a declared class.\n",(yyvsp[(1) - (1)].str));
  2654.  
  2655.   if(sym->type != SCC_RES_CLASS)
  2656.     SCC_ABORT((yylsp[(1) - (1)]),"%s is not a class in the current context.\n",(yyvsp[(1) - (1)].str));
  2657.  
  2658.   // allocate an rid
  2659.   if(!sym->rid) scc_ns_get_rid(sccp->ns,sym);
  2660.  
  2661.   if(!scc_roobj_obj_set_class(sccp->obj,sym))
  2662.     SCC_ABORT((yylsp[(1) - (1)]),"Failed to set object class.\n");
  2663.  
  2664. ;}
  2665.     break;
  2666.  
  2667.   case 73:
  2668. #line 840 "/usr/tmp/scc_parse.y"
  2669.     {
  2670.   scc_symbol_t* sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(3) - (3)].str));
  2671.  
  2672.   if(!sym)
  2673.     SCC_ABORT((yylsp[(3) - (3)]),"%s is not a declared class.\n",(yyvsp[(3) - (3)].str));
  2674.  
  2675.   if(sym->type != SCC_RES_CLASS)
  2676.     SCC_ABORT((yylsp[(3) - (3)]),"%s is not a class in the current context.\n",(yyvsp[(3) - (3)].str));
  2677.  
  2678.   // allocate an rid
  2679.   if(!sym->rid) scc_ns_get_rid(sccp->ns,sym);
  2680.  
  2681.   if(!scc_roobj_obj_set_class(sccp->obj,sym))
  2682.     SCC_ABORT((yylsp[(3) - (3)]),"Failed to set object class.\n");
  2683. ;}
  2684.     break;
  2685.  
  2686.   case 76:
  2687. #line 862 "/usr/tmp/scc_parse.y"
  2688.     {
  2689.   scc_parser_find_res(sccp,&(yyvsp[(6) - (7)].str));
  2690.   if(!scc_roobj_obj_add_state(sccp->obj,(yyvsp[(2) - (7)].integer),(yyvsp[(4) - (7)].integer),(yyvsp[(6) - (7)].str),NULL))
  2691.     SCC_ABORT((yylsp[(1) - (7)]),"Failed to add room state\n");
  2692.   if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(6) - (7)].str));
  2693. ;}
  2694.     break;
  2695.  
  2696.   case 77:
  2697. #line 869 "/usr/tmp/scc_parse.y"
  2698.     {
  2699.   scc_parser_find_res(sccp,&(yyvsp[(6) - (11)].str));
  2700.   if(!scc_roobj_obj_add_state(sccp->obj,(yyvsp[(2) - (11)].integer),(yyvsp[(4) - (11)].integer),(yyvsp[(6) - (11)].str),(yyvsp[(9) - (11)].strlist)))
  2701.     SCC_ABORT((yylsp[(2) - (11)]),"Failed to add room state.\n");
  2702.   if(sccp->do_deps) scc_parser_add_dep(sccp,(yyvsp[(6) - (11)].str));
  2703. ;}
  2704.     break;
  2705.  
  2706.   case 78:
  2707. #line 878 "/usr/tmp/scc_parse.y"
  2708.     {
  2709.   scc_parser_find_res(sccp,&(yyvsp[(1) - (1)].str));
  2710.   scc_parser_add_dep(sccp,(yyvsp[(1) - (1)].str));
  2711.   (yyval.strlist) = malloc(2*sizeof(char*));
  2712.   (yyval.strlist)[0] = (yyvsp[(1) - (1)].str);
  2713.   (yyval.strlist)[1] = NULL;
  2714. ;}
  2715.     break;
  2716.  
  2717.   case 79:
  2718. #line 886 "/usr/tmp/scc_parse.y"
  2719.     {
  2720.   int l;
  2721.   scc_parser_find_res(sccp,&(yyvsp[(3) - (3)].str));
  2722.   scc_parser_add_dep(sccp,(yyvsp[(3) - (3)].str));
  2723.   for(l = 0 ; (yyvsp[(1) - (3)].strlist)[l] ; l++);
  2724.   (yyval.strlist) = realloc((yyvsp[(1) - (3)].strlist),(l+2)*sizeof(char*));
  2725.   (yyval.strlist)[l] = (yyvsp[(3) - (3)].str);
  2726.   (yyval.strlist)[l+1] = NULL;
  2727. ;}
  2728.     break;
  2729.  
  2730.   case 80:
  2731. #line 898 "/usr/tmp/scc_parse.y"
  2732.     {
  2733. ;}
  2734.     break;
  2735.  
  2736.   case 81:
  2737. #line 901 "/usr/tmp/scc_parse.y"
  2738.     {
  2739.   scc_verb_script_t* v,*l;
  2740.   scc_script_t* scr;
  2741.  
  2742.   for(v = (yyvsp[(4) - (5)].vscr) ; v ; l = v, v = v->next,free(l) ) {
  2743.     if(!sccp->do_deps && v->inst)
  2744.       scr = scc_script_new(sccp->ns,v->inst,SCC_OP_VERB_RET,v->next ? 0 : 1);
  2745.     else
  2746.       scr = calloc(1,sizeof(scc_script_t));
  2747.     scr->sym = v->sym;
  2748.     if(!scc_roobj_obj_add_verb(sccp->obj,scr))
  2749.       SCC_ABORT((yylsp[(1) - (5)]),"Failed to add verb %s.\n",v->sym ? v->sym->sym : "default");
  2750.   }    
  2751.   scc_ns_clear(sccp->ns,SCC_RES_LVAR);
  2752.   scc_ns_pop(sccp->ns);
  2753. ;}
  2754.     break;
  2755.  
  2756.   case 82:
  2757. #line 920 "/usr/tmp/scc_parse.y"
  2758.     {
  2759.   scc_scr_arg_t* a = (yyvsp[(3) - (4)].arg);
  2760.   // push the obj for the local vars
  2761.   scc_ns_push(sccp->ns,sccp->obj->sym);
  2762.  
  2763.   // declare the arguments
  2764.   sccp->local_vars = 0;
  2765.   while(a) {
  2766.     scc_ns_decl(sccp->ns,NULL,a->sym,SCC_RES_LVAR,a->type,sccp->local_vars);
  2767.     sccp->local_vars++;
  2768.     a = a->next;
  2769.   }
  2770. ;}
  2771.     break;
  2772.  
  2773.   case 83:
  2774. #line 936 "/usr/tmp/scc_parse.y"
  2775.     {
  2776.   (yyval.vscr) = calloc(1,sizeof(scc_verb_script_t));
  2777.   (yyval.vscr)->sym = (yyvsp[(1) - (2)].sym);
  2778.   (yyval.vscr)->inst = (yyvsp[(2) - (2)].inst);
  2779. ;}
  2780.     break;
  2781.  
  2782.   case 84:
  2783. #line 943 "/usr/tmp/scc_parse.y"
  2784.     {
  2785.   (yyval.vscr) = (yyvsp[(1) - (3)].vscr);
  2786.   for(; (yyvsp[(1) - (3)].vscr) ; (yyvsp[(1) - (3)].vscr) = (yyvsp[(1) - (3)].vscr)->next) {
  2787.     if((yyvsp[(1) - (3)].vscr)->sym == (yyvsp[(2) - (3)].sym))
  2788.       SCC_ABORT((yylsp[(2) - (3)]),"Verb %s is already defined.\n",
  2789.                 (yyvsp[(2) - (3)].sym) ? (yyvsp[(2) - (3)].sym)->sym : "default");
  2790.     if(!(yyvsp[(1) - (3)].vscr)->next) break;
  2791.   }
  2792.   (yyvsp[(1) - (3)].vscr)->next = calloc(1,sizeof(scc_verb_script_t));
  2793.   (yyvsp[(1) - (3)].vscr) = (yyvsp[(1) - (3)].vscr)->next;
  2794.   (yyvsp[(1) - (3)].vscr)->sym = (yyvsp[(2) - (3)].sym);
  2795.   (yyvsp[(1) - (3)].vscr)->inst = (yyvsp[(3) - (3)].inst);
  2796. ;}
  2797.     break;
  2798.  
  2799.   case 85:
  2800. #line 959 "/usr/tmp/scc_parse.y"
  2801.     {
  2802.   (yyval.inst) = NULL;
  2803. ;}
  2804.     break;
  2805.  
  2806.   case 87:
  2807. #line 966 "/usr/tmp/scc_parse.y"
  2808.     {
  2809.   scc_symbol_t* sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(2) - (3)].str));
  2810.   if(!sym)
  2811.     SCC_ABORT((yylsp[(1) - (3)]),"%s is not a declared verb.\n",(yyvsp[(2) - (3)].str));
  2812.   
  2813.   if(sym->type != SCC_RES_VERB)
  2814.     SCC_ABORT((yylsp[(1) - (3)]),"%s is not a verb in the current context.\n",(yyvsp[(2) - (3)].str));
  2815.  
  2816.   // allocate an rid
  2817.   if(!sym->rid) scc_ns_get_rid(sccp->ns,sym);
  2818.  
  2819.   (yyval.sym) = sym;
  2820. ;}
  2821.     break;
  2822.  
  2823.   case 88:
  2824. #line 980 "/usr/tmp/scc_parse.y"
  2825.     {
  2826.   (yyval.sym) = NULL;
  2827. ;}
  2828.     break;
  2829.  
  2830.   case 89:
  2831. #line 988 "/usr/tmp/scc_parse.y"
  2832.     {
  2833.   (yyval.integer) = SCC_RES_SCR;
  2834. ;}
  2835.     break;
  2836.  
  2837.   case 90:
  2838. #line 992 "/usr/tmp/scc_parse.y"
  2839.     {
  2840.   (yyval.integer) = (yyvsp[(1) - (1)].integer);
  2841. ;}
  2842.     break;
  2843.  
  2844.   case 91:
  2845. #line 998 "/usr/tmp/scc_parse.y"
  2846.     {
  2847.   (yyval.arg) = NULL;
  2848. ;}
  2849.     break;
  2850.  
  2851.   case 92:
  2852. #line 1002 "/usr/tmp/scc_parse.y"
  2853.     {
  2854.   //if($1 == SCC_VAR_BIT)
  2855.   //  SCC_ABORT(@1,"Script argument can't be of bit type.\n");
  2856.  
  2857.   (yyval.arg) = malloc(sizeof(scc_scr_arg_t));
  2858.   (yyval.arg)->next = NULL;
  2859.   (yyval.arg)->type = (yyvsp[(1) - (3)].integer) | (yyvsp[(2) - (3)].integer);
  2860.   (yyval.arg)->sym = (yyvsp[(3) - (3)].str);
  2861. ;}
  2862.     break;
  2863.  
  2864.   case 93:
  2865. #line 1012 "/usr/tmp/scc_parse.y"
  2866.     {
  2867.   scc_scr_arg_t *i,*a = malloc(sizeof(scc_scr_arg_t));
  2868.   a->next = NULL;
  2869.   a->type = (yyvsp[(3) - (5)].integer) | (yyvsp[(4) - (5)].integer);
  2870.   a->sym = (yyvsp[(5) - (5)].str);
  2871.  
  2872.   for(i = (yyvsp[(1) - (5)].arg) ; i->next ; i = i->next);
  2873.   i->next = a;
  2874.   (yyval.arg) = (yyvsp[(1) - (5)].arg);
  2875. ;}
  2876.     break;
  2877.  
  2878.   case 94:
  2879. #line 1025 "/usr/tmp/scc_parse.y"
  2880.     {
  2881.   (yyval.integer) = -1;
  2882. ;}
  2883.     break;
  2884.  
  2885.   case 95:
  2886. #line 1029 "/usr/tmp/scc_parse.y"
  2887.     {
  2888.   (yyval.integer) = (yyvsp[(2) - (2)].integer);
  2889. ;}
  2890.     break;
  2891.  
  2892.   case 96:
  2893. #line 1035 "/usr/tmp/scc_parse.y"
  2894.     {
  2895.   (yyval.scr) = NULL;
  2896. ;}
  2897.     break;
  2898.  
  2899.   case 97:
  2900. #line 1040 "/usr/tmp/scc_parse.y"
  2901.     {
  2902.   if(sccp->do_deps)
  2903.     (yyval.scr) = NULL;
  2904.   else {
  2905.     (yyval.scr) = scc_script_new(sccp->ns,(yyvsp[(2) - (2)].inst),SCC_OP_SCR_RET,1);
  2906.     if(!(yyval.scr))
  2907.       SCC_ABORT((yylsp[(1) - (2)]),"Code generation failed.\n");
  2908.   }
  2909. ;}
  2910.     break;
  2911.  
  2912.   case 100:
  2913. #line 1058 "/usr/tmp/scc_parse.y"
  2914.     {
  2915. ;}
  2916.     break;
  2917.  
  2918.   case 102:
  2919. #line 1065 "/usr/tmp/scc_parse.y"
  2920.     {
  2921.   //if($1 == SCC_VAR_BIT)
  2922.   //  SCC_ABORT(@1,"Local bit variable are not possible.\n");
  2923.  
  2924.   (yyval.sym) = scc_ns_decl(sccp->ns,NULL,(yyvsp[(3) - (3)].str),SCC_RES_LVAR,(yyvsp[(1) - (3)].integer) | (yyvsp[(2) - (3)].integer),sccp->local_vars);
  2925.   if(!(yyval.sym)) SCC_ABORT((yylsp[(1) - (3)]),"Declaration failed.\n");
  2926.   sccp->local_vars++;
  2927. ;}
  2928.     break;
  2929.  
  2930.   case 103:
  2931. #line 1075 "/usr/tmp/scc_parse.y"
  2932.     {
  2933.   (yyval.sym) = scc_ns_decl(sccp->ns,NULL,(yyvsp[(4) - (4)].str),SCC_RES_LVAR,(yyvsp[(1) - (4)].sym)->subtype | (yyvsp[(3) - (4)].integer),sccp->local_vars);
  2934.   if(!(yyval.sym)) SCC_ABORT((yylsp[(4) - (4)]),"Declaration failed.\n");
  2935.   sccp->local_vars++;
  2936.   (yyval.sym) = (yyvsp[(1) - (4)].sym);
  2937. ;}
  2938.     break;
  2939.  
  2940.   case 104:
  2941. #line 1083 "/usr/tmp/scc_parse.y"
  2942.     {
  2943.   (yyval.inst) = (yyvsp[(1) - (1)].inst);
  2944. ;}
  2945.     break;
  2946.  
  2947.   case 105:
  2948. #line 1088 "/usr/tmp/scc_parse.y"
  2949.     {
  2950.   (yyval.inst) = (yyvsp[(2) - (3)].inst);
  2951. ;}
  2952.     break;
  2953.  
  2954.   case 106:
  2955. #line 1094 "/usr/tmp/scc_parse.y"
  2956.     {
  2957.   (yyval.inst) = (yyvsp[(1) - (1)].inst);
  2958. ;}
  2959.     break;
  2960.  
  2961.   case 107:
  2962. #line 1099 "/usr/tmp/scc_parse.y"
  2963.     {
  2964.   scc_instruct_t* i;
  2965.   for(i = (yyvsp[(1) - (2)].inst) ; i->next ; i = i->next);
  2966.   i->next = (yyvsp[(2) - (2)].inst);
  2967. ;}
  2968.     break;
  2969.  
  2970.   case 110:
  2971. #line 1111 "/usr/tmp/scc_parse.y"
  2972.     {
  2973.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  2974.   (yyval.inst)->type = SCC_INST_ST;
  2975.   (yyval.inst)->pre = (yyvsp[(1) - (1)].st);
  2976. ;}
  2977.     break;
  2978.  
  2979.   case 111:
  2980. #line 1118 "/usr/tmp/scc_parse.y"
  2981.     {
  2982.   scc_loop_t* l = scc_loop_get((yyvsp[(1) - (1)].integer),NULL);
  2983.   if(!l)
  2984.     SCC_ABORT((yylsp[(1) - (1)]),"Invalid branch instruction.\n");
  2985.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  2986.   (yyval.inst)->type = SCC_INST_BRANCH;
  2987.   (yyval.inst)->subtype = (yyvsp[(1) - (1)].integer);
  2988. ;}
  2989.     break;
  2990.  
  2991.   case 112:
  2992. #line 1128 "/usr/tmp/scc_parse.y"
  2993.     {
  2994.   scc_loop_t* l = scc_loop_get((yyvsp[(1) - (2)].integer),(yyvsp[(2) - (2)].str));
  2995.   if(!l)
  2996.     SCC_ABORT((yylsp[(1) - (2)]),"Invalid branch instruction.\n");
  2997.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  2998.   (yyval.inst)->type = SCC_INST_BRANCH;
  2999.   (yyval.inst)->subtype = (yyvsp[(1) - (2)].integer);
  3000.   (yyval.inst)->sym = (yyvsp[(2) - (2)].str);
  3001. ;}
  3002.     break;
  3003.  
  3004.   case 113:
  3005. #line 1139 "/usr/tmp/scc_parse.y"
  3006.     {
  3007.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3008.   (yyval.inst)->type = SCC_INST_BRANCH;
  3009.   (yyval.inst)->subtype = (yyvsp[(1) - (1)].integer);
  3010. ;}
  3011.     break;
  3012.  
  3013.   case 114:
  3014. #line 1146 "/usr/tmp/scc_parse.y"
  3015.     {
  3016.   if((yyvsp[(1) - (2)].integer) != SCC_BRANCH_RETURN) {
  3017.     scc_loop_t* l = scc_loop_get((yyvsp[(1) - (2)].integer),NULL);
  3018.     if(!l)
  3019.       SCC_ABORT((yylsp[(1) - (2)]),"Invalid branch instruction.\n");
  3020.   }
  3021.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3022.   (yyval.inst)->type = SCC_INST_BRANCH;
  3023.   (yyval.inst)->subtype = (yyvsp[(1) - (2)].integer);
  3024.   (yyval.inst)->pre = (yyvsp[(2) - (2)].st);
  3025. ;}
  3026.     break;
  3027.  
  3028.   case 115:
  3029. #line 1161 "/usr/tmp/scc_parse.y"
  3030.     {
  3031.   (yyval.inst) = (yyvsp[(1) - (1)].inst);
  3032. ;}
  3033.     break;
  3034.  
  3035.   case 116:
  3036. #line 1166 "/usr/tmp/scc_parse.y"
  3037.     {
  3038.   (yyval.inst) = (yyvsp[(2) - (3)].inst);
  3039. ;}
  3040.     break;
  3041.  
  3042.   case 117:
  3043. #line 1172 "/usr/tmp/scc_parse.y"
  3044.     {
  3045.   (yyval.inst) = (yyvsp[(1) - (1)].inst);
  3046. ;}
  3047.     break;
  3048.  
  3049.   case 119:
  3050. #line 1178 "/usr/tmp/scc_parse.y"
  3051.     {
  3052.   (yyval.inst) = (yyvsp[(1) - (1)].inst);
  3053. ;}
  3054.     break;
  3055.  
  3056.   case 120:
  3057. #line 1184 "/usr/tmp/scc_parse.y"
  3058.     {
  3059.   (yyval.inst) = (yyvsp[(1) - (2)].inst);
  3060.   (yyval.inst)->body = (yyvsp[(2) - (2)].inst);
  3061.   free(scc_loop_pop());
  3062. ;}
  3063.     break;
  3064.  
  3065.   case 121:
  3066. #line 1190 "/usr/tmp/scc_parse.y"
  3067.     {
  3068.   (yyval.inst) = (yyvsp[(1) - (7)].inst);
  3069.   (yyval.inst)->subtype = (yyvsp[(3) - (7)].integer);
  3070.   (yyval.inst)->cond = (yyvsp[(5) - (7)].st);
  3071.   (yyval.inst)->body = (yyvsp[(2) - (7)].inst);
  3072.   free(scc_loop_pop());
  3073. ;}
  3074.     break;
  3075.  
  3076.   case 122:
  3077. #line 1198 "/usr/tmp/scc_parse.y"
  3078.     {
  3079.   (yyval.inst) = (yyvsp[(1) - (4)].inst);
  3080.   (yyval.inst)->body = (yyvsp[(3) - (4)].inst);
  3081.   free(scc_loop_pop());
  3082. ;}
  3083.     break;
  3084.  
  3085.   case 123:
  3086. #line 1207 "/usr/tmp/scc_parse.y"
  3087.     {
  3088.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3089.   (yyval.inst)->type = SCC_INST_FOR;
  3090.   (yyval.inst)->sym = (yyvsp[(1) - (9)].str);
  3091.   (yyval.inst)->pre = (yyvsp[(4) - (9)].st);
  3092.   (yyval.inst)->cond = (yyvsp[(6) - (9)].st);
  3093.   (yyval.inst)->post = (yyvsp[(8) - (9)].st);
  3094.   scc_loop_push((yyval.inst)->type,(yyval.inst)->sym);
  3095. ;}
  3096.     break;
  3097.  
  3098.   case 124:
  3099. #line 1218 "/usr/tmp/scc_parse.y"
  3100.     {
  3101.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3102.   (yyval.inst)->type = SCC_INST_WHILE;
  3103.   (yyval.inst)->sym = (yyvsp[(1) - (5)].str);
  3104.   (yyval.inst)->subtype = (yyvsp[(2) - (5)].integer);
  3105.   (yyval.inst)->cond = (yyvsp[(4) - (5)].st);
  3106.   scc_loop_push((yyval.inst)->type,(yyval.inst)->sym);
  3107. ;}
  3108.     break;
  3109.  
  3110.   case 125:
  3111. #line 1229 "/usr/tmp/scc_parse.y"
  3112.     {
  3113.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3114.   (yyval.inst)->type = SCC_INST_DO;
  3115.   (yyval.inst)->sym = (yyvsp[(1) - (2)].str);
  3116.   scc_loop_push((yyval.inst)->type,(yyval.inst)->sym);
  3117. ;}
  3118.     break;
  3119.  
  3120.   case 126:
  3121. #line 1238 "/usr/tmp/scc_parse.y"
  3122.     {
  3123.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3124.   (yyval.inst)->type = SCC_INST_SWITCH;
  3125.   (yyval.inst)->sym = (yyvsp[(1) - (5)].str);
  3126.   (yyval.inst)->cond = (yyvsp[(4) - (5)].st);
  3127.   scc_loop_push((yyval.inst)->type,(yyval.inst)->sym);
  3128. ;}
  3129.     break;
  3130.  
  3131.   case 127:
  3132. #line 1248 "/usr/tmp/scc_parse.y"
  3133.     {
  3134.   (yyval.str) = NULL;
  3135. ;}
  3136.     break;
  3137.  
  3138.   case 128:
  3139. #line 1252 "/usr/tmp/scc_parse.y"
  3140.     {
  3141.   (yyval.str) = (yyvsp[(1) - (2)].str);
  3142. ;}
  3143.     break;
  3144.  
  3145.   case 129:
  3146. #line 1258 "/usr/tmp/scc_parse.y"
  3147.     {
  3148.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3149.   (yyval.inst)->type = SCC_INST_CUTSCENE;
  3150.   (yyval.inst)->cond = (yyvsp[(3) - (5)].st);
  3151.   (yyval.inst)->body = (yyvsp[(5) - (5)].inst);
  3152. ;}
  3153.     break;
  3154.  
  3155.   case 130:
  3156. #line 1266 "/usr/tmp/scc_parse.y"
  3157.     {
  3158.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3159.   (yyval.inst)->type = SCC_INST_OVERRIDE;
  3160.   (yyval.inst)->body = (yyvsp[(2) - (2)].inst);
  3161. ;}
  3162.     break;
  3163.  
  3164.   case 131:
  3165. #line 1273 "/usr/tmp/scc_parse.y"
  3166.     {
  3167.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3168.   (yyval.inst)->type = SCC_INST_OVERRIDE;
  3169.   (yyval.inst)->body = (yyvsp[(2) - (4)].inst);
  3170.   (yyval.inst)->body2 = (yyvsp[(4) - (4)].inst);
  3171. ;}
  3172.     break;
  3173.  
  3174.   case 132:
  3175. #line 1282 "/usr/tmp/scc_parse.y"
  3176.     {
  3177.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3178.   (yyval.inst)->type = SCC_INST_CASE;
  3179.   (yyval.inst)->cond = (yyvsp[(1) - (2)].st);
  3180.   (yyval.inst)->body = (yyvsp[(2) - (2)].inst); 
  3181. ;}
  3182.     break;
  3183.  
  3184.   case 133:
  3185. #line 1290 "/usr/tmp/scc_parse.y"
  3186.     {
  3187.   scc_instruct_t *n,*i;
  3188.  
  3189.   for(i = (yyvsp[(1) - (3)].inst) ; i->next ; i = i->next);
  3190.   if(!i->cond)
  3191.     SCC_ABORT((yylsp[(2) - (3)]),"Case statements can't be added after a default.\n");
  3192.  
  3193.   n = calloc(1,sizeof(scc_instruct_t));
  3194.   n->type = SCC_INST_CASE;
  3195.   n->cond = (yyvsp[(2) - (3)].st);
  3196.   n->body = (yyvsp[(3) - (3)].inst);
  3197.  
  3198.   i->next = n;
  3199.   
  3200.   (yyval.inst) = (yyvsp[(1) - (3)].inst);
  3201. ;}
  3202.     break;
  3203.  
  3204.   case 134:
  3205. #line 1309 "/usr/tmp/scc_parse.y"
  3206.     {
  3207.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3208. ;}
  3209.     break;
  3210.  
  3211.   case 135:
  3212. #line 1314 "/usr/tmp/scc_parse.y"
  3213.     {
  3214.   (yyval.st) = NULL;
  3215. ;}
  3216.     break;
  3217.  
  3218.   case 136:
  3219. #line 1319 "/usr/tmp/scc_parse.y"
  3220.     {
  3221.   (yyval.st) = (yyvsp[(2) - (3)].st);
  3222. ;}
  3223.     break;
  3224.  
  3225.   case 137:
  3226. #line 1324 "/usr/tmp/scc_parse.y"
  3227.     {
  3228.   scc_statement_t* a;
  3229.   for(a = (yyvsp[(1) - (4)].st) ; a->next ; a = a->next);
  3230.   a->next = (yyvsp[(3) - (4)].st);
  3231.   (yyval.st) = (yyvsp[(1) - (4)].st);
  3232. ;}
  3233.     break;
  3234.  
  3235.   case 138:
  3236. #line 1333 "/usr/tmp/scc_parse.y"
  3237.     {
  3238.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3239.   (yyval.inst)->type = SCC_INST_IF;
  3240.   (yyval.inst)->subtype = (yyvsp[(1) - (5)].integer);
  3241.   (yyval.inst)->cond = (yyvsp[(3) - (5)].st);
  3242.   (yyval.inst)->body = (yyvsp[(5) - (5)].inst);
  3243. ;}
  3244.     break;
  3245.  
  3246.   case 139:
  3247. #line 1342 "/usr/tmp/scc_parse.y"
  3248.     {
  3249.   (yyval.inst) = calloc(1,sizeof(scc_instruct_t));
  3250.   (yyval.inst)->type = SCC_INST_IF;
  3251.   (yyval.inst)->subtype = (yyvsp[(1) - (7)].integer);
  3252.   (yyval.inst)->cond = (yyvsp[(3) - (7)].st);
  3253.   (yyval.inst)->body = (yyvsp[(5) - (7)].inst);
  3254.   (yyval.inst)->body2 = (yyvsp[(7) - (7)].inst);
  3255. ;}
  3256.     break;
  3257.  
  3258.   case 140:
  3259. #line 1354 "/usr/tmp/scc_parse.y"
  3260.     {
  3261.   // single statement stay as-is
  3262.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3263. ;}
  3264.     break;
  3265.  
  3266.   case 141:
  3267. #line 1359 "/usr/tmp/scc_parse.y"
  3268.     {
  3269.   scc_statement_t* i;
  3270.  
  3271.   // no chain yet, create it
  3272.   if((yyvsp[(1) - (3)].st)->type != SCC_ST_CHAIN) {
  3273.     (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3274.     (yyval.st)->type = SCC_ST_CHAIN;
  3275.     // init the chain
  3276.     (yyval.st)->val.l = (yyvsp[(1) - (3)].st);
  3277.   } else
  3278.     (yyval.st) = (yyvsp[(1) - (3)].st);
  3279.  
  3280.   // append the new element
  3281.   for(i = (yyval.st)->val.l ; i->next ; i = i->next);
  3282.   i->next = (yyvsp[(3) - (3)].st);
  3283. ;}
  3284.     break;
  3285.  
  3286.   case 142:
  3287. #line 1379 "/usr/tmp/scc_parse.y"
  3288.     {
  3289.   (yyval.st) = NULL;
  3290. ;}
  3291.     break;
  3292.  
  3293.   case 143:
  3294. #line 1383 "/usr/tmp/scc_parse.y"
  3295.     {
  3296.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3297. ;}
  3298.     break;
  3299.  
  3300.   case 144:
  3301. #line 1389 "/usr/tmp/scc_parse.y"
  3302.     {
  3303.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3304. ;}
  3305.     break;
  3306.  
  3307.   case 145:
  3308. #line 1394 "/usr/tmp/scc_parse.y"
  3309.     {
  3310.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3311. ;}
  3312.     break;
  3313.  
  3314.   case 146:
  3315. #line 1399 "/usr/tmp/scc_parse.y"
  3316.     {
  3317.   scc_symbol_t* v;
  3318.  
  3319.   if((yyvsp[(1) - (4)].st)->type != SCC_ST_VAR)
  3320.     SCC_ABORT((yylsp[(1) - (4)]),"%s is not a variable, so it can't be subscripted.\n",
  3321.           (yyvsp[(1) - (4)].st)->val.r->sym);
  3322.   v = (yyvsp[(1) - (4)].st)->val.v.r;
  3323.   if(!(v->subtype & SCC_VAR_ARRAY))
  3324.     SCC_ABORT((yylsp[(1) - (4)]),"%s is not an array variable, so it can't be subscripted.\n",v->sym);
  3325.   (yyval.st) = (yyvsp[(1) - (4)].st);
  3326.   (yyval.st)->val.v.y = (yyvsp[(3) - (4)].st);
  3327. ;}
  3328.     break;
  3329.  
  3330.   case 147:
  3331. #line 1413 "/usr/tmp/scc_parse.y"
  3332.     {
  3333.   scc_symbol_t* v;
  3334.  
  3335.   if((yyvsp[(1) - (6)].st)->type != SCC_ST_VAR)
  3336.     SCC_ABORT((yylsp[(1) - (6)]),"%s is not a variable, so it can't be subscripted.\n",
  3337.           (yyvsp[(1) - (6)].st)->val.r->sym);
  3338.   v = (yyvsp[(1) - (6)].st)->val.v.r;
  3339.   if(!(v->subtype & SCC_VAR_ARRAY))
  3340.     SCC_ABORT((yylsp[(1) - (6)]),"%s is not an array variable, so it can't be subscripted.\n",v->sym);
  3341.   (yyval.st) = (yyvsp[(1) - (6)].st);
  3342.   (yyval.st)->val.v.x = (yyvsp[(3) - (6)].st);
  3343.   (yyval.st)->val.v.y = (yyvsp[(5) - (6)].st);
  3344. ;}
  3345.     break;
  3346.  
  3347.   case 148:
  3348. #line 1428 "/usr/tmp/scc_parse.y"
  3349.     {
  3350.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3351. ;}
  3352.     break;
  3353.  
  3354.   case 149:
  3355. #line 1433 "/usr/tmp/scc_parse.y"
  3356.     {
  3357.   scc_statement_t* a;
  3358.   
  3359.   for(a = (yyvsp[(2) - (3)].st) ; a ; a = a->next) {
  3360.     if(a->type == SCC_ST_STR ||
  3361.        a->type == SCC_ST_LIST)
  3362.       SCC_ABORT((yylsp[(2) - (3)]),"Strings and lists can't be used inside a list.\n");
  3363.   }
  3364.  
  3365.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3366.   (yyval.st)->type = SCC_ST_LIST;
  3367.   (yyval.st)->val.l = (yyvsp[(2) - (3)].st);
  3368. ;}
  3369.     break;
  3370.  
  3371.   case 150:
  3372. #line 1448 "/usr/tmp/scc_parse.y"
  3373.     {
  3374.   if((yyvsp[(1) - (3)].st)->type != SCC_ST_VAR)
  3375.     SCC_ABORT((yylsp[(1) - (3)]),"rvalue is not a variable, so it can't be assigned.\n");
  3376.  
  3377.   if(!((yyvsp[(1) - (3)].st)->val.v.r->subtype & SCC_VAR_ARRAY) &&
  3378.      ((yyvsp[(3) - (3)].st)->type == SCC_ST_STR ||
  3379.       (yyvsp[(3) - (3)].st)->type == SCC_ST_LIST))
  3380.       SCC_ABORT((yylsp[(1) - (3)]),"list and strings can only be assigned to "
  3381.                 "array variables.\n");
  3382.  
  3383.   if((yyvsp[(1) - (3)].st)->val.v.x && (yyvsp[(3) - (3)].st)->type == SCC_ST_STR)
  3384.     SCC_ABORT((yylsp[(1) - (3)]),"Strings can't be assigned to 2-dim arrays.\n");
  3385.  
  3386.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3387.   (yyval.st)->type = SCC_ST_OP;
  3388.   (yyval.st)->val.o.type = SCC_OT_ASSIGN;
  3389.   (yyval.st)->val.o.op = (yyvsp[(2) - (3)].integer);
  3390.   (yyval.st)->val.o.argc = 2;
  3391.   (yyval.st)->val.o.argv = (yyvsp[(1) - (3)].st);
  3392.   (yyvsp[(1) - (3)].st)->next = (yyvsp[(3) - (3)].st);
  3393. ;}
  3394.     break;
  3395.  
  3396.   case 151:
  3397. #line 1471 "/usr/tmp/scc_parse.y"
  3398.     {
  3399.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3400.   (yyval.st)->type = SCC_ST_OP;
  3401.   (yyval.st)->val.o.type = SCC_OT_TERNARY;
  3402.   (yyval.st)->val.o.op = (yyvsp[(2) - (5)].integer);
  3403.   (yyval.st)->val.o.argc = 3;
  3404.   (yyval.st)->val.o.argv = (yyvsp[(1) - (5)].st);
  3405.   (yyvsp[(1) - (5)].st)->next = (yyvsp[(3) - (5)].st);
  3406.   (yyvsp[(3) - (5)].st)->next = (yyvsp[(5) - (5)].st);
  3407. ;}
  3408.     break;
  3409.  
  3410.   case 152:
  3411. #line 1483 "/usr/tmp/scc_parse.y"
  3412.     {
  3413.   SCC_BOP((yyval.st),||,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3414. ;}
  3415.     break;
  3416.  
  3417.   case 153:
  3418. #line 1488 "/usr/tmp/scc_parse.y"
  3419.     {
  3420.   SCC_BOP((yyval.st),&&,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3421. ;}
  3422.     break;
  3423.  
  3424.   case 154:
  3425. #line 1493 "/usr/tmp/scc_parse.y"
  3426.     {
  3427.   scc_func_t* f;
  3428.   scc_statement_t *a,*list;
  3429.   char* err;
  3430.   
  3431.   f = scc_get_func(sccp,"isObjectOfClass");
  3432.   if(!f)
  3433.     SCC_ABORT((yylsp[(1) - (3)]),"Internal error: isObjectOfClass not found.\n");
  3434.   
  3435.   // create the arguments
  3436.   list = calloc(1,sizeof(scc_statement_t));
  3437.   list->type = SCC_ST_LIST;
  3438.   list->val.l = (yyvsp[(3) - (3)].st);
  3439.   
  3440.   (yyvsp[(1) - (3)].st)->next = list;
  3441.   
  3442.   // create the call
  3443.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3444.   (yyval.st)->type = SCC_ST_CALL;
  3445.   
  3446.   (yyval.st)->val.c.func = f;
  3447.   (yyval.st)->val.c.argv = (yyvsp[(1) - (3)].st);
  3448.   
  3449.   for(a = (yyvsp[(1) - (3)].st) ; a ; a = a->next)
  3450.     (yyval.st)->val.c.argc++;
  3451.   
  3452.   err = scc_statement_check_func(&(yyval.st)->val.c);
  3453.   if(err)
  3454.     SCC_ABORT((yylsp[(1) - (3)]),"%s",err);
  3455. ;}
  3456.     break;
  3457.  
  3458.   case 155:
  3459. #line 1525 "/usr/tmp/scc_parse.y"
  3460.     {
  3461.   SCC_BOP((yyval.st),|,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3462. ;}
  3463.     break;
  3464.  
  3465.   case 156:
  3466. #line 1530 "/usr/tmp/scc_parse.y"
  3467.     {
  3468.   SCC_BOP((yyval.st),&,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3469. ;}
  3470.     break;
  3471.  
  3472.   case 157:
  3473. #line 1535 "/usr/tmp/scc_parse.y"
  3474.     {
  3475.   SCC_BOP((yyval.st),!=,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3476. ;}
  3477.     break;
  3478.  
  3479.   case 158:
  3480. #line 1540 "/usr/tmp/scc_parse.y"
  3481.     {
  3482.   SCC_BOP((yyval.st),==,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3483. ;}
  3484.     break;
  3485.  
  3486.   case 159:
  3487. #line 1545 "/usr/tmp/scc_parse.y"
  3488.     {
  3489.   SCC_BOP((yyval.st),>=,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3490. ;}
  3491.     break;
  3492.  
  3493.   case 160:
  3494. #line 1550 "/usr/tmp/scc_parse.y"
  3495.     {
  3496.   SCC_BOP((yyval.st),>,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3497. ;}
  3498.     break;
  3499.  
  3500.   case 161:
  3501. #line 1555 "/usr/tmp/scc_parse.y"
  3502.     {
  3503.   SCC_BOP((yyval.st),<=,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3504. ;}
  3505.     break;
  3506.  
  3507.   case 162:
  3508. #line 1560 "/usr/tmp/scc_parse.y"
  3509.     {
  3510.   SCC_BOP((yyval.st),<,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3511. ;}
  3512.     break;
  3513.  
  3514.   case 163:
  3515. #line 1565 "/usr/tmp/scc_parse.y"
  3516.     {
  3517.   SCC_BOP((yyval.st),-,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3518. ;}
  3519.     break;
  3520.  
  3521.   case 164:
  3522. #line 1570 "/usr/tmp/scc_parse.y"
  3523.     {
  3524.   SCC_BOP((yyval.st),+,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3525. ;}
  3526.     break;
  3527.  
  3528.   case 165:
  3529. #line 1575 "/usr/tmp/scc_parse.y"
  3530.     {
  3531.   SCC_BOP((yyval.st),/,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3532. ;}
  3533.     break;
  3534.  
  3535.   case 166:
  3536. #line 1580 "/usr/tmp/scc_parse.y"
  3537.     {
  3538.   SCC_BOP((yyval.st),*,(yyvsp[(1) - (3)].st),(yyvsp[(2) - (3)].integer),(yyvsp[(3) - (3)].st));
  3539. ;}
  3540.     break;
  3541.  
  3542.   case 167:
  3543. #line 1585 "/usr/tmp/scc_parse.y"
  3544.     {
  3545.    if((yyvsp[(2) - (2)].st)->type == SCC_ST_VAL) {
  3546.     (yyvsp[(2) - (2)].st)->val.i = -(yyvsp[(2) - (2)].st)->val.i;
  3547.     (yyval.st) = (yyvsp[(2) - (2)].st);
  3548.   } else { 
  3549.     (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3550.     (yyval.st)->type = SCC_ST_OP;
  3551.     (yyval.st)->val.o.type = SCC_OT_UNARY;
  3552.     (yyval.st)->val.o.op = (yyvsp[(1) - (2)].integer);
  3553.     (yyval.st)->val.o.argc = 1;
  3554.     (yyval.st)->val.o.argv = (yyvsp[(2) - (2)].st);
  3555.   }
  3556. ;}
  3557.     break;
  3558.  
  3559.   case 168:
  3560. #line 1600 "/usr/tmp/scc_parse.y"
  3561.     {
  3562.   if((yyvsp[(2) - (2)].st)->type == SCC_ST_VAL) {
  3563.     (yyvsp[(2) - (2)].st)->val.i = ! (yyvsp[(2) - (2)].st)->val.i;
  3564.     (yyval.st) = (yyvsp[(2) - (2)].st);
  3565.   } else { // we call not
  3566.     (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3567.     (yyval.st)->type = SCC_ST_OP;
  3568.     (yyval.st)->val.o.type = SCC_OT_UNARY;
  3569.     (yyval.st)->val.o.op = (yyvsp[(1) - (2)].integer);
  3570.     (yyval.st)->val.o.argc = 1;
  3571.     (yyval.st)->val.o.argv = (yyvsp[(2) - (2)].st);
  3572.   }
  3573. ;}
  3574.     break;
  3575.  
  3576.   case 169:
  3577. #line 1615 "/usr/tmp/scc_parse.y"
  3578.     {
  3579.   if((yyvsp[(2) - (2)].st)->type != SCC_ST_VAR)
  3580.     SCC_ABORT((yylsp[(1) - (2)]),"Suffix operators can only be used on variables.\n");
  3581.  
  3582.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3583.   (yyval.st)->type = SCC_ST_OP;
  3584.   (yyval.st)->val.o.type = SCC_OT_UNARY;
  3585.   (yyval.st)->val.o.op = ((yyvsp[(1) - (2)].integer) == INC ? PREINC : PREDEC);
  3586.   (yyval.st)->val.o.argc = 1;
  3587.   (yyval.st)->val.o.argv = (yyvsp[(2) - (2)].st);
  3588. ;}
  3589.     break;
  3590.  
  3591.   case 170:
  3592. #line 1628 "/usr/tmp/scc_parse.y"
  3593.     {
  3594.   if((yyvsp[(1) - (2)].st)->type != SCC_ST_VAR)
  3595.     SCC_ABORT((yylsp[(1) - (2)]),"Suffix operators can only be used on variables.\n");
  3596.  
  3597.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3598.   (yyval.st)->type = SCC_ST_OP;
  3599.   (yyval.st)->val.o.type = SCC_OT_UNARY;
  3600.   (yyval.st)->val.o.op = ((yyvsp[(2) - (2)].integer) == INC) ? POSTINC : POSTDEC;
  3601.   (yyval.st)->val.o.argc = 1;
  3602.   (yyval.st)->val.o.argv = (yyvsp[(1) - (2)].st);
  3603. ;}
  3604.     break;
  3605.  
  3606.   case 171:
  3607. #line 1641 "/usr/tmp/scc_parse.y"
  3608.     {
  3609.   (yyval.st) = (yyvsp[(2) - (3)].st);
  3610. ;}
  3611.     break;
  3612.  
  3613.   case 172:
  3614. #line 1647 "/usr/tmp/scc_parse.y"
  3615.     {
  3616.   scc_symbol_t* v = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(1) - (1)].str));
  3617.  
  3618.   if(sccp->do_deps && !v)
  3619.     v = scc_ns_decl(sccp->ns,NULL,(yyvsp[(1) - (1)].str),SCC_RES_VAR,SCC_VAR_WORD,-1);
  3620.  
  3621.   if(!v)
  3622.     SCC_ABORT((yylsp[(1) - (1)]),"%s is not a declared resource.\n",(yyvsp[(1) - (1)].str));
  3623.  
  3624.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3625.   if(scc_sym_is_var(v->type)) {
  3626.     (yyval.st)->type = SCC_ST_VAR;
  3627.     (yyval.st)->val.v.r = v;
  3628.   } else {
  3629.     (yyval.st)->type = SCC_ST_RES;
  3630.     (yyval.st)->val.r = v;
  3631.   }
  3632.   // allocate rid
  3633.   if(!v->rid) scc_ns_get_rid(sccp->ns,v);
  3634. ;}
  3635.     break;
  3636.  
  3637.   case 173:
  3638. #line 1668 "/usr/tmp/scc_parse.y"
  3639.     {
  3640.   scc_symbol_t* v = scc_ns_get_sym(sccp->ns,(yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].str));
  3641.  
  3642.   if(sccp->do_deps && !v)
  3643.     v = scc_ns_decl(sccp->ns,(yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].str),SCC_RES_VAR,SCC_VAR_WORD,-1);
  3644.  
  3645.   if(!v)
  3646.     SCC_ABORT((yylsp[(1) - (3)]),"%s::%s is not a declared resource.\n",(yyvsp[(1) - (3)].str),(yyvsp[(3) - (3)].str));
  3647.  
  3648.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3649.   if(scc_sym_is_var(v->type)) {
  3650.     (yyval.st)->type = SCC_ST_VAR;
  3651.     (yyval.st)->val.v.r = v;
  3652.   } else {
  3653.     (yyval.st)->type = SCC_ST_RES;
  3654.     (yyval.st)->val.r = v;
  3655.   }
  3656.   // allocate rid
  3657.   if(!v->rid) scc_ns_get_rid(sccp->ns,v);
  3658.  
  3659. ;}
  3660.     break;
  3661.  
  3662.   case 174:
  3663. #line 1692 "/usr/tmp/scc_parse.y"
  3664.     {
  3665.   scc_statement_t *a,*scr,*list;
  3666.   scc_func_t* f;
  3667.   scc_symbol_t* s;
  3668.   char* err;
  3669.   int user_script = 0;
  3670.  
  3671.   f = scc_get_func(sccp,(yyvsp[(1) - (4)].str));
  3672.   if(!f) {
  3673.     s = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(1) - (4)].str));
  3674.     if(!s || (s->type != SCC_RES_SCR && s->type != SCC_RES_LSCR))
  3675.       SCC_ABORT((yylsp[(1) - (4)]),"%s is not a known function or script.\n",(yyvsp[(1) - (4)].str));
  3676.  
  3677.     f = scc_get_func(sccp,"startScript0");
  3678.     if(!f)
  3679.       SCC_ABORT((yylsp[(1) - (4)]),"Internal error: startScriptQuick not found.\n");
  3680.  
  3681.     if(!s->rid) scc_ns_get_rid(sccp->ns,s);
  3682.  
  3683.     // create the arguments
  3684.     scr = calloc(1,sizeof(scc_statement_t));
  3685.     scr->type = SCC_ST_RES;
  3686.     scr->val.r = s;
  3687.  
  3688.     list = calloc(1,sizeof(scc_statement_t));
  3689.     list->type = SCC_ST_LIST;
  3690.     list->val.l = (yyvsp[(3) - (4)].st);
  3691.  
  3692.     scr->next = list;
  3693.  
  3694.     (yyvsp[(3) - (4)].st) = scr;
  3695.     user_script = 1;
  3696.   }
  3697.  
  3698.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3699.   (yyval.st)->type = SCC_ST_CALL;
  3700.  
  3701.   (yyval.st)->val.c.func = f;
  3702.   (yyval.st)->val.c.user_script = user_script;
  3703.   (yyval.st)->val.c.argv = (yyvsp[(3) - (4)].st);
  3704.  
  3705.   for(a = (yyvsp[(3) - (4)].st) ; a ; a = a->next)
  3706.     (yyval.st)->val.c.argc++;
  3707.  
  3708.   err = scc_statement_check_func(&(yyval.st)->val.c);
  3709.   if(err)
  3710.     SCC_ABORT((yylsp[(1) - (4)]),"%s",err);
  3711. ;}
  3712.     break;
  3713.  
  3714.   case 175:
  3715. #line 1742 "/usr/tmp/scc_parse.y"
  3716.     {
  3717.   scc_statement_t *scr,*list;
  3718.   scc_func_t* f;
  3719.   scc_symbol_t* s;
  3720.  
  3721.   s = scc_ns_get_sym(sccp->ns,(yyvsp[(1) - (6)].str),(yyvsp[(3) - (6)].str));
  3722.   if(!s || (s->type != SCC_RES_SCR && s->type != SCC_RES_LSCR))
  3723.     SCC_ABORT((yylsp[(1) - (6)]),"%s::%s is not a known function or script.\n",(yyvsp[(1) - (6)].str),(yyvsp[(3) - (6)].str));
  3724.  
  3725.   if(s->type == SCC_RES_LSCR &&
  3726.      s->parent != sccp->roobj->sym)
  3727.     SCC_ABORT((yylsp[(1) - (6)]),"%s is a local script and %s is not the current room.\n",
  3728.               (yyvsp[(3) - (6)].str),(yyvsp[(1) - (6)].str));
  3729.  
  3730.   f = scc_get_func(sccp,"startScript0");
  3731.   if(!f)
  3732.     SCC_ABORT((yylsp[(1) - (6)]),"Internal error: startScript0 not found.\n");
  3733.  
  3734.   if(!s->rid) scc_ns_get_rid(sccp->ns,s);
  3735.  
  3736.   // create the arguments
  3737.   scr = calloc(1,sizeof(scc_statement_t));
  3738.   scr->type = SCC_ST_RES;
  3739.   scr->val.r = s;
  3740.   
  3741.   list = calloc(1,sizeof(scc_statement_t));
  3742.   list->type = SCC_ST_LIST;
  3743.   list->val.l = (yyvsp[(5) - (6)].st);
  3744.   
  3745.   scr->next = list;
  3746.  
  3747.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3748.   (yyval.st)->type = SCC_ST_CALL;
  3749.  
  3750.   (yyval.st)->val.c.func = f;
  3751.   (yyval.st)->val.c.user_script = 1;
  3752.   (yyval.st)->val.c.argv = scr;
  3753.   (yyval.st)->val.c.argc = 2;
  3754. ;}
  3755.     break;
  3756.  
  3757.   case 176:
  3758. #line 1785 "/usr/tmp/scc_parse.y"
  3759.     {
  3760.   (yyval.st) = NULL;
  3761. ;}
  3762.     break;
  3763.  
  3764.   case 177:
  3765. #line 1790 "/usr/tmp/scc_parse.y"
  3766.     {
  3767.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3768. ;}
  3769.     break;
  3770.  
  3771.   case 178:
  3772. #line 1795 "/usr/tmp/scc_parse.y"
  3773.     {
  3774.   scc_statement_t* i;
  3775.  
  3776.   (yyval.st) = (yyvsp[(1) - (3)].st);
  3777.  
  3778.   for(i = (yyval.st) ; i->next ; i = i->next);
  3779.  
  3780.   i->next = (yyvsp[(3) - (3)].st);
  3781. ;}
  3782.     break;
  3783.  
  3784.   case 179:
  3785. #line 1806 "/usr/tmp/scc_parse.y"
  3786.     {
  3787.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3788. ;}
  3789.     break;
  3790.  
  3791.   case 180:
  3792. #line 1811 "/usr/tmp/scc_parse.y"
  3793.     {
  3794.   (yyval.st) = (yyvsp[(2) - (3)].st);
  3795. ;}
  3796.     break;
  3797.  
  3798.   case 181:
  3799. #line 1817 "/usr/tmp/scc_parse.y"
  3800.     {
  3801.   (yyval.st) = (yyvsp[(1) - (1)].st);
  3802. ;}
  3803.     break;
  3804.  
  3805.   case 182:
  3806. #line 1822 "/usr/tmp/scc_parse.y"
  3807.     {
  3808.   scc_statement_t* i;
  3809.   
  3810.   (yyval.st) = (yyvsp[(1) - (3)].st);
  3811.   for(i = (yyval.st) ; i->next ; i = i->next);
  3812.   
  3813.   i->next = (yyvsp[(3) - (3)].st);
  3814. ;}
  3815.     break;
  3816.  
  3817.   case 183:
  3818. #line 1833 "/usr/tmp/scc_parse.y"
  3819.     {
  3820.   scc_symbol_t* sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(1) - (1)].str));
  3821.   scc_statement_t *clsid, *bit;
  3822.   
  3823.   if(!sym)
  3824.     SCC_ABORT((yylsp[(1) - (1)]),"%s is not a declared class.\n",(yyvsp[(1) - (1)].str));
  3825.   
  3826.   if(sym->type != SCC_RES_CLASS)
  3827.     SCC_ABORT((yylsp[(1) - (1)]),"%s is not a class in the current context.\n",(yyvsp[(1) - (1)].str));
  3828.   
  3829.   // allocate rid
  3830.   if(!sym->rid) scc_ns_get_rid(sccp->ns,sym);
  3831.   
  3832.   // the arg is the class id + 0x80
  3833.   clsid = calloc(1,sizeof(scc_statement_t));
  3834.   clsid->type = SCC_ST_RES;
  3835.   clsid->val.r = sym;
  3836.   
  3837.   bit = calloc(1,sizeof(scc_statement_t));
  3838.   bit->type = SCC_ST_VAL;
  3839.   bit->val.i = 0x80;
  3840.   
  3841.   SCC_BOP((yyval.st),+,clsid,'+',bit);
  3842. ;}
  3843.     break;
  3844.  
  3845.   case 184:
  3846. #line 1859 "/usr/tmp/scc_parse.y"
  3847.     {
  3848.   scc_symbol_t* sym = scc_ns_get_sym(sccp->ns,NULL,(yyvsp[(2) - (2)].str));
  3849.   
  3850.   if(!sym)
  3851.     SCC_ABORT((yylsp[(1) - (2)]),"%s is not a declared class.\n",(yyvsp[(2) - (2)].str));
  3852.   
  3853.   if(sym->type != SCC_RES_CLASS)
  3854.     SCC_ABORT((yylsp[(1) - (2)]),"%s is not a class in the current context.\n",(yyvsp[(2) - (2)].str));
  3855.   
  3856.   // allocate rid
  3857.   if(!sym->rid) scc_ns_get_rid(sccp->ns,sym);
  3858.   
  3859.   // the arg is simply the class id
  3860.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3861.   (yyval.st)->type = SCC_ST_RES;
  3862.   (yyval.st)->val.r = sym;
  3863. ;}
  3864.     break;
  3865.  
  3866.   case 185:
  3867. #line 1879 "/usr/tmp/scc_parse.y"
  3868.     {
  3869.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3870.   (yyval.st)->type = SCC_ST_VAL;
  3871.   (yyval.st)->val.i = (yyvsp[(1) - (1)].integer);
  3872. ;}
  3873.     break;
  3874.  
  3875.   case 186:
  3876. #line 1886 "/usr/tmp/scc_parse.y"
  3877.     {
  3878.   (yyval.st) = calloc(1,sizeof(scc_statement_t));
  3879.   (yyval.st)->type = SCC_ST_STR;
  3880.   (yyval.st)->val.s = (yyvsp[(1) - (1)].strvar);
  3881. ;}
  3882.     break;
  3883.  
  3884.   case 187:
  3885. #line 1893 "/usr/tmp/scc_parse.y"
  3886.     {
  3887.   (yyval.strvar) = (yyvsp[(1) - (1)].strvar);
  3888. ;}
  3889.     break;
  3890.  
  3891.   case 188:
  3892. #line 1897 "/usr/tmp/scc_parse.y"
  3893.     {
  3894.   scc_str_t* s;
  3895.   for(s = (yyvsp[(1) - (2)].strvar) ; s->next ; s = s->next);
  3896.   s->next = (yyvsp[(2) - (2)].strvar);
  3897.   (yyval.strvar) = (yyvsp[(1) - (2)].strvar);
  3898. ;}
  3899.     break;
  3900.  
  3901.   case 189:
  3902. #line 1906 "/usr/tmp/scc_parse.y"
  3903.     {
  3904.   (yyval.strvar) = calloc(1,sizeof(scc_str_t));
  3905.   (yyval.strvar)->type = SCC_STR_CHAR;
  3906.   (yyval.strvar)->str = (yyvsp[(1) - (1)].str);
  3907. ;}
  3908.     break;
  3909.  
  3910.   case 190:
  3911. #line 1912 "/usr/tmp/scc_parse.y"
  3912.     {
  3913.   (yyval.strvar) = (yyvsp[(1) - (1)].strvar);
  3914.   // for color we have a raw value in str
  3915.   if((yyval.strvar)->type != SCC_STR_COLOR) {
  3916.     (yyval.strvar)->sym = scc_ns_get_sym(sccp->ns,NULL,(yyval.strvar)->str);
  3917.     if(!(yyval.strvar)->sym) // fix me we leak str      
  3918.       SCC_ABORT((yylsp[(1) - (1)]),"%s is not a declared variable.\n",(yyval.strvar)->str);
  3919.  
  3920.     free((yyval.strvar)->str);
  3921.     (yyval.strvar)->str = NULL;
  3922.  
  3923.     switch((yyval.strvar)->type) {
  3924.     case SCC_STR_VERB:
  3925.     case SCC_STR_NAME:
  3926.       if((yyval.strvar)->sym->type != SCC_RES_VAR &&
  3927.          (yyval.strvar)->sym->type != SCC_RES_LVAR)
  3928.         SCC_ABORT((yylsp[(1) - (1)]),"%s is not a variable",(yyval.strvar)->sym->sym);
  3929.       break;
  3930.     case SCC_STR_VOICE:
  3931.       if((yyval.strvar)->sym->type != SCC_RES_VOICE)
  3932.         SCC_ABORT((yylsp[(1) - (1)]),"%s is not a voice",(yyval.strvar)->sym->sym);
  3933.       break;
  3934.     case SCC_STR_FONT:
  3935.       if((yyval.strvar)->sym->type != SCC_RES_CHSET)
  3936.         SCC_ABORT((yylsp[(1) - (1)]),"%s is not a charset",(yyval.strvar)->sym->sym);
  3937.       break;
  3938.     }
  3939.     // allocate rid
  3940.     if(!(yyval.strvar)->sym->rid) scc_ns_get_rid(sccp->ns,(yyval.strvar)->sym);
  3941.   }
  3942. ;}
  3943.     break;
  3944.  
  3945.   case 191:
  3946. #line 1946 "/usr/tmp/scc_parse.y"
  3947.     {
  3948.   (yyval.integer) = (yyvsp[(1) - (1)].integer);
  3949. ;}
  3950.     break;
  3951.  
  3952.   case 192:
  3953. #line 1950 "/usr/tmp/scc_parse.y"
  3954.     {
  3955.   (yyval.integer) = -(yyvsp[(2) - (2)].integer);
  3956. ;}
  3957.     break;
  3958.  
  3959.  
  3960. /* Line 1267 of yacc.c.  */
  3961. #line 3962 "scc_parse.tab.c"
  3962.       default: break;
  3963.     }
  3964.   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  3965.  
  3966.   YYPOPSTACK (yylen);
  3967.   yylen = 0;
  3968.   YY_STACK_PRINT (yyss, yyssp);
  3969.  
  3970.   *++yyvsp = yyval;
  3971.   *++yylsp = yyloc;
  3972.  
  3973.   /* Now `shift' the result of the reduction.  Determine what state
  3974.      that goes to, based on the state we popped back to and the rule
  3975.      number reduced by.  */
  3976.  
  3977.   yyn = yyr1[yyn];
  3978.  
  3979.   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  3980.   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  3981.     yystate = yytable[yystate];
  3982.   else
  3983.     yystate = yydefgoto[yyn - YYNTOKENS];
  3984.  
  3985.   goto yynewstate;
  3986.  
  3987.  
  3988. /*------------------------------------.
  3989. | yyerrlab -- here on detecting error |
  3990. `------------------------------------*/
  3991. yyerrlab:
  3992.   /* If not already recovering from an error, report this error.  */
  3993.   if (!yyerrstatus)
  3994.     {
  3995.       ++yynerrs;
  3996. #if ! YYERROR_VERBOSE
  3997.       yyerror (YY_("syntax error"));
  3998. #else
  3999.       {
  4000.     YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  4001.     if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
  4002.       {
  4003.         YYSIZE_T yyalloc = 2 * yysize;
  4004.         if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
  4005.           yyalloc = YYSTACK_ALLOC_MAXIMUM;
  4006.         if (yymsg != yymsgbuf)
  4007.           YYSTACK_FREE (yymsg);
  4008.         yymsg = (char *) YYSTACK_ALLOC (yyalloc);
  4009.         if (yymsg)
  4010.           yymsg_alloc = yyalloc;
  4011.         else
  4012.           {
  4013.         yymsg = yymsgbuf;
  4014.         yymsg_alloc = sizeof yymsgbuf;
  4015.           }
  4016.       }
  4017.  
  4018.     if (0 < yysize && yysize <= yymsg_alloc)
  4019.       {
  4020.         (void) yysyntax_error (yymsg, yystate, yychar);
  4021.         yyerror (yymsg);
  4022.       }
  4023.     else
  4024.       {
  4025.         yyerror (YY_("syntax error"));
  4026.         if (yysize != 0)
  4027.           goto yyexhaustedlab;
  4028.       }
  4029.       }
  4030. #endif
  4031.     }
  4032.  
  4033.   yyerror_range[0] = yylloc;
  4034.  
  4035.   if (yyerrstatus == 3)
  4036.     {
  4037.       /* If just tried and failed to reuse look-ahead token after an
  4038.      error, discard it.  */
  4039.  
  4040.       if (yychar <= YYEOF)
  4041.     {
  4042.       /* Return failure if at end of input.  */
  4043.       if (yychar == YYEOF)
  4044.         YYABORT;
  4045.     }
  4046.       else
  4047.     {
  4048.       yydestruct ("Error: discarding",
  4049.               yytoken, &yylval, &yylloc);
  4050.       yychar = YYEMPTY;
  4051.     }
  4052.     }
  4053.  
  4054.   /* Else will try to reuse look-ahead token after shifting the error
  4055.      token.  */
  4056.   goto yyerrlab1;
  4057.  
  4058.  
  4059. /*---------------------------------------------------.
  4060. | yyerrorlab -- error raised explicitly by YYERROR.  |
  4061. `---------------------------------------------------*/
  4062. yyerrorlab:
  4063.  
  4064.   /* Pacify compilers like GCC when the user code never invokes
  4065.      YYERROR and the label yyerrorlab therefore never appears in user
  4066.      code.  */
  4067.   if (/*CONSTCOND*/ 0)
  4068.      goto yyerrorlab;
  4069.  
  4070.   yyerror_range[0] = yylsp[1-yylen];
  4071.   /* Do not reclaim the symbols of the rule which action triggered
  4072.      this YYERROR.  */
  4073.   YYPOPSTACK (yylen);
  4074.   yylen = 0;
  4075.   YY_STACK_PRINT (yyss, yyssp);
  4076.   yystate = *yyssp;
  4077.   goto yyerrlab1;
  4078.  
  4079.  
  4080. /*-------------------------------------------------------------.
  4081. | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  4082. `-------------------------------------------------------------*/
  4083. yyerrlab1:
  4084.   yyerrstatus = 3;    /* Each real token shifted decrements this.  */
  4085.  
  4086.   for (;;)
  4087.     {
  4088.       yyn = yypact[yystate];
  4089.       if (yyn != YYPACT_NINF)
  4090.     {
  4091.       yyn += YYTERROR;
  4092.       if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  4093.         {
  4094.           yyn = yytable[yyn];
  4095.           if (0 < yyn)
  4096.         break;
  4097.         }
  4098.     }
  4099.  
  4100.       /* Pop the current state because it cannot handle the error token.  */
  4101.       if (yyssp == yyss)
  4102.     YYABORT;
  4103.  
  4104.       yyerror_range[0] = *yylsp;
  4105.       yydestruct ("Error: popping",
  4106.           yystos[yystate], yyvsp, yylsp);
  4107.       YYPOPSTACK (1);
  4108.       yystate = *yyssp;
  4109.       YY_STACK_PRINT (yyss, yyssp);
  4110.     }
  4111.  
  4112.   if (yyn == YYFINAL)
  4113.     YYACCEPT;
  4114.  
  4115.   *++yyvsp = yylval;
  4116.  
  4117.   yyerror_range[1] = yylloc;
  4118.   /* Using YYLLOC is tempting, but would change the location of
  4119.      the look-ahead.  YYLOC is available though.  */
  4120.   YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
  4121.   *++yylsp = yyloc;
  4122.  
  4123.   /* Shift the error token.  */
  4124.   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  4125.  
  4126.   yystate = yyn;
  4127.   goto yynewstate;
  4128.  
  4129.  
  4130. /*-------------------------------------.
  4131. | yyacceptlab -- YYACCEPT comes here.  |
  4132. `-------------------------------------*/
  4133. yyacceptlab:
  4134.   yyresult = 0;
  4135.   goto yyreturn;
  4136.  
  4137. /*-----------------------------------.
  4138. | yyabortlab -- YYABORT comes here.  |
  4139. `-----------------------------------*/
  4140. yyabortlab:
  4141.   yyresult = 1;
  4142.   goto yyreturn;
  4143.  
  4144. #ifndef yyoverflow
  4145. /*-------------------------------------------------.
  4146. | yyexhaustedlab -- memory exhaustion comes here.  |
  4147. `-------------------------------------------------*/
  4148. yyexhaustedlab:
  4149.   yyerror (YY_("memory exhausted"));
  4150.   yyresult = 2;
  4151.   /* Fall through.  */
  4152. #endif
  4153.  
  4154. yyreturn:
  4155.   if (yychar != YYEOF && yychar != YYEMPTY)
  4156.      yydestruct ("Cleanup: discarding lookahead",
  4157.          yytoken, &yylval, &yylloc);
  4158.   /* Do not reclaim the symbols of the rule which action triggered
  4159.      this YYABORT or YYACCEPT.  */
  4160.   YYPOPSTACK (yylen);
  4161.   YY_STACK_PRINT (yyss, yyssp);
  4162.   while (yyssp != yyss)
  4163.     {
  4164.       yydestruct ("Cleanup: popping",
  4165.           yystos[*yyssp], yyvsp, yylsp);
  4166.       YYPOPSTACK (1);
  4167.     }
  4168. #ifndef yyoverflow
  4169.   if (yyss != yyssa)
  4170.     YYSTACK_FREE (yyss);
  4171. #endif
  4172. #if YYERROR_VERBOSE
  4173.   if (yymsg != yymsgbuf)
  4174.     YYSTACK_FREE (yymsg);
  4175. #endif
  4176.   /* Make sure YYID is used.  */
  4177.   return YYID (yyresult);
  4178. }
  4179.  
  4180.  
  4181. #line 1955 "/usr/tmp/scc_parse.y"
  4182.  
  4183.  
  4184. #undef yyparse
  4185. #undef yylex
  4186. #undef yyerror
  4187. #undef sccp
  4188.  
  4189.  
  4190. extern int scc_main_lexer(YYSTYPE *lvalp, YYLTYPE *llocp,scc_lex_t* lex);
  4191.  
  4192. typedef struct scc_source_st scc_source_t;
  4193. struct scc_source_st {
  4194.   scc_source_t* next;
  4195.   scc_ns_t* ns;
  4196.   scc_roobj_t* roobj_list;
  4197.   char* file;
  4198.   int num_deps;
  4199.   char** deps;
  4200. };
  4201.  
  4202.  
  4203. static void set_start_pos(YYLTYPE *llocp,int line,int column) {
  4204.   llocp->first_line = line+1;
  4205.   llocp->first_column = column;
  4206. }
  4207.  
  4208. static void set_end_pos(YYLTYPE *llocp,int line,int column) {
  4209.   llocp->last_line = line+1;
  4210.   llocp->last_column = column;
  4211. }
  4212.  
  4213. // WARNING: This function realloc the file to fit the new path in
  4214. static void scc_parser_find_res(scc_parser_t* sccp, char** file_ptr) {
  4215.   int i;
  4216.   char* file;
  4217.   
  4218.   if(!file_ptr || !file_ptr[0]) return;
  4219.   file = file_ptr[0];
  4220.   
  4221.   if(sccp->res_path) {
  4222.     int file_len = strlen(file);
  4223.     struct stat st;
  4224.     for(i = 0 ; sccp->res_path[i] ; i++) {
  4225.       int path_len = strlen(sccp->res_path[i]) + 1 + file_len + 1;
  4226.       char path[path_len];
  4227.       sprintf(path,"%s/%s",sccp->res_path[i],file);
  4228.       if(stat(path,&st) || !S_ISREG(st.st_mode)) continue;
  4229.       file_ptr[0] = realloc(file,path_len);
  4230.       strcpy(file_ptr[0],path);
  4231.       return;
  4232.     }
  4233.   }
  4234. }
  4235.     
  4236.       
  4237. void scc_parser_add_dep(scc_parser_t* sccp, char* dep) {
  4238.   int i;
  4239.   if(!sccp->num_deps)
  4240.     sccp->deps = malloc(sizeof(char*));
  4241.   else {
  4242.     for(i = 0 ; i < sccp->num_deps ; i++)
  4243.       if(!strcmp(sccp->deps[i],dep)) return;
  4244.     sccp->deps = realloc(sccp->deps,(sccp->num_deps+1)*sizeof(char*));
  4245.   }
  4246.   sccp->deps[sccp->num_deps] = strdup(dep);
  4247.   sccp->num_deps++;
  4248. }
  4249.  
  4250. scc_source_t* scc_parser_parse(scc_parser_t* sccp,char* file,char do_deps) {
  4251.   scc_source_t* src;
  4252.  
  4253.   if(do_deps) {
  4254.       sccp->lex->opened = (scc_lexer_opened_f)scc_parser_add_dep;
  4255.       sccp->lex->ignore_missing_include = 1;
  4256.   } else {
  4257.       sccp->lex->opened = NULL;
  4258.       sccp->lex->ignore_missing_include = 0;
  4259.   }
  4260.  
  4261.   if(!scc_lex_push_buffer(sccp->lex,file)) return NULL;
  4262.  
  4263.   sccp->ns = scc_ns_new(sccp->target);
  4264.   sccp->roobj_list = NULL;
  4265.   sccp->roobj = NULL;
  4266.   sccp->obj = NULL;
  4267.   sccp->local_vars = 0;
  4268.   sccp->local_scr = sccp->target->max_global_scr;
  4269.   sccp->cycl = 1;
  4270.   sccp->do_deps = do_deps;
  4271.  
  4272.   if(scc_parser_parse_internal(sccp)) return NULL;
  4273.  
  4274.   if(sccp->lex->error) {
  4275.     scc_log(LOG_ERR,"%s: %s\n",scc_lex_get_file(sccp->lex),sccp->lex->error);
  4276.     return NULL;
  4277.   }
  4278.  
  4279.   src = calloc(1,sizeof(scc_source_t));
  4280.   src->ns = sccp->ns;
  4281.   src->roobj_list = sccp->roobj_list;
  4282.   src->file = file;
  4283.   if(sccp->do_deps) {
  4284.     src->num_deps = sccp->num_deps;
  4285.     src->deps = sccp->deps;
  4286.     sccp->num_deps = 0;
  4287.     sccp->deps = NULL;
  4288.   }
  4289.   return src;
  4290. }
  4291.  
  4292. scc_parser_t* scc_parser_new(char** include, char** res_path,
  4293.                              int vm_version) {
  4294.   scc_target_t* target = scc_get_target(vm_version);
  4295.   scc_parser_t* p;
  4296.  
  4297.   if(!target) return NULL;
  4298.  
  4299.   p = calloc(1,sizeof(scc_parser_t));
  4300.   p->target = target;
  4301.   p->lex = scc_lex_new(scc_main_lexer,set_start_pos,set_end_pos,include);
  4302.   p->lex->userdata = p;
  4303.   p->res_path = res_path;
  4304.   return p;
  4305. }
  4306.  
  4307.  
  4308. int scc_parser_error(scc_parser_t* sccp,YYLTYPE *loc, const char *s)  /* Called by yyparse on error */
  4309. {
  4310.   scc_log(LOG_ERR,"%s: %s\n",scc_lex_get_file(sccp->lex),
  4311.           sccp->lex->error ? sccp->lex->error : s);
  4312.   return 0;
  4313. }
  4314.  
  4315. static char** scc_include = NULL;
  4316. static char** scc_res_path = NULL;
  4317. static int scc_do_deps = 0;
  4318. static int scc_vm_version = 6;
  4319.  
  4320. static scc_param_t scc_parse_params[] = {
  4321.   { "o", SCC_PARAM_STR, 0, 0, &scc_output },
  4322.   { "I", SCC_PARAM_STR_LIST, 0, 0, &scc_include },
  4323.   { "R", SCC_PARAM_STR_LIST, 0, 0, &scc_res_path },
  4324.   { "d", SCC_PARAM_FLAG, 0, 1, &scc_do_deps },
  4325.   { "v", SCC_PARAM_FLAG, LOG_MSG, LOG_V, &scc_log_level },
  4326.   { "vv", SCC_PARAM_FLAG, LOG_MSG, LOG_DBG, &scc_log_level },
  4327.   { "V", SCC_PARAM_INT, 6, 7, &scc_vm_version },
  4328.   { "help", SCC_PARAM_HELP, 0, 0, &scc_help },
  4329.   { NULL, 0, 0, 0, NULL }
  4330. };
  4331.  
  4332.  
  4333. int main (int argc, char** argv) {
  4334.   scc_cl_arg_t* files,*f;
  4335.   scc_parser_t* sccp;
  4336.   char* out;
  4337.   scc_source_t *src,*srcs = NULL;
  4338.   scc_roobj_t* scc_roobj;
  4339.   scc_fd_t* out_fd;
  4340.   int i;
  4341.  
  4342.   files = scc_param_parse_argv(scc_parse_params,argc-1,&argv[1]);
  4343.  
  4344.   if(!files) scc_print_help(&scc_help,1);
  4345.  
  4346.   sccp = scc_parser_new(scc_include,scc_res_path,scc_vm_version);
  4347.  
  4348.   for(f = files ; f ; f = f->next) {
  4349.     src = scc_parser_parse(sccp,f->val,scc_do_deps);
  4350.     if(!src) return 1;
  4351.     src->next = srcs;
  4352.     srcs = src;
  4353.   }
  4354.  
  4355.   out = scc_output ? scc_output : "output.roobj";
  4356.   out_fd = new_scc_fd(out,O_WRONLY|O_CREAT|O_TRUNC,0);
  4357.   if(!out_fd) {
  4358.     scc_log(LOG_ERR,"Failed to open output file %s.\n",out);
  4359.     return -1;
  4360.   }    
  4361.  
  4362.   if(scc_do_deps) {
  4363.     for(src = srcs ; src ; src = src->next) {
  4364.       char* pt = strrchr(src->file,'.');
  4365.       char* start = strrchr(src->file,'/');
  4366.       if(pt) pt[0] = '\0';
  4367.       if(start) start++;
  4368.       else start = src->file;
  4369.       scc_fd_printf(out_fd,"%s.roobj:",start);
  4370.       for(i = 0 ; i < src->num_deps ; i++)
  4371.         scc_fd_printf(out_fd," %s",src->deps[i]);
  4372.         scc_fd_printf(out_fd,"\n");
  4373.     }
  4374.     scc_fd_close(out_fd);
  4375.     return 0;
  4376.   }
  4377.  
  4378.   for(src = srcs ; src ; src = src->next) {
  4379.     for(scc_roobj = src->roobj_list ; scc_roobj ; 
  4380.         scc_roobj = scc_roobj->next) {
  4381.       if(!scc_roobj_write(scc_roobj,src->ns,out_fd)) {
  4382.         scc_log(LOG_ERR,"Failed to write ROOM????\n");
  4383.         return 1;
  4384.       }
  4385.     }
  4386.   }
  4387.  
  4388.   scc_fd_close(out_fd);
  4389.  
  4390.   return 0;
  4391. }
  4392.  
  4393.