📄 parser.c
字号:
/* A Bison parser, made by GNU Bison 2.1. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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/* Bison version. */#define YYBISON_VERSION "2.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 { K_OPTIONS = 258, K_DEVICE = 259, K_AUTOINIT = 260, K_SECURITY = 261, K_PAIRING = 262, K_PTYPE = 263, K_NAME = 264, K_CLASS = 265, K_VOICE = 266, K_INQMODE = 267, K_PAGETO = 268, K_LM = 269, K_LP = 270, K_AUTH = 271, K_ENCRYPT = 272, K_ISCAN = 273, K_PSCAN = 274, K_PINHELP = 275, K_DBUSPINHELP = 276, K_YES = 277, K_NO = 278, WORD = 279, PATH = 280, STRING = 281, LIST = 282, HCI = 283, BDADDR = 284, NUM = 285 };#endif/* Tokens. */#define K_OPTIONS 258#define K_DEVICE 259#define K_AUTOINIT 260#define K_SECURITY 261#define K_PAIRING 262#define K_PTYPE 263#define K_NAME 264#define K_CLASS 265#define K_VOICE 266#define K_INQMODE 267#define K_PAGETO 268#define K_LM 269#define K_LP 270#define K_AUTH 271#define K_ENCRYPT 272#define K_ISCAN 273#define K_PSCAN 274#define K_PINHELP 275#define K_DBUSPINHELP 276#define K_YES 277#define K_NO 278#define WORD 279#define PATH 280#define STRING 281#define LIST 282#define HCI 283#define BDADDR 284#define NUM 285/* Copy the first part of user declarations. */#line 1 "parser.y"/* * * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> * Copyright (C) 2002-2006 Marcel Holtmann <marcel@holtmann.org> * * * 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#include <errno.h>#include <stdlib.h>#include <string.h>#include <syslog.h>#include <stdarg.h>#include <sys/socket.h>#include <asm/types.h>#include <bluetooth/bluetooth.h>#include <bluetooth/hci.h>#include <bluetooth/hci_lib.h>#include "hcid.h"#include "kword.h"int cfg_error(const char *fmt, ...);int yyparse(void);int yylex(void);int yyerror(char *s); /* 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/* Enabling the token table. */#ifndef YYTOKEN_TABLE# define YYTOKEN_TABLE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 56 "parser.y"typedef union YYSTYPE { char *str; long num;} YYSTYPE;/* Line 196 of yacc.c. */#line 205 "parser.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 219 of yacc.c. */#line 217 "parser.c"#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) && (defined (__STDC__) || defined (__cplusplus))# include <stddef.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t#endif#if ! defined (YYSIZE_T)# define YYSIZE_T unsigned int#endif#ifndef YY_# if YYENABLE_NLS# if ENABLE_NLS# include <libintl.h> /* INFRINGES ON USER NAME SPACE */# define YY_(msgid) dgettext ("bison-runtime", msgid)# endif# endif# ifndef YY_# define YY_(msgid) msgid# endif#endif#if ! defined (yyoverflow) || YYERROR_VERBOSE/* The parser invokes alloca or malloc; define the necessary symbols. */# ifdef YYSTACK_USE_ALLOCA# if YYSTACK_USE_ALLOCA# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# else# define YYSTACK_ALLOC alloca# if defined (__STDC__) || defined (__cplusplus)# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */# define YYINCLUDED_STDLIB_H# endif# endif# endif# endif# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */# endif# else# define YYSTACK_ALLOC YYMALLOC# define YYSTACK_FREE YYFREE# ifndef YYSTACK_ALLOC_MAXIMUM# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)# endif# ifdef __cplusplusextern "C" {# endif# ifndef YYMALLOC# define YYMALLOC malloc# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus)))void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */# endif# endif# ifndef YYFREE# define YYFREE free# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ && (defined (__STDC__) || defined (__cplusplus)))void free (void *); /* INFRINGES ON USER NAME SPACE */# endif# endif# ifdef __cplusplus}# endif# 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 int 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 int) + 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 \ { \ 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 int yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL 14/* YYLAST -- Last index in YYTABLE. */#define YYLAST 89/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 34/* YYNNTS -- Number of nonterminals. */#define YYNNTS 19/* YYNRULES -- Number of rules. */#define YYNRULES 54/* YYNRULES -- Number of states. */#define YYNSTATES 82/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 285#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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 33, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 31, 2, 32, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */static const unsigned char yyprhs[] ={ 0, 0, 3, 5, 8, 11, 14, 16, 18, 20, 23, 26, 30, 31, 34, 37, 41, 44, 47, 50, 53, 55, 57, 59, 61, 63, 67, 68, 71, 74, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={ 35, 0, -1, 36, -1, 35, 36, -1, 3, 38, -1, 37, 43, -1, 24, -1, 1, -1, 4, -1, 4, 47, -1, 4, 48, -1, 31, 39, 32, -1, -1, 40, 33, -1, 1, 33, -1, 39, 40, 33, -1, 5, 52, -1, 6, 41, -1, 7, 42, -1, 20, 25, -1, 21, -1, 24, -1, 24, -1, 23, -1, 24, -1, 31, 44, 32, -1, -1, 45, 33, -1, 1, 33, -1, 44, 45, 33, -1, 8, 49, -1, 14, 50, -1, 15, 51, -1, 9, 46, -1, 10, 30, -1, 11, 30, -1, 12, 30, -1, 13, 30, -1, 16, 52, -1, 17, 52, -1, 18, 52, -1, 19, 52, -1, 24, -1, 24, -1, 26, -1, 28, -1, 29, -1, 24, -1, 27, -1, 24, -1, 27, -1, 24, -1, 27, -1, 22, -1, 23, -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const unsigned short int yyrline[] ={ 0, 74, 74, 74, 76, 78, 80, 84, 90, 94, 98, 103, 104, 104, 104, 104, 106, 110, 114, 118, 125, 132, 138, 147, 153, 164, 165, 165, 165, 165, 167, 172, 177, 182, 189, 194, 199, 204, 209, 213, 217, 224, 231, 238, 242, 248, 254, 260, 267, 276, 283, 292, 299, 307, 307};#endif#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE/* YYTNAME[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", "K_OPTIONS", "K_DEVICE", "K_AUTOINIT", "K_SECURITY", "K_PAIRING", "K_PTYPE", "K_NAME", "K_CLASS", "K_VOICE", "K_INQMODE", "K_PAGETO", "K_LM", "K_LP", "K_AUTH", "K_ENCRYPT", "K_ISCAN", "K_PSCAN", "K_PINHELP", "K_DBUSPINHELP", "K_YES", "K_NO", "WORD", "PATH", "STRING", "LIST", "HCI", "BDADDR", "NUM", "'{'", "'}'", "';'", "$accept", "config", "statement", "device", "hcid_options", "hcid_opts", "hcid_opt", "sec_mode", "pair_mode", "device_options", "device_opts", "device_opt", "dev_name", "hci", "bdaddr", "pkt_type", "link_mode", "link_policy", "bool", 0};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -