/* A Bison parser, made from _compparse.y by GNU Bison version 1.27 */ #define _CCBISON 1 /* Identify Bison output. */ #define T_NAME 257 #define T_FLOAT 258 #define T_DOUBLE 259 #define T_INT 260 #define T_INPUT 261 #define T_ID 262 #define T_STRING 263 #define T_EOF 264 #define T_LPAR 265 #define T_RPAR 266 #define T_LBRA 267 #define T_RBRA 268 #define T_LSQB 269 #define T_RSQB 270 #define T_COMMA 271 #define T_PERIOD 272 #define T_COLON 273 #define T_LOR 274 #define T_LAND 275 #define T_LNOT 276 #define T_LT 277 #define T_LE 278 #define T_GT 279 #define T_GE 280 #define T_EQ 281 #define T_NE 282 #define T_QUEST 283 #define T_CROSS 284 #define T_DOT 285 #define T_PLUS 286 #define T_MINUS 287 #define T_EXP 288 #define T_TIMES 289 #define T_DIV 290 #define T_MOD 291 #define T_ASSIGN 292 #define T_SEMI 293 #define U_MINUS 294 #define U_PLUS 295 #define U_LNOT 296 #line 10 "_compparse.y" #include #include #include #include "_compute.h" #include "_compputils.h" int _dxdparseError = 0; /* Only shared with _compputils.c */ PTreeNode * _dxfMakeFunCall(char *func, PTreeNode *args); #line 27 "_compparse.y" typedef union { #define MAX_PARSE_STRING_SIZE 512 char s[MAX_PARSE_STRING_SIZE]; int i; float f; double d; PTreeNode *a; } _CCSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define _CCFINAL 94 #define _CCFLAG -32768 #define _CCNTBASE 43 #define _CCTRANSLATE(x) ((unsigned)(x) <= 296 ? _dxfcctranslate[x] : 52) static const char _dxfcctranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 }; #if _CCDEBUG != 0 static const short _dxfccprhs[] = { 0, 0, 1, 5, 7, 10, 14, 17, 19, 23, 27, 29, 33, 37, 42, 47, 52, 57, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 130, 133, 136, 140, 142, 143, 145, 147, 151, 153, 157, 159, 161, 163, 165 }; static const short _dxfccrhs[] = { -1, 44, 45, 10, 0, 46, 0, 39, 45, 0, 45, 39, 46, 0, 45, 39, 0, 7, 0, 46, 18, 50, 0, 46, 18, 3, 0, 50, 0, 11, 46, 12, 0, 15, 49, 16, 0, 3, 11, 47, 12, 0, 37, 11, 47, 12, 0, 31, 11, 47, 12, 0, 30, 11, 47, 12, 0, 46, 29, 46, 19, 46, 0, 46, 21, 46, 0, 46, 20, 46, 0, 46, 25, 46, 0, 46, 26, 46, 0, 46, 23, 46, 0, 46, 24, 46, 0, 46, 27, 46, 0, 46, 28, 46, 0, 46, 32, 46, 0, 46, 33, 46, 0, 46, 35, 46, 0, 46, 36, 46, 0, 46, 37, 46, 0, 46, 31, 46, 0, 46, 30, 46, 0, 46, 34, 46, 0, 33, 46, 0, 32, 46, 0, 22, 46, 0, 3, 38, 46, 0, 3, 0, 0, 48, 0, 46, 0, 48, 17, 46, 0, 46, 0, 49, 17, 46, 0, 51, 0, 6, 0, 4, 0, 5, 0, 9, 0 }; #endif #if _CCDEBUG != 0 static const short _dxfccrline[] = { 0, 115, 116, 133, 137, 141, 149, 160, 164, 168, 192, 193, 197, 201, 219, 228, 237, 246, 250, 254, 258, 262, 266, 270, 274, 278, 282, 286, 290, 294, 298, 302, 306, 310, 314, 318, 322, 326, 330, 337, 341, 345, 349, 361, 365, 384, 388, 396, 404, 412 }; #endif #if _CCDEBUG != 0 || defined (_CCERROR_VERBOSE) static const char * const _dxfcctname[] = { "$","error","$undefined.","T_NAME", "T_FLOAT","T_DOUBLE","T_INT","T_INPUT","T_ID","T_STRING","T_EOF","T_LPAR","T_RPAR", "T_LBRA","T_RBRA","T_LSQB","T_RSQB","T_COMMA","T_PERIOD","T_COLON","T_LOR","T_LAND", "T_LNOT","T_LT","T_LE","T_GT","T_GE","T_EQ","T_NE","T_QUEST","T_CROSS","T_DOT", "T_PLUS","T_MINUS","T_EXP","T_TIMES","T_DIV","T_MOD","T_ASSIGN","T_SEMI","U_MINUS", "U_PLUS","U_LNOT","top","@1","statement_list","expr","optional_argument_list", "argument_list","list","constant","real", NULL }; #endif static const short _dxfccr1[] = { 0, 44, 43, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 48, 48, 49, 49, 50, 51, 51, 51, 51 }; static const short _dxfccr2[] = { 0, 0, 3, 1, 2, 3, 2, 1, 3, 3, 1, 3, 3, 4, 4, 4, 4, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 1, 0, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1 }; static const short _dxfccdefact[] = { 1, 0, 38, 47, 48, 46, 7, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 45, 39, 0, 0, 43, 0, 36, 39, 39, 35, 34, 39, 4, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 40, 37, 11, 12, 0, 0, 0, 0, 5, 9, 8, 19, 18, 22, 23, 20, 21, 24, 25, 0, 32, 31, 26, 27, 33, 28, 29, 30, 13, 0, 44, 16, 15, 14, 0, 42, 17, 0, 0, 0 }; static const short _dxfccdefgoto[] = { 92, 1, 17, 53, 54, 55, 25, 19, 20 }; static const short _dxfccpact[] = {-32768, 59, -7,-32768,-32768,-32768,-32768,-32768, 96, 96, 96, 0, 3, 96, 96, 6, 59, -9, 158,-32768,-32768, 96, 96, 118, 158, -11,-32768, 96, 96,-32768,-32768, 96, -19,-32768, 96, 51, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 158, 20, 17, 158,-32768,-32768, 96, 40, 49, 55, 158,-32768,-32768, 178, 198, -8, -8, -8, -8, 218, 218, 138, 79, -16, 41, 41, 35, -15, -15, -15,-32768, 96, 158,-32768,-32768,-32768, 96, 158, 158, 69, 73,-32768 }; static const short _dxfccpgoto[] = {-32768, -32768, 63, -1, 81,-32768,-32768, 45,-32768 }; #define _CCLAST 255 static const short _dxfcctable[] = { 18, 33, 35, 35, 21, 58, 59, 23, 24, 26, 35, 27, 29, 30, 28, 18, 46, 31, 49, 49, 34, 56, 45, 46, 47, 48, 49, 50, 51, 52, 34, 22, 83, 63, 84, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 86, 35, 64, 3, 4, 5, 85, 35, 7, 87, 2, 3, 4, 5, 6, 88, 7, 93, 8, 45, 46, 94, 9, 49, 50, 51, 52, 32, 65, 10, 0, 90, 0, 0, 0, 0, 91, 11, 12, 13, 14, 0, 0, 0, 15, 35, 16, 2, 3, 4, 5, 6, 0, 7, 0, 8, 60, 61, 46, 9, 62, 49, 50, 51, 52, 0, 10, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, 57, 0, 0, 15, 0, 0, 35, 0, 36, 37, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 35, 89, 36, 37, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 35, 0, 36, 37, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 35, 0, 0, 37, 0, 38, 39, 40, 41, 42, 43, 0, 45, 46, 47, 48, 49, 50, 51, 52, 35, 0, 0, 0, 0, 38, 39, 40, 41, 42, 43, 0, 45, 46, 47, 48, 49, 50, 51, 52, 35, 0, 0, 0, 0, 38, 39, 40, 41, 0, 0, 0, 45, 46, 47, 48, 49, 50, 51, 52 }; static const short _dxfcccheck[] = { 1, 10, 18, 18, 11, 16, 17, 8, 9, 10, 18, 11, 13, 14, 11, 16, 31, 11, 34, 34, 39, 22, 30, 31, 32, 33, 34, 35, 36, 37, 39, 38, 12, 34, 17, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 12, 18, 3, 4, 5, 6, 59, 18, 9, 12, 3, 4, 5, 6, 7, 12, 9, 0, 11, 30, 31, 0, 15, 34, 35, 36, 37, 16, 35, 22, -1, 84, -1, -1, -1, -1, 89, 30, 31, 32, 33, -1, -1, -1, 37, 18, 39, 3, 4, 5, 6, 7, -1, 9, -1, 11, 27, 28, 31, 15, 31, 34, 35, 36, 37, -1, 22, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 12, -1, -1, 37, -1, -1, 18, -1, 20, 21, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 18, 19, 20, 21, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 18, -1, 20, 21, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 18, -1, -1, 21, -1, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, 34, 35, 36, 37, 18, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, 34, 35, 36, 37, 18, -1, -1, -1, -1, 23, 24, 25, 26, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/local/share/bison.simple" /* This file comes from bison-1.27. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ #ifndef _CCSTACK_USE_ALLOCA #ifdef alloca #define _CCSTACK_USE_ALLOCA #else /* alloca not defined */ #ifdef __GNUC__ #define _CCSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) #define _CCSTACK_USE_ALLOCA #include #else /* not sparc */ /* We think this test detects Watcom and Microsoft C. */ /* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */ #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) #if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */ #include #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) /* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. */ /* #include */ #pragma alloca #define _CCSTACK_USE_ALLOCA #else /* not MSDOS, or __TURBOC__, or _AIX */ #if 0 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */ #define _CCSTACK_USE_ALLOCA #define alloca __builtin_alloca #endif /* __hpux */ #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc */ #endif /* not GNU C */ #endif /* alloca not defined */ #endif /* _CCSTACK_USE_ALLOCA not defined */ #ifdef _CCSTACK_USE_ALLOCA #define _CCSTACK_ALLOC alloca #else #define _CCSTACK_ALLOC malloc #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define _dxfccerrok (_dxfccerrstatus = 0) #define _dxfccclearin (_dxfccchar = _CCEMPTY) #define _CCEMPTY -2 #define _CCEOF 0 #define _CCACCEPT goto _dxfccacceptlab #define _CCABORT goto _dxfccabortlab #define _CCERROR goto _dxfccerrlab1 /* Like _CCERROR except do call _dxfccerror. This remains here temporarily to ease the transition to the new meaning of _CCERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define _CCFAIL goto _dxfccerrlab #define _CCRECOVERING() (!!_dxfccerrstatus) #define _CCBACKUP(token, value) \ do \ if (_dxfccchar == _CCEMPTY && _dxfcclen == 1) \ { _dxfccchar = (token), _dxfcclval = (value); \ _dxfccchar1 = _CCTRANSLATE (_dxfccchar); \ _CCPOPSTACK; \ goto _dxfccbackup; \ } \ else \ { _dxfccerror ("syntax error: cannot back up"); _CCERROR; } \ while (0) #define _CCTERROR 1 #define _CCERRCODE 256 #ifndef _CCPURE #define _CCLEX _dxfcclex() #endif #ifdef _CCPURE #ifdef _CCLSP_NEEDED #ifdef _CCLEX_PARAM #define _CCLEX _dxfcclex(&_dxfcclval, &_dxfcclloc, _CCLEX_PARAM) #else #define _CCLEX _dxfcclex(&_dxfcclval, &_dxfcclloc) #endif #else /* not _CCLSP_NEEDED */ #ifdef _CCLEX_PARAM #define _CCLEX _dxfcclex(&_dxfcclval, _CCLEX_PARAM) #else #define _CCLEX _dxfcclex(&_dxfcclval) #endif #endif /* not _CCLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef _CCPURE int _dxfccchar; /* the lookahead symbol */ _CCSTYPE _dxfcclval; /* the semantic value of the */ /* lookahead symbol */ #ifdef _CCLSP_NEEDED _CCLTYPE _dxfcclloc; /* location data for the lookahead */ /* symbol */ #endif int _dxfccnerrs; /* number of parse errors so far */ #endif /* not _CCPURE */ #if _CCDEBUG != 0 int _dxfccdebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* _CCINITDEPTH indicates the initial size of the parser's stacks */ #ifndef _CCINITDEPTH #define _CCINITDEPTH 200 #endif /* _CCMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if _CCMAXDEPTH == 0 #undef _CCMAXDEPTH #endif #ifndef _CCMAXDEPTH #define _CCMAXDEPTH 10000 #endif /* Define ___dxfcc_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define ___dxfcc_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ___dxfcc_memcpy (to, from, count) char *to; char *from; unsigned int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void ___dxfcc_memcpy (char *to, char *from, unsigned int count) { register char *t = to; register char *f = from; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif #line 216 "/usr/local/share/bison.simple" /* The user can define _CCPARSE_PARAM as the name of an argument to be passed into _dxfccparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef _CCPARSE_PARAM #ifdef __cplusplus #define _CCPARSE_PARAM_ARG void *_CCPARSE_PARAM #define _CCPARSE_PARAM_DECL #else /* not __cplusplus */ #define _CCPARSE_PARAM_ARG _CCPARSE_PARAM #define _CCPARSE_PARAM_DECL void *_CCPARSE_PARAM; #endif /* not __cplusplus */ #else /* not _CCPARSE_PARAM */ #define _CCPARSE_PARAM_ARG #define _CCPARSE_PARAM_DECL #endif /* not _CCPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ #ifdef _CCPARSE_PARAM int _dxfccparse (void *); #else int _dxfccparse (void); #endif #endif int _dxfccparse(_CCPARSE_PARAM_ARG) _CCPARSE_PARAM_DECL { register int _dxfccstate; register int _dxfccn; register short *_dxfccssp; register _CCSTYPE *_dxfccvsp; int _dxfccerrstatus; /* number of tokens to shift before error messages enabled */ int _dxfccchar1 = 0; /* lookahead token as an internal (translated) token number */ short _dxfccssa[_CCINITDEPTH]; /* the state stack */ _CCSTYPE _dxfccvsa[_CCINITDEPTH]; /* the semantic value stack */ short *_dxfccss = _dxfccssa; /* refer to the stacks thru separate pointers */ _CCSTYPE *_dxfccvs = _dxfccvsa; /* to allow _dxfccoverflow to reallocate them elsewhere */ #ifdef _CCLSP_NEEDED _CCLTYPE _dxfcclsa[_CCINITDEPTH]; /* the location stack */ _CCLTYPE *_dxfccls = _dxfcclsa; _CCLTYPE *_dxfcclsp; #define _CCPOPSTACK (_dxfccvsp--, _dxfccssp--, _dxfcclsp--) #else #define _CCPOPSTACK (_dxfccvsp--, _dxfccssp--) #endif int _dxfccstacksize = _CCINITDEPTH; int _dxfccfree_stacks = 0; #ifdef _CCPURE int _dxfccchar; _CCSTYPE _dxfcclval; int _dxfccnerrs; #ifdef _CCLSP_NEEDED _CCLTYPE _dxfcclloc; #endif #endif _CCSTYPE _dxfccval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int _dxfcclen; #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Starting parse\n"); #endif _dxfccstate = 0; _dxfccerrstatus = 0; _dxfccnerrs = 0; _dxfccchar = _CCEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ _dxfccssp = _dxfccss - 1; _dxfccvsp = _dxfccvs; #ifdef _CCLSP_NEEDED _dxfcclsp = _dxfccls; #endif /* Push a new state, which is found in _dxfccstate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ _dxfccnewstate: *++_dxfccssp = _dxfccstate; if (_dxfccssp >= _dxfccss + _dxfccstacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ _CCSTYPE *_dxfccvs1 = _dxfccvs; short *_dxfccss1 = _dxfccss; #ifdef _CCLSP_NEEDED _CCLTYPE *_dxfccls1 = _dxfccls; #endif /* Get the current used size of the three stacks, in elements. */ int size = _dxfccssp - _dxfccss + 1; #ifdef _dxfccoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef _CCLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if _dxfccoverflow is a macro. */ _dxfccoverflow("parser stack overflow", &_dxfccss1, size * sizeof (*_dxfccssp), &_dxfccvs1, size * sizeof (*_dxfccvsp), &_dxfccls1, size * sizeof (*_dxfcclsp), &_dxfccstacksize); #else _dxfccoverflow("parser stack overflow", &_dxfccss1, size * sizeof (*_dxfccssp), &_dxfccvs1, size * sizeof (*_dxfccvsp), &_dxfccstacksize); #endif _dxfccss = _dxfccss1; _dxfccvs = _dxfccvs1; #ifdef _CCLSP_NEEDED _dxfccls = _dxfccls1; #endif #else /* no _dxfccoverflow */ /* Extend the stack our own way. */ if (_dxfccstacksize >= _CCMAXDEPTH) { _dxfccerror("parser stack overflow"); if (_dxfccfree_stacks) { free (_dxfccss); free (_dxfccvs); #ifdef _CCLSP_NEEDED free (_dxfccls); #endif } return 2; } _dxfccstacksize *= 2; if (_dxfccstacksize > _CCMAXDEPTH) _dxfccstacksize = _CCMAXDEPTH; #ifndef _CCSTACK_USE_ALLOCA _dxfccfree_stacks = 1; #endif _dxfccss = (short *) _CCSTACK_ALLOC (_dxfccstacksize * sizeof (*_dxfccssp)); ___dxfcc_memcpy ((char *)_dxfccss, (char *)_dxfccss1, size * (unsigned int) sizeof (*_dxfccssp)); _dxfccvs = (_CCSTYPE *) _CCSTACK_ALLOC (_dxfccstacksize * sizeof (*_dxfccvsp)); ___dxfcc_memcpy ((char *)_dxfccvs, (char *)_dxfccvs1, size * (unsigned int) sizeof (*_dxfccvsp)); #ifdef _CCLSP_NEEDED _dxfccls = (_CCLTYPE *) _CCSTACK_ALLOC (_dxfccstacksize * sizeof (*_dxfcclsp)); ___dxfcc_memcpy ((char *)_dxfccls, (char *)_dxfccls1, size * (unsigned int) sizeof (*_dxfcclsp)); #endif #endif /* no _dxfccoverflow */ _dxfccssp = _dxfccss + size - 1; _dxfccvsp = _dxfccvs + size - 1; #ifdef _CCLSP_NEEDED _dxfcclsp = _dxfccls + size - 1; #endif #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Stack size increased to %d\n", _dxfccstacksize); #endif if (_dxfccssp >= _dxfccss + _dxfccstacksize - 1) _CCABORT; } #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Entering state %d\n", _dxfccstate); #endif goto _dxfccbackup; _dxfccbackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* _dxfccresume: */ /* First try to decide what to do without reference to lookahead token. */ _dxfccn = _dxfccpact[_dxfccstate]; if (_dxfccn == _CCFLAG) goto _dxfccdefault; /* Not known => get a lookahead token if don't already have one. */ /* _dxfccchar is either _CCEMPTY or _CCEOF or a valid token in external form. */ if (_dxfccchar == _CCEMPTY) { #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Reading a token: "); #endif _dxfccchar = _CCLEX; } /* Convert token to internal form (in _dxfccchar1) for indexing tables with */ if (_dxfccchar <= 0) /* This means end of input. */ { _dxfccchar1 = 0; _dxfccchar = _CCEOF; /* Don't call _CCLEX any more */ #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { _dxfccchar1 = _CCTRANSLATE(_dxfccchar); #if _CCDEBUG != 0 if (_dxfccdebug) { fprintf (stderr, "Next token is %d (%s", _dxfccchar, _dxfcctname[_dxfccchar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef _CCPRINT _CCPRINT (stderr, _dxfccchar, _dxfcclval); #endif fprintf (stderr, ")\n"); } #endif } _dxfccn += _dxfccchar1; if (_dxfccn < 0 || _dxfccn > _CCLAST || _dxfcccheck[_dxfccn] != _dxfccchar1) goto _dxfccdefault; _dxfccn = _dxfcctable[_dxfccn]; /* _dxfccn is what to do for this token type in this state. Negative => reduce, -_dxfccn is rule number. Positive => shift, _dxfccn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (_dxfccn < 0) { if (_dxfccn == _CCFLAG) goto _dxfccerrlab; _dxfccn = -_dxfccn; goto _dxfccreduce; } else if (_dxfccn == 0) goto _dxfccerrlab; if (_dxfccn == _CCFINAL) _CCACCEPT; /* Shift the lookahead token. */ #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Shifting token %d (%s), ", _dxfccchar, _dxfcctname[_dxfccchar1]); #endif /* Discard the token being shifted unless it is eof. */ if (_dxfccchar != _CCEOF) _dxfccchar = _CCEMPTY; *++_dxfccvsp = _dxfcclval; #ifdef _CCLSP_NEEDED *++_dxfcclsp = _dxfcclloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (_dxfccerrstatus) _dxfccerrstatus--; _dxfccstate = _dxfccn; goto _dxfccnewstate; /* Do the default action for the current state. */ _dxfccdefault: _dxfccn = _dxfccdefact[_dxfccstate]; if (_dxfccn == 0) goto _dxfccerrlab; /* Do a reduction. _dxfccn is the number of a rule to reduce with. */ _dxfccreduce: _dxfcclen = _dxfccr2[_dxfccn]; if (_dxfcclen > 0) _dxfccval = _dxfccvsp[1-_dxfcclen]; /* implement default value of the action */ #if _CCDEBUG != 0 if (_dxfccdebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", _dxfccn, _dxfccrline[_dxfccn]); /* Print the symbols being reduced, and their result. */ for (i = _dxfccprhs[_dxfccn]; _dxfccrhs[i] > 0; i++) fprintf (stderr, "%s ", _dxfcctname[_dxfccrhs[i]]); fprintf (stderr, " -> %s\n", _dxfcctname[_dxfccr1[_dxfccn]]); } #endif switch (_dxfccn) { case 1: #line 115 "_compparse.y" { _dxdparseError = 0; ; break;} case 2: #line 117 "_compparse.y" { if (_dxdparseError) { if (_dxfccvsp[-1].a) { _dxfComputeFreeTree(_dxfccvsp[-1].a); } _dxdcomputeTree = NULL; _CCABORT; } _dxdcomputeTree = _dxfMakeList(NT_TOP, _dxfccvsp[-1].a); _CCACCEPT; ; break;} case 3: #line 134 "_compparse.y" { _dxfccval.a->next = NULL; ; break;} case 4: #line 138 "_compparse.y" { _dxfccval.a = _dxfccvsp[0].a; ; break;} case 5: #line 142 "_compparse.y" { PTreeNode *t = _dxfccvsp[-2].a; while (t->next != NULL) t = t->next; t->next = _dxfccvsp[0].a; _dxfccval.a = _dxfccvsp[-2].a; ; break;} case 6: #line 150 "_compparse.y" { PTreeNode *t = _dxfccvsp[-1].a; while (t->next != NULL) t = t->next; t->next = NULL; _dxfccval.a = _dxfccvsp[-1].a; ; break;} case 7: #line 161 "_compparse.y" { _dxfccval.a = _dxfMakeInput(_dxfccvsp[0].i); ; break;} case 8: #line 165 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_PERIOD, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 9: #line 169 "_compparse.y" { PTreeNode *pt; pt = _dxfMakeArg(NT_CONSTANT); pt->metaType.items = 1; pt->metaType.type = TYPE_INT; pt->metaType.category = CATEGORY_REAL; if (strcmp (_dxfccvsp[0].s, "x") == 0) { pt->u.i = 0; } else if (strcmp (_dxfccvsp[0].s, "y") == 0) { pt->u.i = 1; } else if (strcmp (_dxfccvsp[0].s, "z") == 0) { pt->u.i = 2; } else { DXSetError(ERROR_BAD_PARAMETER, "#12100", "syntax error"); _dxdparseError++; _CCERROR; } _dxfccval.a = _dxfMakeBinOp(OPER_PERIOD, _dxfccvsp[-2].a, pt); ; break;} case 11: #line 194 "_compparse.y" { _dxfccval.a = _dxfccvsp[-1].a; ; break;} case 12: #line 198 "_compparse.y" { _dxfccval.a = _dxfMakeList (NT_CONSTRUCT, _dxfccvsp[-1].a); ; break;} case 13: #line 203 "_compparse.y" { /* It must be a function id */ if (_dxfComputeLookupFunction (_dxfccvsp[-3].s) == NT_ERROR) { DXSetError(ERROR_BAD_PARAMETER, "#12090", _dxfccvsp[-3].s); _dxdparseError++; _CCERROR; } else { _dxfccval.a = _dxfMakeFunCall(_dxfccvsp[-3].s, _dxfccvsp[-1].a); if (_dxfccval.a == NULL) { _dxdparseError++; _CCERROR; } } ; break;} case 14: #line 221 "_compparse.y" { _dxfccval.a = _dxfMakeFunCall("mod", _dxfccvsp[-1].a); if (_dxfccval.a == NULL) { _dxdparseError++; _CCERROR; } ; break;} case 15: #line 230 "_compparse.y" { _dxfccval.a = _dxfMakeFunCall("dot", _dxfccvsp[-1].a); if (_dxfccval.a == NULL) { _dxdparseError++; _CCERROR; } ; break;} case 16: #line 239 "_compparse.y" { _dxfccval.a = _dxfMakeFunCall("cross", _dxfccvsp[-1].a); if (_dxfccval.a == NULL) { _dxdparseError++; _CCERROR; } ; break;} case 17: #line 247 "_compparse.y" { _dxfccval.a = _dxfMakeConditional(_dxfccvsp[-4].a, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 18: #line 251 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_AND, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 19: #line 255 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_OR, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 20: #line 259 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_GT, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 21: #line 263 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_GE, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 22: #line 267 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_LT, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 23: #line 271 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_LE, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 24: #line 275 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_EQ, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 25: #line 279 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_NE, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 26: #line 283 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_PLUS, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 27: #line 287 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_MINUS, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 28: #line 291 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_MUL, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 29: #line 295 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_DIV, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 30: #line 299 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_MOD, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 31: #line 303 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_DOT, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 32: #line 307 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_CROSS, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 33: #line 311 "_compparse.y" { _dxfccval.a = _dxfMakeBinOp(OPER_EXP, _dxfccvsp[-2].a, _dxfccvsp[0].a); ; break;} case 34: #line 315 "_compparse.y" { _dxfccval.a = _dxfMakeUnOp(OPER_MINUS, _dxfccvsp[0].a); ; break;} case 35: #line 319 "_compparse.y" { _dxfccval.a = _dxfccvsp[0].a; ; break;} case 36: #line 323 "_compparse.y" { _dxfccval.a = _dxfMakeUnOp (OPER_NOT, _dxfccvsp[0].a); ; break;} case 37: #line 327 "_compparse.y" { _dxfccval.a = _dxfMakeAssignment (_dxfccvsp[-2].s, _dxfccvsp[0].a); ; break;} case 38: #line 331 "_compparse.y" { _dxfccval.a = _dxfMakeVariable (_dxfccvsp[0].s); ; break;} case 39: #line 338 "_compparse.y" { _dxfccval.a = NULL; ; break;} case 41: #line 346 "_compparse.y" { _dxfccval.a->next = NULL; ; break;} case 42: #line 350 "_compparse.y" { PTreeNode *t = _dxfccvsp[-2].a; while (t->next != NULL) t = t->next; t->next = _dxfccvsp[0].a; _dxfccval.a = _dxfccvsp[-2].a; ; break;} case 43: #line 362 "_compparse.y" { _dxfccval.a->next = NULL; ; break;} case 44: #line 366 "_compparse.y" { PTreeNode *t = _dxfccvsp[-2].a; while (t->next != NULL) t = t->next; t->next = _dxfccvsp[0].a; _dxfccval.a = _dxfccvsp[-2].a; ; break;} case 46: #line 389 "_compparse.y" { _dxfccval.a = _dxfMakeArg(NT_CONSTANT); _dxfccval.a->metaType.items = 1; _dxfccval.a->metaType.type = TYPE_INT; _dxfccval.a->metaType.category = CATEGORY_REAL; _dxfccval.a->u.i = _dxfccvsp[0].i; ; break;} case 47: #line 397 "_compparse.y" { _dxfccval.a = _dxfMakeArg(NT_CONSTANT); _dxfccval.a->metaType.items = 1; _dxfccval.a->metaType.type = TYPE_FLOAT; _dxfccval.a->metaType.category = CATEGORY_REAL; _dxfccval.a->u.f = _dxfccvsp[0].f; ; break;} case 48: #line 405 "_compparse.y" { _dxfccval.a = _dxfMakeArg(NT_CONSTANT); _dxfccval.a->metaType.items = 1; _dxfccval.a->metaType.type = TYPE_DOUBLE; _dxfccval.a->metaType.category = CATEGORY_REAL; _dxfccval.a->u.d = _dxfccvsp[0].d; ; break;} case 49: #line 413 "_compparse.y" { _dxfccval.a = _dxfMakeArg(NT_CONSTANT); _dxfccval.a->metaType.items = 1; _dxfccval.a->metaType.type = TYPE_STRING; _dxfccval.a->metaType.category = CATEGORY_REAL; _dxfccval.a->metaType.rank = 1; _dxfccval.a->metaType.shape[0] = strlen(_dxfccvsp[0].s)+1; strcpy(_dxfccval.a->u.s, _dxfccvsp[0].s); ; break;} } /* the action file gets copied in in place of this dollarsign */ #line 542 "/usr/local/share/bison.simple" _dxfccvsp -= _dxfcclen; _dxfccssp -= _dxfcclen; #ifdef _CCLSP_NEEDED _dxfcclsp -= _dxfcclen; #endif #if _CCDEBUG != 0 if (_dxfccdebug) { short *ssp1 = _dxfccss - 1; fprintf (stderr, "state stack now"); while (ssp1 != _dxfccssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++_dxfccvsp = _dxfccval; #ifdef _CCLSP_NEEDED _dxfcclsp++; if (_dxfcclen == 0) { _dxfcclsp->first_line = _dxfcclloc.first_line; _dxfcclsp->first_column = _dxfcclloc.first_column; _dxfcclsp->last_line = (_dxfcclsp-1)->last_line; _dxfcclsp->last_column = (_dxfcclsp-1)->last_column; _dxfcclsp->text = 0; } else { _dxfcclsp->last_line = (_dxfcclsp+_dxfcclen-1)->last_line; _dxfcclsp->last_column = (_dxfcclsp+_dxfcclen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ _dxfccn = _dxfccr1[_dxfccn]; _dxfccstate = _dxfccpgoto[_dxfccn - _CCNTBASE] + *_dxfccssp; if (_dxfccstate >= 0 && _dxfccstate <= _CCLAST && _dxfcccheck[_dxfccstate] == *_dxfccssp) _dxfccstate = _dxfcctable[_dxfccstate]; else _dxfccstate = _dxfccdefgoto[_dxfccn - _CCNTBASE]; goto _dxfccnewstate; _dxfccerrlab: /* here on detecting error */ if (! _dxfccerrstatus) /* If not already recovering from an error, report this error. */ { ++_dxfccnerrs; #ifdef _CCERROR_VERBOSE _dxfccn = _dxfccpact[_dxfccstate]; if (_dxfccn > _CCFLAG && _dxfccn < _CCLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -_dxfccn if nec to avoid negative indexes in _dxfcccheck. */ for (x = (_dxfccn < 0 ? -_dxfccn : 0); x < (sizeof(_dxfcctname) / sizeof(char *)); x++) if (_dxfcccheck[x + _dxfccn] == x) size += strlen(_dxfcctname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (_dxfccn < 0 ? -_dxfccn : 0); x < (sizeof(_dxfcctname) / sizeof(char *)); x++) if (_dxfcccheck[x + _dxfccn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, _dxfcctname[x]); strcat(msg, "'"); count++; } } _dxfccerror(msg); free(msg); } else _dxfccerror ("parse error; also virtual memory exceeded"); } else #endif /* _CCERROR_VERBOSE */ _dxfccerror("parse error"); } goto _dxfccerrlab1; _dxfccerrlab1: /* here on error raised explicitly by an action */ if (_dxfccerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (_dxfccchar == _CCEOF) _CCABORT; #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Discarding token %d (%s).\n", _dxfccchar, _dxfcctname[_dxfccchar1]); #endif _dxfccchar = _CCEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ _dxfccerrstatus = 3; /* Each real token shifted decrements this */ goto _dxfccerrhandle; _dxfccerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ _dxfccn = _dxfccdefact[_dxfccstate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (_dxfccn) goto _dxfccdefault; #endif _dxfccerrpop: /* pop the current state because it cannot handle the error token */ if (_dxfccssp == _dxfccss) _CCABORT; _dxfccvsp--; _dxfccstate = *--_dxfccssp; #ifdef _CCLSP_NEEDED _dxfcclsp--; #endif #if _CCDEBUG != 0 if (_dxfccdebug) { short *ssp1 = _dxfccss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != _dxfccssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif _dxfccerrhandle: _dxfccn = _dxfccpact[_dxfccstate]; if (_dxfccn == _CCFLAG) goto _dxfccerrdefault; _dxfccn += _CCTERROR; if (_dxfccn < 0 || _dxfccn > _CCLAST || _dxfcccheck[_dxfccn] != _CCTERROR) goto _dxfccerrdefault; _dxfccn = _dxfcctable[_dxfccn]; if (_dxfccn < 0) { if (_dxfccn == _CCFLAG) goto _dxfccerrpop; _dxfccn = -_dxfccn; goto _dxfccreduce; } else if (_dxfccn == 0) goto _dxfccerrpop; if (_dxfccn == _CCFINAL) _CCACCEPT; #if _CCDEBUG != 0 if (_dxfccdebug) fprintf(stderr, "Shifting error token, "); #endif *++_dxfccvsp = _dxfcclval; #ifdef _CCLSP_NEEDED *++_dxfcclsp = _dxfcclloc; #endif _dxfccstate = _dxfccn; goto _dxfccnewstate; _dxfccacceptlab: /* _CCACCEPT comes here. */ if (_dxfccfree_stacks) { free (_dxfccss); free (_dxfccvs); #ifdef _CCLSP_NEEDED free (_dxfccls); #endif } return 0; _dxfccabortlab: /* _CCABORT comes here. */ if (_dxfccfree_stacks) { free (_dxfccss); free (_dxfccvs); #ifdef _CCLSP_NEEDED free (_dxfccls); #endif } return 1; } #line 424 "_compparse.y" _dxfccerror(char *s) { if (DXGetError() == ERROR_NONE) { DXSetError(ERROR_BAD_PARAMETER, "#12100", s, _dxfcclexerror()); } _dxdparseError++; }