⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.c

📁 Bluezan implementation of the Bluetooth&#8482 wireless standards specifications for Linux. The code
💻 C
📖 第 1 页 / 共 3 页
字号:
/* A Bison parser, made by GNU Bison 1.875d.  *//* Skeleton parser for Yacc-like parsing with Bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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 {     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#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-2005  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 version 2 as *  published by the Free Software Foundation; * *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. *  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY *  CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES  *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN  *  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  *  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * *  ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,  *  COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS  *  SOFTWARE IS DISCLAIMED. * * *  $Id: parser.y,v 1.15 2005/05/06 13:51:17 holtmann Exp $ */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.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#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 60 "parser.y"typedef union YYSTYPE {	char *str;	long  num;} YYSTYPE;/* Line 191 of yacc.c.  */#line 200 "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 214 of yacc.c.  */#line 212 "parser.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 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					\	{					\	  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 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,    78,    78,    78,    80,    82,    84,    88,    94,    98,     102,   107,   108,   108,   108,   108,   110,   114,   118,   122,     129,   136,   142,   151,   157,   168,   169,   169,   169,   169,     171,   176,   181,   186,   193,   198,   203,   208,   213,   217,     221,   228,   235,   242,   246,   252,   258,   264,   271,   280,     287,   296,   303,   311,   311};#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", "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};#endif# ifdef YYPRINT/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to   token YYLEX-NUM.  */static const unsigned short int yytoknum[] ={       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,     285,   123,   125,    59};# endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */static const unsigned char yyr1[] ={       0,    34,    35,    35,    36,    36,    36,    36,    37,    37,      37,    38,    39,    39,    39,    39,    40,    40,    40,    40,      40,    40,    41,    41,    42,    43,    44,    44,    44,    44,      45,    45,    45,    45,    45,    45,    45,    45,    45,    45,      45,    45,    45,    46,    46,    47,    48,    49,    49,    50,      50,    51,    51,    52,    52};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */static const unsigned char yyr2[] ={       0,     2,     1,     2,     2,     2,     1,     1,     1,     2,       2,     3,     0,     2,     2,     3,     2,     2,     2,     2,       1,     1,     1,     1,     1,     3,     0,     2,     2,     3,       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,       2,     2,     1,     1,     1,     1,     1,     1,     1,     1,       1,     1,     1,     1,     1};/* 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,     7,     0,     8,     6,     0,     2,     0,     0,     4,      45,    46,     9,    10,     1,     3,     0,     5,     0,     0,       0,     0,     0,    20,    21,     0,     0,     0,     0,     0,       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,      42,     0,     0,    14,    53,    54,    16,    23,    22,    17,      24,    18,    19,    11,     0,    13,    28,    47,    48,    30,      43,    44,    33,    34,    35,    36,    37,    49,    50,    31,      51,    52,    32,    38,    39,    40,    41,    25,     0,    27,      15,    29};/* YYDEFGOTO[NTERM-NUM]. */static const yysigned_char yydefgoto[] ={      -1,     5,     6,     7,     9,    25,    26,    49,    51,    17,      41,    42,    62,    12,    13,    59,    69,    72,    46};/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing   STATE-NUM.  */#define YYPACT_NINF -36static const yysigned_char yypact[] ={      18,   -36,    -3,   -23,   -36,    54,   -36,    16,    19,   -36,     -36,   -36,   -36,   -36,   -36,   -36,    -1,   -36,    12,    51,      13,    26,    31,   -36,   -36,    28,    42,    43,     3,    20,      23,    29,    49,    50,     5,    14,    51,    51,    51,    51,     -36,    53,    48,   -36,   -36,   -36,   -36,   -36,   -36,   -36,     -36,   -36,   -36,   -36,    55,   -36,   -36,   -36,   -36,   -36,     -36,   -36,   -36,   -36,   -36,   -36,   -36,   -36,   -36,   -36,     -36,   -36,   -36,   -36,   -36,   -36,   -36,   -36,    56,   -36,     -36,   -36};/* YYPGOTO[NTERM-NUM].  */static const yysigned_char yypgoto[] ={     -36,   -36,    77,   -36,   -36,   -36,    58,   -36,   -36,   -36,     -36,    45,   -36,   -36,   -36,   -36,   -36,   -36,   -35};/* 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 -27static const yysigned_char yytable[] ={      27,    73,    74,    75,    76,    10,    11,    28,    29,    30,      31,    32,    33,    34,    35,    36,    37,    38,    39,     1,      18,     2,     3,    40,    19,    20,    21,    57,     8,    67,      58,   -26,    68,    19,    20,    21,    47,    48,    70,    22,      23,    71,     4,    24,    60,    43,    61,    16,    22,    23,      50,   -12,    24,    63,    14,     1,    52,     2,     3,    64,      53,    28,    29,    30,    31,    32,    33,    34,    35,    36,      37,    38,    39,    44,    45,    55,    56,    40,     4,    65,      66,    79,    15,    54,     0,    77,    78,     0,    80,    81};static const yysigned_char yycheck[] ={       1,    36,    37,    38,    39,    28,    29,     8,     9,    10,      11,    12,    13,    14,    15,    16,    17,    18,    19,     1,       1,     3,     4,    24,     5,     6,     7,    24,    31,    24,      27,    32,    27,     5,     6,     7,    23,    24,    24,    20,      21,    27,    24,    24,    24,    33,    26,    31,    20,    21,      24,    32,    24,    30,     0,     1,    25,     3,     4,    30,      32,     8,     9,    10,    11,    12,    13,    14,    15,    16,      17,    18,    19,    22,    23,    33,    33,    24,    24,    30,      30,    33,     5,    25,    -1,    32,    41,    -1,    33,    33};/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing   symbol of state STATE-NUM.  */static const unsigned char yystos[] ={       0,     1,     3,     4,    24,    35,    36,    37,    31,    38,      28,    29,    47,    48,     0,    36,    31,    43,     1,     5,       6,     7,    20,    21,    24,    39,    40,     1,     8,     9,      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,      24,    44,    45,    33,    22,    23,    52,    23,    24,    41,      24,    42,    25,    32,    40,    33,    33,    24,    27,    49,      24,    26,    46,    30,    30,    30,    30,    24,    27,    50,      24,    27,    51,    52,    52,    52,    52,    32,    45,    33,      33,    33};#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.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -