kgram.c

来自「一个很不错的程序切片工具,希望大家来讨论以下,对测试人员很有帮助」· C语言 代码 · 共 1,918 行 · 第 1/5 页

C
1,918
字号
extern char *malloc(), *realloc();# line 2 "kgram.y"# include <stdio.h># include "ansi_parse.h"# include "lif.h"	static	set_typedef = 0;	static  char    sccsid[] = "@(#)kgram.y	1.7  10/26/94";	static	char	*parse_h_sccs_id = PARSE_H_SCCS_ID;	static	char	*lif_h_sccs_id = LIF_H_SCCS_ID;# define IDENTIFIER 257# define CONSTANT 258# define STRING_LITERAL 259# define SIZEOF 260# define PTR_OP 261# define INC_OP 262# define DEC_OP 263# define LEFT_OP 264# define RIGHT_OP 265# define LE_OP 266# define GE_OP 267# define EQ_OP 268# define NE_OP 269# define AND_OP 270# define OR_OP 271# define MUL_ASSIGN 272# define DIV_ASSIGN 273# define MOD_ASSIGN 274# define ADD_ASSIGN 275# define SUB_ASSIGN 276# define LEFT_ASSIGN 277# define RIGHT_ASSIGN 278# define AND_ASSIGN 279# define XOR_ASSIGN 280# define OR_ASSIGN 281# define TYPE_NAME 282# define TYPEDEF 283# define EXTERN 284# define STATIC 285# define AUTO 286# define REGISTER 287# define CHAR 288# define SHORT 289# define INT 290# define LONG 291# define SIGNED 292# define UNSIGNED 293# define FLOAT 294# define DOUBLE 295# define CONST 296# define VOLATILE 297# define VOID 298# define STRUCT 299# define UNION 300# define ENUM 301# define ELIPSIS 302# define RANGE 303# define CASE 304# define DEFAULT 305# define IF 306# define ELSE 307# define SWITCH 308# define WHILE 309# define DO 310# define FOR 311# define GOTO 312# define CONTINUE 313# define BREAK 314# define RETURN 315#define yyclearin yychar = -1#define yyerrok yyerrflag = 0extern int yychar;extern int yyerrflag;#ifndef YYMAXDEPTH#define YYMAXDEPTH 150#endifYYSTYPE yylval, yyval;# define YYERRCODE 256# line 1069 "kgram.y"print_flags (flags)	int		flags;{	static char	*flag_names[] = {		"char", "short", "int", "long", "signed",		"unsigned", "float", "double", "const",		"volatile", "void", "u/s", "enum", "user type",		"typedef", "extern", "static", "auto", "register",		"struct", "union"};	int		i = 0;	while (flags){		if (flags & 1) printf ("%s ",flag_names[i]);		i++;		flags = flags >> 1;	}}print_decl (type_spec,var_specs)	token_ptr	type_spec,var_specs;{	token_ptr 	s,t;	type_ptr	ty;	printf ("Declaration: ");	if (type_spec) {		printf ("%8x ",type_spec->desc.decl->decl_flags);		print_flags (type_spec->desc.decl->decl_flags);		if (type_spec->desc.decl->decl_flags & FLAG_TYPE_US){			printf ("\n    Struct/union: ");			if (type_spec){				if (type_spec->desc.decl->tag){					printf ("(%s) ",						type_spec->desc.decl->tag->text);				}				s = type_spec->desc.decl->members;				while (s){					if (s->desc.decl)print_decl (s,s->desc.decl->vars);					s = s->next;				}			}			printf ("\n    End Struct/union: ");		}		t = var_specs;		while (t) {			if(t->text)printf (" %s",t->text);			if (ty = t->desc.type_desc){				printf (" (");				while(ty){					if (ty->is == IS_FUNC_RET) 						printf (" function returning");					else if (ty->is == IS_ARRAY_OF) 						printf (" array of");					else if (ty->is == IS_PTR_TO) 						printf (" pointer to");					ty = ty -> next;				}				printf (")");			}			t = t -> next;			if(t)printf ("\n%21s","");		}	}	printf ("\n");}print_token(t)	token_ptr	t;{	printf ("TOKEN:");	if (t){		printf (" addr %d",t);		if (t->text) printf (" (%s)",t->text);		printf (" at %d(%d)-%d(%d)",			t->at.line_start,			t->at.col_start,			t->at.line_end,			t->at.col_end);	}	else printf (" is null");	printf ("\n");}int yyexca[] ={-1, 1,	0, -1,	-2, 0,-1, 7,	59, 224,	-2, 226,-1, 9,	40, 137,	-2, 135,-1, 46,	59, 89,	44, 89,	-2, 228,-1, 50,	40, 137,	-2, 136,-1, 58,	123, 108,	-2, 111,-1, 255,	40, 137,	-2, 166,-1, 306,	40, 137,	-2, 167,	};# define YYNPROD 234# define YYLAST 1381int yyact[]={    96,    14,   311,    14,   194,   205,   333,   332,   364,    14,   151,    14,    49,   132,   123,   131,    14,   192,   106,   138,    16,   139,   166,   119,     5,   182,     5,   136,   137,   142,   143,   120,     8,   219,     8,   255,    69,   272,    58,    61,    35,    15,   172,    51,    52,    53,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    60,   112,     9,    15,    36,    16,    14,    15,    59,    16,   196,    77,   117,    50,   301,    76,   150,   124,   186,   105,   111,   184,    80,    73,    75,   133,    44,   186,   257,   152,   107,   272,   118,    16,   175,   354,    74,    15,   113,    16,   134,   173,    72,   168,   345,   115,   309,   314,    14,   129,   307,   256,    48,    95,   112,    66,   187,    47,    90,   201,    83,    14,    91,    92,   177,    93,   368,    79,   252,    12,    81,   366,   174,   252,   116,   275,   124,   232,    65,   204,   217,   189,   257,   336,   353,   155,    57,    62,   289,   335,   274,   156,   297,    64,   296,   300,   252,   262,   263,   280,   152,    10,   257,   114,   327,   288,   261,   152,   185,   286,   303,   152,    95,   276,   153,    14,   252,    90,    56,    83,   346,    91,    92,   121,    93,   103,   144,   112,   145,   109,   148,    63,   110,   201,    36,   146,   154,   283,   204,   116,   147,   365,    36,   118,   252,   347,    94,    78,   237,   238,   201,   236,   295,   109,   293,   128,   233,   102,   163,   235,   299,   277,   268,   130,   279,   140,   141,   245,   246,   302,   234,    95,   267,   231,   230,   109,    90,   178,    83,   287,    91,    92,   264,    93,   220,   221,   222,   223,   224,   225,   226,   227,   228,   229,    36,   273,   153,   204,    36,   370,   253,   281,   118,   305,   324,    94,   285,   278,   308,   320,   243,   244,    14,    14,    22,    23,    14,   247,   248,   249,    36,   270,   363,   178,    36,   201,   344,   201,   174,   201,   306,   326,   177,   328,   313,   109,   329,   330,   331,   174,   334,   322,   325,   343,   174,   109,   188,   306,    36,   189,   319,     7,   124,   323,    36,   254,   338,   317,   315,   308,    46,   118,   215,   282,    94,   266,   201,    54,   201,   265,   283,   251,   348,   250,    50,   101,   271,    36,    97,    99,    88,   352,    85,    86,   341,   356,   239,   240,   241,   242,   201,   201,   201,   342,   358,   359,   360,   357,   361,   334,   362,   294,   272,   310,    16,   201,   157,   158,   159,   367,   292,   201,   334,   369,   174,   371,   351,   122,   350,   252,   349,   252,   304,   252,   202,   203,   206,   127,   207,   208,   209,   210,   211,   212,   213,   214,    36,    97,    99,    88,    95,    85,    86,   109,   291,    90,   149,    83,   290,    91,    92,   100,    93,   257,   135,   190,    67,     3,   254,   183,    41,    43,    42,   104,   316,    55,   204,    98,     4,     2,     1,   200,   122,   199,   271,   198,    82,   197,   193,   284,   195,   216,   170,   202,   203,   206,   171,   207,   208,   209,   210,   211,   212,   213,   214,    36,    97,    99,    88,    95,    85,    86,   169,    34,    90,   180,    83,    37,    91,    92,    33,    93,    11,   160,   162,    82,   164,   258,    45,   218,    71,    87,   260,    84,   149,   204,   269,    89,   149,     0,   118,     0,   191,    94,     0,     0,     0,     0,     0,     0,     0,   167,   202,   203,   206,     0,   207,   208,   209,   210,   211,   212,   213,   214,     0,     0,     0,     0,    82,     0,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,    82,     0,    95,     0,     0,     0,     0,    90,     0,    83,     0,    91,    92,   118,    93,     0,    94,     0,     0,     0,    95,     0,     0,     0,     0,    90,     0,    83,     0,    91,    92,     0,    93,     0,     0,     0,    82,     0,     0,    82,     0,     0,     0,    36,     0,   256,   310,    16,    54,     0,     0,   183,     0,     0,    82,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    36,    97,    99,    88,     0,    85,    86,    94,   257,    15,     0,    16,     0,     0,     0,    82,     0,     0,     0,     0,     0,    82,   125,     0,   337,    94,     0,     0,     6,     0,   355,     0,     0,     0,     0,     0,     0,     0,     0,     0,    82,     0,     0,     0,     0,     0,     0,   202,   203,   206,     0,   207,   208,   209,   210,   211,   212,   213,   214,    36,    97,    99,    88,     0,    85,    86,     0,    82,   118,     0,     0,    82,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,   318,    36,   256,     0,    16,     0,     0,     0,     0,     0,     0,     0,     0,     0,   202,   203,   206,     0,   207,   208,   209,   210,   211,   212,   213,   214,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    36,    97,    99,    88,     0,    85,    86,   257,    15,     0,    16,     0,     0,     0,     0,     0,   321,     0,    36,    97,    99,    88,     0,    85,    86,    35,   184,   181,     0,     0,     0,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,     0,     0,     0,    36,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    35,    17,    18,    19,    20,    21,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    35,   176,   126,     0,     0,     0,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,     0,    35,     0,     0,     0,     0,     0,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,    13,     0,     0,    95,     0,     0,    70,    36,    90,     0,    83,    95,    91,    92,     0,    93,    90,     0,    83,    95,    91,    92,     0,    93,    90,     0,    83,   259,    91,    92,     0,    93,    35,     0,     0,     0,     0,     0,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,     0,    95,     0,     0,   108,     0,    90,   340,    83,    95,    91,    92,     0,    93,    90,   312,    83,     0,    91,    92,     0,    93,     0,     0,    95,     0,     0,   298,   108,    90,     0,    83,    95,    91,    92,     0,    93,    90,     0,    83,    94,    91,    92,     0,    93,     0,     0,     0,    94,     0,   108,     0,   179,     0,     0,     0,    94,    35,     0,     0,     0,     0,     0,    24,    25,    26,    27,    28,    29,    30,    31,    22,    23,    32,    39,    40,    38,     0,     0,     0,     0,     0,     0,     0,    68,     0,    70,     0,     0,    70,     0,     0,     0,     0,    94,     0,     0,     0,   179,   125,     0,     0,    94,     0,    70,     0,    95,     0,     0,     0,   108,    90,     0,   165,    95,    91,    92,    94,    93,    90,   108,   161,     0,    91,    92,    94,    93,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    70,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    36,    97,    99,    88,     0,    85,    86,    70,    36,    97,    99,    88,     0,    85,    86,     0,    36,    97,    99,    88,     0,    85,    86,     0,     0,     0,     0,     0,    94,     0,     0,     0,     0,     0,   339,     0,    94,     0,    70,     0,     0,     0,     0,     0,     0,     0,     0,   108,     0,     0,     0,     0,     0,     0,    36,    97,    99,    88,     0,    85,    86,     0,    36,    97,    99,    88,     0,    85,    86,     0,     0,     0,     0,     0,     0,     0,     0,    36,    97,    99,    88,     0,    85,    86,     0,    36,    97,    99,    88,     0,    85,    86,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    36,    97,    99,    88,     0,    85,    86,     0,    36,    97,    99,    88,     0,    85,    86 };int yypact[]={   593, -1000,   593, -1000, -1000, -1000, -1000, -1000,    27,    21,     1,   633,   633,   633, -1000,    57,   -22, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,   -55,   -63, -1000, -1000, -1000, -1000, -1000, -1000,    94,    54, -1000,  1027,   371,    21, -1000, -1000, -1000,   294,   -22, -1000, -1000, -1000,  -242,  -193,   -25,   104,   569, -1000,    57,  1012, -1000, -1000,    16, -1000,   -48,  -257,   -39,     6,   376,  -241,   -41,  -235,   143,   153, -1000, -1000,   505,   105,  1117,  1117,  1035,  1109, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,  -237, -1000,   460, -1000, -1000, -1000,   -29,   811, -1000,   730, -1000, -1000,    43, -1000,    55,  -193, -1000, -1000, -1000,   633,   367, -1000,    27, -1000,    54, -1000, -1000,  1012, -1000,   -28,   569, -1000,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,  1035,   292,   290, -1000,   132,   678,  1035,   966,  -193,  -193, -1000, -1000, -1000,  1035, -1000, -1000, -1000,   505, -1000, -1000,   288,   284,   188,   178, -1000, -1000,    51,  -242, -1000, -1000, -1000, -1000,    91, -1000, -1000,   115,  1035, -1000,  -193,  1035,    34, -1000,   -31, -1000,   198,   633, -1000, -1000, -1000, -1000, -1000, -1000, -1000,   111,  1035,   107, -1000,    89,   368,   364,   330,   426,   321,  -193,    95,    93,  1004, -1000,    30, -1000,  1035, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,  -257,   112,   -39,     6,   376,  -241,   -41,   -41,  -235,  -235,  -235,  -235,   143,   143,   153,   153, -1000, -1000, -1000, -1000,  1035,  1035, -1000,    71,    19,   541,   958,    14, -1000,   277, -1000, -1000, -1000,   276, -1000, -1000,   414,  -193, -1000, -1000,    -3,   322,   653, -1000,    23,  1035, -1000, -1000, -1000, -1000, -1000, -1000, -1000,   139,   633,   426,   106,   426, -1000,  1035,  1035,  1035,  -302,  1035,    90, -1000, -1000, -1000,    84, -1000,   523, -1000,  1035, -1000, -1000,    19,   950,   313,   262, -1000,   245, -1000,    11, -1000, -1000,   136, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,    80, -1000,   426, -1000,   339,   337,   335,   301,    85,   132, -1000, -1000, -1000, -1000, -1000, -1000,     2,   613, -1000, -1000, -1000,  1035, -1000, -1000,   426,   426,   426,  1035,  1035, -1000, -1000,   241, -1000,  -299, -1000, -1000,   160,    72, -1000,   426,    67,  1035, -1000, -1000,   218,   426, -1000 };int yypgo[]={     0,   487,   483,   482,   387,   481,   130,    82,   127,   207,    71,    75,    84,    96,    83,   102,   480,   937,    10,   479,     6,     5,   322,    36,    23,    31,   478,   117,   472,   980,   470,   467,    79,    18,   465,    25,   463,   192,    80,   311,    62,   161,   462,   446,     2,   442,    42,    76,   106,    35,    14,   441,     4,   440,   439,   438,    70,    72,    17,   437,   435,   433,   431,   105,   430,   429,   417,   428,   147,     0,   427,    90,   129,   425,   424,   423,    12,   422,   421,   416,   415 };

⌨️ 快捷键说明

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