📄 dal.c
字号:
/* A Bison parser, made by GNU Bison 1.875c. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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. *//* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. *//* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. *//* Identify Bison output. */#define YYBISON 1/* Skeleton name. */#define YYSKELETON_NAME "yacc.c"/* Pure parsers. */#define YYPURE 0/* Using locations. */#define YYLSP_NEEDED 0/* Tokens. */#ifndef YYTOKENTYPE# define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { T_WHILEOK = 258, T_EXIT = 259, T_PRINT = 260, T_INPUT = 261, T_ABORT = 262, T_SCHEMA = 263, T_CURRENCY = 264, T_REWIND = 265, T_IDENT = 266, T_STRING = 267 };#endif#define T_WHILEOK 258#define T_EXIT 259#define T_PRINT 260#define T_INPUT 261#define T_ABORT 262#define T_SCHEMA 263#define T_CURRENCY 264#define T_REWIND 265#define T_IDENT 266#define T_STRING 267/* Copy the first part of user declarations. */#line 1 "dal.y"/*************************************************************************** * * * db.* * * open source database, dal utility * * * * Copyright (c) 2000 Centura Software Corporation. All rights reserved. * * * * Use of this software, whether in source code format, or in executable, * * binary object code form, is governed by the CENTURA OPEN SOURCE LICENSE * * which is fully described in the LICENSE.TXT file, included within this * * distribution of source code files. * * * **************************************************************************/#include "db.star.h"#include "parser.h"#include "daldef.h"#include "dalvar.h"#if defined(UNICODE)#define yyerror(s) yyerror(L ## s)#endifextern int line;static int nparams;static DB_TCHAR fld[3][NAMELEN];static struct printfield prflds;/* QNX yacc and bison (GNU) take care of this */#if !defined(QNX) && !defined(VXWORKS) && !defined(yyerrok) && !defined(YYBISON)#define yyerrok yyerrflag = 0#endif/* Enabling traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages. */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 41 "dal.y"typedef union YYSTYPE { STRTOK tstr; NUMTOK tnum;} YYSTYPE;/* Line 191 of yacc.c. */#line 143 "dal.c"# define yystype YYSTYPE /* obsolescent; will be withdrawn */# define YYSTYPE_IS_DECLARED 1# define YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations. *//* Line 214 of yacc.c. */#line 155 "dal.c"#if ! defined (yyoverflow) || YYERROR_VERBOSE# ifndef YYFREE# define YYFREE free# endif# ifndef YYMALLOC# define YYMALLOC malloc# endif/* The parser invokes alloca or malloc; define the necessary symbols. */# ifdef YYSTACK_USE_ALLOCA# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# endif# else# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# endif# endif# endif# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else# if defined (__STDC__) || defined (__cplusplus)# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t# endif# define YYSTACK_ALLOC YYMALLOC# define YYSTACK_FREE YYFREE# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member. */union yyalloc{ short yyss; YYSTYPE yyvs; };/* The size of the maximum gap between one aligned stack and the next. */# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with N elements. */# define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */# ifndef YYCOPY# if defined (__GNUC__) && 1 < __GNUC__# define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))# else# define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0)# endif# endif/* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0)#endif#if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char;#else typedef short yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL 35/* YYLAST -- Last index in YYTABLE. */#define YYLAST 82/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 20/* YYNNTS -- Number of nonterminals. */#define YYNNTS 20/* YYNRULES -- Number of rules. */#define YYNRULES 47/* YYNRULES -- Number of states. */#define YYNSTATES 80/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 267#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */static const unsigned char yytranslate[] ={ 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, 18, 19, 2, 2, 16, 2, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 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, 13, 2, 14, 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, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */static const unsigned char yyprhs[] ={ 0, 0, 3, 6, 8, 10, 13, 15, 17, 19, 21, 23, 25, 28, 33, 38, 40, 46, 53, 58, 62, 64, 65, 67, 71, 77, 84, 86, 90, 92, 96, 103, 105, 107, 109, 111, 113, 115, 119, 121, 125, 127, 131, 134, 138, 142, 145, 148};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={ 21, 0, -1, 22, 39, -1, 39, -1, 23, -1, 22, 23, -1, 24, -1, 26, -1, 30, -1, 36, -1, 37, -1, 38, -1, 1, 15, -1, 25, 13, 22, 14, -1, 25, 13, 1, 14, -1, 3, -1, 27, 18, 28, 19, 15, -1, 27, 18, 28, 19, 1, 15, -1, 27, 18, 1, 15, -1, 27, 1, 15, -1, 11, -1, -1, 29, -1, 29, 16, 29, -1, 29, 16, 29, 16, 29, -1, 29, 16, 29, 16, 29, 16, -1, 11, -1, 11, 17, 11, -1, 12, -1, 32, 34, 15, -1, 32, 18, 31, 19, 34, 15, -1, 12, -1, 11, -1, 33, -1, 5, -1, 6, -1, 35, -1, 34, 16, 35, -1, 11, -1, 11, 17, 11, -1, 12, -1, 10, 31, 15, -1, 8, 15, -1, 8, 11, 15, -1, 8, 1, 15, -1, 9, 15, -1, 4, 15, -1, 7, 15, -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const unsigned short yyrline[] ={ 0, 56, 56, 57, 59, 69, 80, 81, 82, 83, 84, 85, 86, 91, 102, 110, 134, 142, 147, 152, 158, 176, 177, 182, 189, 198, 204, 209, 214, 221, 229, 239, 240, 242, 258, 262, 267, 276, 286, 291, 296, 302, 324, 328, 332, 338, 359, 365};#endif#if YYDEBUG || YYERROR_VERBOSE/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */static const char *const yytname[] ={ "$end", "error", "$undefined", "T_WHILEOK", "T_EXIT", "T_PRINT", "T_INPUT", "T_ABORT", "T_SCHEMA", "T_CURRENCY", "T_REWIND", "T_IDENT", "T_STRING", "'{'", "'}'", "';'", "','", "'.'", "'('", "')'", "$accept", "dal_gram", "stmts", "stmt", "whileok", "whilestart", "fcn_call", "fcnstart", "params", "param", "io", "filespec", "iostart", "iocom", "flds", "fld", "rewind", "schema", "currency", "end_mark", 0};#endif# ifdef YYPRINT/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */static const unsigned short yytoknum[] ={ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 123, 125, 59, 44, 46, 40, 41};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */static const unsigned char yyr1[] ={ 0, 20, 21, 21, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 25, 26, 26, 26, 26, 27, 28, 28, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 35, 36, 37, 37, 37, 38, 39, 39};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */static const unsigned char yyr2[] ={ 0, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4, 4, 1, 5, 6, 4, 3, 1, 0, 1, 3, 5, 6, 1, 3, 1, 3, 6, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 2, 3, 3, 2, 2, 2};/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */static const unsigned char yydefact[] ={ 0, 0, 15, 0, 34, 35, 0, 0, 0, 0, 20, 0, 0, 4, 6, 0, 7, 0, 8, 0, 33, 9, 10, 11, 3, 12, 46, 47, 0, 0, 42, 45, 32, 31, 0, 1, 5, 2, 0, 0, 0, 38, 40, 0, 0, 36, 44, 43, 41, 0, 0, 19, 0, 26, 28, 0, 22, 0, 0, 29, 0, 14, 13, 18, 0, 0, 0, 39, 0, 37, 27, 0, 16, 23, 0, 17, 0, 30, 24, 25};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={ -1, 11, 12, 13, 14, 15, 16, 17, 55, 56, 18, 34, 19, 20, 44, 45, 21, 22, 23, 24};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */#define YYPACT_NINF -62static const yysigned_char yypact[] ={ 36, 7, -62, 9, -62, -62, 12, 3, 34, -3, -62, 10, 36, -62, -62, 4, -62, 2, -62, -5, -62, -62, -62, -62, -62, -62, -62, -62, 39, 51, -62, -62, -62, -62, 52, -62, -62, -62, 47, 53, 0, 46, -62, -3, 17, -62, -62, -62, -62, 21, 20, -62, 54, 55, -62, 32, 57, 59, 56, -62, 48, -62, -62, -62, 60, 1, 50, -62, 48, -62, -62, 61, -62, 58, 49, -62, 50, -62, 62, -62};/* YYPGOTO[NTERM-NUM]. */static const yysigned_char yypgoto[] ={ -62, -62, 41, -12, -62, -62, -62, -62, -62, -61, -62, 37, -62, -62, 13, 22, -62, -62, -62, 65};/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */#define YYTABLE_NINF -22static const yysigned_char yytable[] ={ 36, 52, 71, 39, 28, 73, 41, 42, 32, 33, 35, 53, 54, 43, 29, 78, 72, 38, 30, -21, 40, 1, 25, 2, 26, 4, 5, 27, 7, 8, 9, 10, 59, 60, 62, 61, 25, 1, 36, 2, 3, 4, 5, 6, 7, 8, 9, 10, 49, 31, 2, 65, 4, 5, 46, 7, 8, 9, 10, 41, 42, 53, 54, 57, 77, 60, 47, 48, 51, 63, 67, 70, 64, 66, 76, 68, 75, 37, 79, 50, 58, 74, 69};static const unsigned char yycheck[] ={ 12, 1, 1, 1, 1, 66, 11, 12, 11, 12, 0, 11, 12, 18, 11, 76, 15, 13, 15, 19, 18, 1, 15, 3, 15, 5, 6, 15, 8, 9, 10, 11, 15, 16, 14, 14, 15, 1, 50, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 15, 3, 19, 5, 6, 15, 8, 9, 10, 11, 11, 12, 11, 12, 17, 15, 16, 15, 15, 15, 15, 11, 11, 17, 16, 16, 19, 15, 12, 16, 38, 43, 68, 60};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */static const unsigned char yystos[] ={ 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22, 23, 24, 25, 26, 27, 30, 32, 33, 36, 37, 38, 39, 15, 15, 15, 1, 11, 15, 15, 11, 12, 31, 0, 23, 39, 13, 1, 18, 11, 12, 18, 34, 35, 15, 15, 15, 1, 22, 15, 1, 11, 12, 28, 29, 17, 31, 15, 16, 14, 14, 15, 17, 19, 16, 11, 19, 35, 11, 1, 15, 29, 34, 15, 16, 15, 29, 16};#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)# define YYSIZE_T __SIZE_TYPE__#endif#if ! defined (YYSIZE_T) && defined (size_t)# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T)# if defined (__STDC__) || defined (__cplusplus)# include <stddef.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t# endif#endif#if ! defined (YYSIZE_T)# define YYSIZE_T unsigned int#endif#define yyerrok (yyerrstatus = 0)#define yyclearin (yychar = YYEMPTY)#define YYEMPTY (-2)#define YYEOF 0#define YYACCEPT goto yyacceptlab#define YYABORT goto yyabortlab#define YYERROR goto yyerrorlab/* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */#define YYFAIL goto yyerrlab#define YYRECOVERING() (!!yyerrstatus)#define YYBACKUP(Token, Value) \do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up");\ YYERROR; \ } \while (0)#define YYTERROR 1#define YYERRCODE 256/* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). */#ifndef YYLLOC_DEFAULT# define YYLLOC_DEFAULT(Current, Rhs, N) \ ((Current).first_line = (Rhs)[1].first_line, \ (Current).first_column = (Rhs)[1].first_column, \ (Current).last_line = (Rhs)[N].last_line, \ (Current).last_column = (Rhs)[N].last_column)#endif/* YYLEX -- calling `yylex' with the right arguments. */#ifdef YYLEX_PARAM# define YYLEX yylex (YYLEX_PARAM)#else# define YYLEX yylex ()#endif/* Enable debugging if requested. */#if YYDEBUG# ifndef YYFPRINTF# include <stdio.h> /* INFRINGES ON USER NAME SPACE */# define YYFPRINTF fprintf# endif# define YYDPRINTF(Args) \do { \ if (yydebug) \ YYFPRINTF Args; \} while (0)# define YYDSYMPRINT(Args) \do { \ if (yydebug) \ yysymprint Args; \} while (0)# define YYDSYMPRINTF(Title, Token, Value, Location) \do { \ if (yydebug) \ { \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -