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

📄 gram.c

📁 C程序漏洞检查
💻 C
📖 第 1 页 / 共 5 页
字号:

/*  A Bison parser, made from gram.y with Bison version GNU Bison version 1.24
  */

#define YYBISON 1  /* Identify Bison output.  */

#define	IDENT	258
#define	STRING	259
#define	FIELD_NAME	260
#define	TYPEDEF_NAME	261
#define	TAG	262
#define	CHAR_CONST	263
#define	INUM	264
#define	RNUM	265
#define	COMMENT	266
#define	PP_LINE	267
#define	PP_INCLUDE	268
#define	PP_DEFINE	269
#define	PP_UNDEF	270
#define	PP_ERROR	271
#define	PP_IF	272
#define	PP_IFDEF	273
#define	PP_IFNDEF	274
#define	PP_ELSE	275
#define	PP_ELIF	276
#define	PP_ENDIF	277
#define	PP_IDENT	278
#define	PP_PRAGMA	279
#define	INVALID	280
#define	AUTO	281
#define	BREAK	282
#define	CASE	283
#define	CHAR	284
#define	CONST	285
#define	CONT	286
#define	DEFLT	287
#define	DO	288
#define	DOUBLE	289
#define	ELSE	290
#define	ENUM	291
#define	EXTRN	292
#define	IF	293
#define	FOR	294
#define	FLOAT	295
#define	GOTO	296
#define	INT	297
#define	LONG	298
#define	REGISTR	299
#define	RETURN	300
#define	SHORT	301
#define	SGNED	302
#define	STATIC	303
#define	STRUCT	304
#define	SWITCH	305
#define	TYPEDEF	306
#define	UNION	307
#define	UNSGNED	308
#define	VOID	309
#define	VOLATILE	310
#define	WHILE	311
#define	PLUS_EQ	312
#define	MINUS_EQ	313
#define	STAR_EQ	314
#define	DIV_EQ	315
#define	MOD_EQ	316
#define	B_NOT_EQ	317
#define	B_AND_EQ	318
#define	B_OR_EQ	319
#define	B_XOR_EQ	320
#define	L_SHIFT_EQ	321
#define	R_SHIFT_EQ	322
#define	EQUAL	323
#define	LESS_EQ	324
#define	GRTR_EQ	325
#define	NOT_EQ	326
#define	RPAREN	327
#define	RBRCKT	328
#define	LBRACE	329
#define	RBRACE	330
#define	SEMICOLON	331
#define	COMMA	332
#define	ELLIPSIS	333
#define	LB_SIGN	334
#define	DOUB_LB_SIGN	335
#define	BACKQUOTE	336
#define	AT	337
#define	DOLLAR	338
#define	CPP_INCLUDE	339
#define	CPP_DEFINE	340
#define	CPP_LINE	341
#define	COMMA_OP	342
#define	EQ	343
#define	ASSIGN	344
#define	QUESTMARK	345
#define	COLON	346
#define	COMMA_SEP	347
#define	OR	348
#define	AND	349
#define	B_OR	350
#define	B_XOR	351
#define	B_AND	352
#define	COMP_EQ	353
#define	COMP_ARITH	354
#define	LESS	355
#define	GRTR	356
#define	L_SHIFT	357
#define	R_SHIFT	358
#define	PLUS	359
#define	MINUS	360
#define	STAR	361
#define	DIV	362
#define	MOD	363
#define	CAST	364
#define	UNARY	365
#define	NOT	366
#define	B_NOT	367
#define	SIZEOF	368
#define	ALIGNOF	369
#define	INCR	370
#define	DECR	371
#define	HYPERUNARY	372
#define	ARROW	373
#define	DOT	374
#define	LPAREN	375
#define	LBRCKT	376

#line 3 "gram.y"

 /*
 ======================================================================
 CTREE Version 0.09
 Written by Shaun Flisakowski (1995)
 With small revisions for use in UNO
 by Gerard Holzmann, Bell Labs, Lucent Technologies (2000-2001)
 and by Russ Cox, Bell Labs (2003)
 ======================================================================
  This program is provided free of charge on an "as is" basis without
  warranty of any kind, either express or implied.  Acceptance and use
  of this program constitutes the user's understanding that (s)he will
  have no recourse for any actual or consequential damages, including,
  but not limited to, lost profits or savings, arising out of the use
  of or inability to use this program.  
 ======================================================================
  this grammar is based on "C - A Reference Manual" (4th Ed.),
  by Samuel P Harbison, and Guy L Steele Jr.
 */

#define	alloca	emalloc
#define	YYERROR_VERBOSE

#include <stdio.h>
#include <errno.h>
#include <setjmp.h>

#include "lexer.h"
#include "tree.h"
#include "symtab.h"
#include "token.h"
#include "globals.h"

#define YYDEBUG 1

static int debug = 0;
#if 0
int  yydebug = 1;
#endif

int structfieldflag;

extern int errno, err_cnt, Verbose;
extern char *progname;
extern int yylex(YYSTYPE *lvalp);
extern void name_scope(context_t *, char *, int);

static void insert_decl     (leafnode *, treenode *, treenode *);
static void insert_typedef  (leafnode *, treenode *, treenode *);
static void insert_component(leafnode *, treenode *, treenode *);
extern void add_constant(char *);
static void add_params_to_symtab(treenode *);
void *emalloc(uint);


#ifndef YYLTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YYLTYPE yyltype
#endif

#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		428
#define	YYFLAG		-32768
#define	YYNTBASE	122

#define YYTRANSLATE(x) ((unsigned)(x) <= 376 ? yytranslate[x] : 265)

static const 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,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     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,    31,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
    86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
    96,    97,    98,    99,   100,   101,   102,   103,   104,   105,
   106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
   116,   117,   118,   119,   120,   121
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     3,     5,     7,    10,    12,    14,    16,    19,
    22,    26,    29,    30,    32,    34,    37,    38,    44,    47,
    48,    50,    52,    55,    57,    59,    61,    63,    65,    67,
    69,    71,    73,    75,    77,    80,    84,    88,    90,    92,
    94,    96,    98,   104,   107,   110,   114,   118,   120,   126,
   134,   142,   148,   158,   160,   162,   164,   166,   172,   174,
   178,   180,   184,   187,   189,   193,   195,   199,   201,   205,
   208,   210,   215,   222,   224,   228,   230,   234,   236,   240,
   242,   246,   248,   252,   254,   256,   258,   260,   262,   264,
   266,   268,   270,   272,   274,   279,   282,   287,   290,   293,
   296,   299,   302,   305,   308,   310,   314,   315,   317,   319,
   320,   322,   324,   326,   330,   332,   334,   336,   340,   344,
   346,   348,   350,   352,   354,   356,   361,   363,   365,   368,
   371,   372,   374,   376,   380,   382,   385,   387,   389,   391,
   393,   395,   397,   399,   401,   403,   405,   409,   411,   412,
   414,   415,   417,   420,   423,   426,   429,   432,   433,   435,
   437,   441,   442,   444,   446,   450,   452,   456,   457,   459,
   461,   466,   472,   477,   478,   480,   482,   485,   486,   488,
   490,   492,   494,   496,   498,   500,   502,   504,   506,   508,
   510,   512,   514,   516,   518,   520,   522,   524,   526,   528,
   530,   532,   534,   536,   538,   539,   541,   543,   545,   552,
   555,   557,   561,   563,   567,   569,   570,   572,   573,   580,
   583,   584,   591,   594,   596,   599,   603,   605,   609,   611,
   613,   615,   617,   621,   623,   625,   627,   629,   632,   633,
   635,   638,   640,   642,   646,   648,   653,   658,   662,   664,
   667,   669,   672,   673,   675,   677,   681,   683,   687,   690,
   693,   695,   697,   701,   703,   705,   707,   709,   711,   713,
   716,   720,   724,   729,   733,   738,   743,   744,   749,   750,
   755,   760,   762,   764,   766,   769,   771,   773,   775
};

⌨️ 快捷键说明

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